Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,13 @@ protected void onCreate(Bundle savedInstanceState) {
updateSortMethodIcon(methodOfCategory.second);
activityBinding.sortingMethod.setOnClickListener((v) -> {
if (methodOfCategory.first != null) {
int newId = 0;
if (methodOfCategory.second != null)
{
newId = methodOfCategory.second.getId();
}
//Rotate for next sorting method
var newMethod = CategorySortingMethod.findById(methodOfCategory.second.getId() + 1);
var newMethod = CategorySortingMethod.findById(newId + 1);
final var modifyLiveData = mainViewModel.modifyCategoryOrder(methodOfCategory.first, newMethod);
modifyLiveData.observe(this, (next) -> modifyLiveData.removeObservers(this));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import static it.niedermann.owncloud.notes.main.slots.SlotterUtil.fillListByInitials;
import static it.niedermann.owncloud.notes.main.slots.SlotterUtil.fillListByTime;
import static it.niedermann.owncloud.notes.shared.model.CategorySortingMethod.SORT_MODIFIED_DESC;
import static it.niedermann.owncloud.notes.shared.model.CategorySortingMethod.SORT_LEXICOGRAPHICAL_ASC;
import static it.niedermann.owncloud.notes.shared.model.CategorySortingMethod.SORT_LEXICOGRAPHICAL_DESC;
import static it.niedermann.owncloud.notes.shared.model.ENavigationCategoryType.DEFAULT_CATEGORY;
import static it.niedermann.owncloud.notes.shared.model.ENavigationCategoryType.FAVORITES;
import static it.niedermann.owncloud.notes.shared.model.ENavigationCategoryType.RECENT;
Expand Down Expand Up @@ -273,6 +273,9 @@ public LiveData<List<Item>> getNotesListLiveData() {
}

private List<Item> fromNotes(List<Note> noteList, @NonNull NavigationCategory selectedCategory, @Nullable CategorySortingMethod sortingMethod) {
if(sortingMethod == SORT_LEXICOGRAPHICAL_DESC){
Collections.reverse(noteList);
}
if (selectedCategory.getType() == DEFAULT_CATEGORY) {
final String category = selectedCategory.getCategory();
if (category != null) {
Expand All @@ -284,9 +287,6 @@ private List<Item> fromNotes(List<Note> noteList, @NonNull NavigationCategory se
if (sortingMethod == SORT_MODIFIED_DESC) {
return fillListByTime(getApplication(), noteList);
}
if(sortingMethod != SORT_LEXICOGRAPHICAL_ASC){
Collections.reverse(noteList);
}
return fillListByInitials(getApplication(), noteList);
}

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/drawable/alphabetical_desc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
~
~ SPDX-FileCopyrightText: 2018-2024 Google LLC
~ SPDX-FileCopyrightText: 2018-2024 Andy Scherzinger
~ SPDX-FileCopyrightText: 2024-2025 Kornél Szekeres
~ SPDX-License-Identifier: Apache-2.0
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
Expand Down