Replace all messages when re-loading

to ensure that messages deleted in the meantime get removed
This commit is contained in:
Torsten Grote
2021-02-26 13:22:57 -03:00
parent a12a639cd3
commit bf6be5c5a7
2 changed files with 3 additions and 3 deletions

View File

@@ -573,7 +573,7 @@ public class ConversationActivity extends BriarActivity
this::showImageOnboarding); this::showImageOnboarding);
} }
List<ConversationItem> items = createItems(headers); List<ConversationItem> items = createItems(headers);
adapter.addAll(items); adapter.replaceAll(items);
list.showData(); list.showData();
if (layoutManagerState == null) { if (layoutManagerState == null) {
scrollToBottom(); scrollToBottom();

View File

@@ -120,11 +120,11 @@ class ConversationAdapter
} }
@Override @Override
public void addAll(Collection<ConversationItem> itemsToAdd) { public void replaceAll(Collection<ConversationItem> itemsToReplace) {
items.beginBatchedUpdates(); items.beginBatchedUpdates();
// there can be items already in the adapter // there can be items already in the adapter
// SortedList takes care of duplicates and detecting changed items // SortedList takes care of duplicates and detecting changed items
items.addAll(itemsToAdd); items.replaceAll(itemsToReplace);
updateTimersInBatch(); updateTimersInBatch();
items.endBatchedUpdates(); items.endBatchedUpdates();
} }