mirror of https://github.com/M66B/FairEmail.git
Simplify account ordering
This commit is contained in:
parent
065f7caac9
commit
58b8c071be
|
@ -29,10 +29,12 @@ import java.util.List;
|
|||
|
||||
@Dao
|
||||
public interface DaoAccount {
|
||||
@Query("SELECT * FROM account")
|
||||
@Query("SELECT * FROM account" +
|
||||
" ORDER BY `order`, `primary` DESC, name COLLATE NOCASE")
|
||||
List<EntityAccount> getAccounts();
|
||||
|
||||
@Query("SELECT * FROM account WHERE synchronize")
|
||||
@Query("SELECT * FROM account WHERE synchronize" +
|
||||
" ORDER BY `order`, `primary` DESC, name COLLATE NOCASE")
|
||||
List<EntityAccount> getSynchronizingAccounts();
|
||||
|
||||
@Query("SELECT * FROM account WHERE tbd = 1")
|
||||
|
|
|
@ -1159,18 +1159,6 @@ public class FragmentMessages extends FragmentBase {
|
|||
|
||||
result.accounts = db.account().getSynchronizingAccounts();
|
||||
|
||||
final Collator collator = Collator.getInstance(Locale.getDefault());
|
||||
collator.setStrength(Collator.SECONDARY); // Case insensitive, process accents etc
|
||||
Collections.sort(result.accounts, new Comparator<EntityAccount>() {
|
||||
@Override
|
||||
public int compare(EntityAccount a1, EntityAccount a2) {
|
||||
int p = -a1.primary.compareTo(a2.primary);
|
||||
if (p != 0)
|
||||
return p;
|
||||
return collator.compare(a1.name, a2.name);
|
||||
}
|
||||
});
|
||||
|
||||
for (EntityAccount account : result.accounts) {
|
||||
List<EntityFolder> targets = new ArrayList<>();
|
||||
List<EntityFolder> folders = db.folder().getFolders(account.id);
|
||||
|
|
Loading…
Reference in New Issue