Search in sources :

Example 1 with NotesSortByMode

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;
}
Also used : NotesSortByMode(net.osmand.plus.OsmandSettings.NotesSortByMode) List(java.util.List) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) Recording(net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording) LinkedList(java.util.LinkedList)

Aggregations

ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 NotesSortByMode (net.osmand.plus.OsmandSettings.NotesSortByMode)1 Recording (net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording)1