Small improvement/fix

This commit is contained in:
M66B 2020-03-16 08:31:08 +01:00
parent 7eecc3f54e
commit 7f49de2a83
1 changed files with 3 additions and 13 deletions

View File

@ -4630,8 +4630,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
TupleMessageEx message = list.get(i); TupleMessageEx message = list.get(i);
if (message != null) if (message != null) {
keyPosition.put(message.id, i);
message.resolveKeywordColors(context); message.resolveKeywordColors(context);
}
} }
differ.submitList(list); differ.submitList(list);
@ -4767,18 +4769,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} }
int getPositionForKey(long key) { int getPositionForKey(long key) {
if (keyPosition.isEmpty()) {
PagedList<TupleMessageEx> messages = getCurrentList();
if (messages != null) {
for (int i = 0; i < messages.size(); i++) {
TupleMessageEx message = messages.get(i);
if (message != null)
keyPosition.put(message.id, i);
}
Log.i("Mapped keys=" + keyPosition.size());
}
}
if (keyPosition.containsKey(key)) { if (keyPosition.containsKey(key)) {
int pos = keyPosition.get(key); int pos = keyPosition.get(key);
Log.d("Position=" + pos + " @Key=" + key); Log.d("Position=" + pos + " @Key=" + key);