From 8d94a44066a2352b9c1bc864086dfd0b0feb18a6 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Mon, 6 Dec 2021 13:08:50 +0100 Subject: [PATCH] - correctly highlight selected sort order - combine uploadFilesView and localFilesListView enum, as both are the same Signed-off-by: tobiasKaminsky --- .../owncloud/android/ui/activity/UploadFilesActivity.java | 2 +- .../android/ui/fragment/LocalFileListFragment.java | 8 ++++++-- .../java/com/owncloud/android/utils/FileSortOrder.java | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java b/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java index 34e7e34f7c..b7542020af 100644 --- a/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java @@ -319,7 +319,7 @@ public class UploadFilesActivity extends DrawerActivity implements LocalFileList @Override public void onSortingOrderChosen(FileSortOrder selection) { - preferences.setSortOrder(FileSortOrder.Type.uploadFilesView, selection); + preferences.setSortOrder(FileSortOrder.Type.localFileListView, selection); mFileListFragment.sortFiles(selection); } diff --git a/src/main/java/com/owncloud/android/ui/fragment/LocalFileListFragment.java b/src/main/java/com/owncloud/android/ui/fragment/LocalFileListFragment.java index 2402514cd0..47a691ca36 100644 --- a/src/main/java/com/owncloud/android/ui/fragment/LocalFileListFragment.java +++ b/src/main/java/com/owncloud/android/ui/fragment/LocalFileListFragment.java @@ -133,8 +133,12 @@ public class LocalFileListFragment extends ExtendedListFragment implements listDirectory(mContainerActivity.getInitialDirectory()); - FileSortOrder sortOrder = preferences.getSortOrderByType(FileSortOrder.Type.uploadFilesView); - mSortButton.setOnClickListener(v -> openSortingOrderDialogFragment(requireFragmentManager(), sortOrder)); + mSortButton.setOnClickListener(v -> { + FileSortOrder sortOrder = preferences.getSortOrderByType(FileSortOrder.Type.localFileListView); + openSortingOrderDialogFragment(requireFragmentManager(), sortOrder); + }); + + FileSortOrder sortOrder = preferences.getSortOrderByType(FileSortOrder.Type.localFileListView); mSortButton.setText(DisplayUtils.getSortOrderStringId(sortOrder)); setGridSwitchButton(); diff --git a/src/main/java/com/owncloud/android/utils/FileSortOrder.java b/src/main/java/com/owncloud/android/utils/FileSortOrder.java index 223c479f7a..f78d87878d 100644 --- a/src/main/java/com/owncloud/android/utils/FileSortOrder.java +++ b/src/main/java/com/owncloud/android/utils/FileSortOrder.java @@ -51,7 +51,7 @@ public class FileSortOrder { public static final Map sortOrders; public enum Type { - trashBinView, localFileListView, uploadFilesView + trashBinView, localFileListView } static { HashMap temp = new HashMap<>();