Categorize identities

This commit is contained in:
M66B
2021-10-14 14:27:21 +02:00
parent cdee290a16
commit 7befbb0186
4 changed files with 97 additions and 3 deletions

View File

@@ -373,6 +373,11 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
Collections.sort(identities, new Comparator<TupleIdentityEx>() {
@Override
public int compare(TupleIdentityEx i1, TupleIdentityEx i2) {
int c = collator.compare(
i1.accountCategory == null ? "" : i1.accountCategory,
i2.accountCategory == null ? "" : i2.accountCategory);
if (c != 0)
return c;
int n = collator.compare(i1.getDisplayName(), i2.getDisplayName());
if (n != 0)
return n;
@@ -450,6 +455,13 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
return items.get(position).id;
}
public TupleIdentityEx getItemAtPosition(int pos) {
if (pos >= 0 && pos < items.size())
return items.get(pos);
else
return null;
}
@Override
public int getItemCount() {
return items.size();