pull/178/head
M66B 6 years ago
parent f8982f70e0
commit 64e0ab7401

@ -803,32 +803,37 @@ public class FragmentCompose extends FragmentBase {
Collections.sort(items, new Comparator<EntityContact>() { Collections.sort(items, new Comparator<EntityContact>() {
@Override @Override
public int compare(EntityContact i1, EntityContact i2) { public int compare(EntityContact i1, EntityContact i2) {
if (suggest_frequently) { try {
int t = -i1.times_contacted.compareTo(i2.times_contacted); if (suggest_frequently) {
if (t != 0) int t = -i1.times_contacted.compareTo(i2.times_contacted);
return t; if (t != 0)
return t;
int l = -i1.last_contacted.compareTo(i2.last_contacted);
if (l != 0) int l = -i1.last_contacted.compareTo(i2.last_contacted);
return l; if (l != 0)
} else { return l;
int a = -Boolean.compare(i1.id == 0, i2.id == 0); } else {
if (a != 0) int a = -Boolean.compare(i1.id == 0, i2.id == 0);
return a; if (a != 0)
} return a;
}
if (TextUtils.isEmpty(i1.name) && TextUtils.isEmpty(i2.name)) if (TextUtils.isEmpty(i1.name) && TextUtils.isEmpty(i2.name))
return 0; return 0;
if (TextUtils.isEmpty(i1.name) && !TextUtils.isEmpty(i2.name)) if (TextUtils.isEmpty(i1.name) && !TextUtils.isEmpty(i2.name))
return 1; return 1;
if (!TextUtils.isEmpty(i1.name) && TextUtils.isEmpty(i2.name)) if (!TextUtils.isEmpty(i1.name) && TextUtils.isEmpty(i2.name))
return -1; return -1;
int n = collator.compare(i1.name, i2.name); int n = collator.compare(i1.name, i2.name);
if (n != 0) if (n != 0)
return n; return n;
return collator.compare(i1.email, i2.email); return collator.compare(i1.email, i2.email);
} catch (Throwable ex) {
Log.e(ex);
return 0;
}
} }
}); });

Loading…
Cancel
Save