Use account order to sort identities

This commit is contained in:
M66B 2019-04-25 09:21:09 +02:00
parent 99f40221ea
commit e33f9848c7
2 changed files with 3 additions and 17 deletions

View File

@ -39,7 +39,9 @@ public interface DaoIdentity {
" JOIN folder ON folder.account = identity.account AND folder.type = '" + EntityFolder.DRAFTS + "'" +
" WHERE (:account IS NULL OR identity.account = :account)" +
" AND identity.synchronize" +
" AND account.synchronize")
" AND account.synchronize" +
" ORDER BY account.`order`, account.`primary` DESC, account.name COLLATE NOCASE" +
", identity.`primary` DESC, identity.display COLLATE NOCASE, identity.name COLLATE NOCASE, identity.email COLLATE NOCASE")
List<TupleIdentityEx> getComposableIdentities(Long account);
@Query("SELECT identity.*, account.name AS accountName FROM identity" +

View File

@ -119,8 +119,6 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Locale;
@ -1980,20 +1978,6 @@ public class FragmentCompose extends FragmentBase {
if (identities == null)
identities = new ArrayList<>();
// Sort identities
Collections.sort(identities, new Comparator<TupleIdentityEx>() {
@Override
public int compare(TupleIdentityEx i1, TupleIdentityEx i2) {
int a = i1.accountName.compareTo(i2.accountName);
if (a != 0)
return a;
int d = i1.getDisplayName().compareTo(i2.getDisplayName());
if (d != 0)
return d;
return i1.email.compareTo(i2.email);
}
});
return identities;
}