use of net.osmand.plus.OsmandSettings.NotesSortByMode in project Osmand by osmandapp.
the class NotesFragment method createItemsList.
private List<Object> createItemsList() {
List<Recording> recs = new LinkedList<>(plugin.getAllRecordings());
List<Object> res = new LinkedList<>();
if (!recs.isEmpty()) {
NotesSortByMode sortByMode = getMyApplication().getSettings().NOTES_SORT_BY_MODE.get();
if (sortByMode.isByDate()) {
res.add(NotesAdapter.TYPE_DATE_HEADER);
res.addAll(sortRecsByDateDescending(recs));
} else if (sortByMode.isByType()) {
List<Recording> audios = new LinkedList<>();
List<Recording> photos = new LinkedList<>();
List<Recording> videos = new LinkedList<>();
for (Recording rec : recs) {
if (rec.isAudio()) {
audios.add(rec);
} else if (rec.isPhoto()) {
photos.add(rec);
} else {
videos.add(rec);
}
}
addToResIfNotEmpty(res, audios, NotesAdapter.TYPE_AUDIO_HEADER);
addToResIfNotEmpty(res, photos, NotesAdapter.TYPE_PHOTO_HEADER);
addToResIfNotEmpty(res, videos, NotesAdapter.TYPE_VIDEO_HEADER);
}
}
return res;
}
Aggregations