Skip to content

Commit 20f540c

Browse files
committed
Fix sorting during category selected
Signed-off-by: Kornél Szekeres <[email protected]>
1 parent ebb60b1 commit 20f540c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: app/src/main/java/it/niedermann/owncloud/notes/main/MainViewModel.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import static it.niedermann.owncloud.notes.main.slots.SlotterUtil.fillListByInitials;
1717
import static it.niedermann.owncloud.notes.main.slots.SlotterUtil.fillListByTime;
1818
import static it.niedermann.owncloud.notes.shared.model.CategorySortingMethod.SORT_MODIFIED_DESC;
19-
import static it.niedermann.owncloud.notes.shared.model.CategorySortingMethod.SORT_LEXICOGRAPHICAL_ASC;
19+
import static it.niedermann.owncloud.notes.shared.model.CategorySortingMethod.SORT_LEXICOGRAPHICAL_DESC;
2020
import static it.niedermann.owncloud.notes.shared.model.ENavigationCategoryType.DEFAULT_CATEGORY;
2121
import static it.niedermann.owncloud.notes.shared.model.ENavigationCategoryType.FAVORITES;
2222
import static it.niedermann.owncloud.notes.shared.model.ENavigationCategoryType.RECENT;
@@ -273,6 +273,9 @@ public LiveData<List<Item>> getNotesListLiveData() {
273273
}
274274

275275
private List<Item> fromNotes(List<Note> noteList, @NonNull NavigationCategory selectedCategory, @Nullable CategorySortingMethod sortingMethod) {
276+
if(sortingMethod == SORT_LEXICOGRAPHICAL_DESC){
277+
Collections.reverse(noteList);
278+
}
276279
if (selectedCategory.getType() == DEFAULT_CATEGORY) {
277280
final String category = selectedCategory.getCategory();
278281
if (category != null) {
@@ -284,9 +287,6 @@ private List<Item> fromNotes(List<Note> noteList, @NonNull NavigationCategory se
284287
if (sortingMethod == SORT_MODIFIED_DESC) {
285288
return fillListByTime(getApplication(), noteList);
286289
}
287-
if(sortingMethod != SORT_LEXICOGRAPHICAL_ASC){
288-
Collections.reverse(noteList);
289-
}
290290
return fillListByInitials(getApplication(), noteList);
291291
}
292292

0 commit comments

Comments
 (0)