Sort folders on display name

pull/147/head
M66B 6 years ago
parent 94eb9af995
commit aa3e4774e0

@ -395,7 +395,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
List<EntityFolder> folders = new ArrayList<>();
folders.addAll(_folders);
EntityFolder.sort(folders);
EntityFolder.sort(context, folders);
all.clear();
for (EntityFolder folder : folders)

@ -1503,7 +1503,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
!EntityFolder.JUNK.equals(folder.type))
targets.add(folder);
EntityFolder.sort(targets);
EntityFolder.sort(context, targets);
return targets;
}

@ -259,7 +259,7 @@ public class EntityFolder implements Serializable {
return folder;
}
static void sort(List<EntityFolder> folders) {
static void sort(final Context context, List<EntityFolder> folders) {
final Collator collator = Collator.getInstance(Locale.getDefault());
collator.setStrength(Collator.SECONDARY); // Case insensitive, process accents etc
@ -274,9 +274,9 @@ public class EntityFolder implements Serializable {
int c = -f1.synchronize.compareTo(f2.synchronize);
if (c != 0)
return c;
return collator.compare(
f1.name == null ? "" : f1.name,
f2.name == null ? "" : f2.name);
String name1 = f1.getDisplayName(context);
String name2 = f2.getDisplayName(context);
return collator.compare(name1, name2);
}
});
}

@ -1154,7 +1154,7 @@ public class FragmentAccount extends FragmentEx {
}
private void setFolders(List<EntityFolder> folders) {
EntityFolder.sort(folders);
EntityFolder.sort(getContext(), folders);
EntityFolder none = new EntityFolder();
none.name = "";

@ -836,7 +836,7 @@ public class FragmentIdentity extends FragmentEx {
result.identity = db.identity().getIdentity(iid);
result.folders = db.folder().getFolders(aid);
EntityFolder.sort(result.folders);
EntityFolder.sort(context, result.folders);
return result;
}

@ -1079,7 +1079,7 @@ public class FragmentMessages extends FragmentEx {
(fid < 0 ? !folder.unified : !folder.id.equals(fid)))
targets.add(folder);
EntityFolder.sort(targets);
EntityFolder.sort(context, targets);
return targets;
}

Loading…
Cancel
Save