From fff8aa6a306203a408150d9dda429ea4b32914bf Mon Sep 17 00:00:00 2001 From: AndyScherzinger Date: Thu, 5 Jul 2018 18:07:16 +0200 Subject: [PATCH] move sorting method back to its original place for a proper diff! --- .../ui/activity/SyncedFoldersActivity.java | 95 ++++++++++--------- 1 file changed, 48 insertions(+), 47 deletions(-) diff --git a/src/main/java/com/owncloud/android/ui/activity/SyncedFoldersActivity.java b/src/main/java/com/owncloud/android/ui/activity/SyncedFoldersActivity.java index a0b547ccf8..1eef6d29ce 100644 --- a/src/main/java/com/owncloud/android/ui/activity/SyncedFoldersActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/SyncedFoldersActivity.java @@ -104,53 +104,6 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA private String path; private int type; - /** - * Sorts list of {@link SyncedFolderDisplayItem}s. - * - * @param syncFolderItemList list of items to be sorted - * @return sorted list of items - */ - public static List sortSyncedFolderItems(List - syncFolderItemList) { - Collections.sort(syncFolderItemList, new Comparator() { - public int compare(SyncedFolderDisplayItem f1, SyncedFolderDisplayItem f2) { - if (f1 == null && f2 == null) { - return 0; - } else if (f1 == null) { - return -1; - } else if (f2 == null) { - return 1; - } else if (f1.isEnabled() && f2.isEnabled()) { - return f1.getFolderName().toLowerCase(Locale.getDefault()).compareTo( - f2.getFolderName().toLowerCase(Locale.getDefault())); - } else if (f1.isEnabled()) { - return -1; - } else if (f2.isEnabled()) { - return 1; - } else if (f1.getFolderName() == null && f2.getFolderName() == null) { - return 0; - } else if (f1.getFolderName() == null) { - return -1; - } else if (f2.getFolderName() == null) { - return 1; - } - for (String folder : PRIORITIZED_FOLDERS) { - if (folder.equals(f1.getFolderName()) && - folder.equals(f2.getFolderName())) { - return 0; - } else if (folder.equals(f1.getFolderName())) { - return -1; - } else if (folder.equals(f2.getFolderName())) { - return 1; - } - } - return f1.getFolderName().toLowerCase(Locale.getDefault()).compareTo( - f2.getFolderName().toLowerCase(Locale.getDefault())); - } - }); - - return syncFolderItemList; - } @Override protected void onCreate(Bundle savedInstanceState) { @@ -296,6 +249,54 @@ public class SyncedFoldersActivity extends FileActivity implements SyncedFolderA } } + /** + * Sorts list of {@link SyncedFolderDisplayItem}s. + * + * @param syncFolderItemList list of items to be sorted + * @return sorted list of items + */ + public static List sortSyncedFolderItems(List + syncFolderItemList) { + Collections.sort(syncFolderItemList, new Comparator() { + public int compare(SyncedFolderDisplayItem f1, SyncedFolderDisplayItem f2) { + if (f1 == null && f2 == null) { + return 0; + } else if (f1 == null) { + return -1; + } else if (f2 == null) { + return 1; + } else if (f1.isEnabled() && f2.isEnabled()) { + return f1.getFolderName().toLowerCase(Locale.getDefault()).compareTo( + f2.getFolderName().toLowerCase(Locale.getDefault())); + } else if (f1.isEnabled()) { + return -1; + } else if (f2.isEnabled()) { + return 1; + } else if (f1.getFolderName() == null && f2.getFolderName() == null) { + return 0; + } else if (f1.getFolderName() == null) { + return -1; + } else if (f2.getFolderName() == null) { + return 1; + } + for (String folder : PRIORITIZED_FOLDERS) { + if (folder.equals(f1.getFolderName()) && + folder.equals(f2.getFolderName())) { + return 0; + } else if (folder.equals(f1.getFolderName())) { + return -1; + } else if (folder.equals(f2.getFolderName())) { + return 1; + } + } + return f1.getFolderName().toLowerCase(Locale.getDefault()).compareTo( + f2.getFolderName().toLowerCase(Locale.getDefault())); + } + }); + + return syncFolderItemList; + } + /** * merges two lists of {@link SyncedFolder} and {@link MediaFolder} items into one of SyncedFolderItems. *