fix(StatusDisplayItem/Quote): notify adapter separately

Only notifying the adapter once could lead to cases where the quoting
status was merged with or replaced by the quote status. Separately
notifying it seems to trigger the issue less often.
This commit is contained in:
FineFindus
2024-07-07 08:50:57 +02:00
parent ca4a1d461a
commit 9b1e79eba8

View File

@@ -722,10 +722,11 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
assert (this instanceof StatusListFragment) || (this instanceof NotificationsListFragment); assert (this instanceof StatusListFragment) || (this instanceof NotificationsListFragment);
List<StatusDisplayItem> items=this.buildDisplayItems((T) parent); List<StatusDisplayItem> items=this.buildDisplayItems((T) parent);
displayItems.subList(startIndex, endIndex+1).clear(); displayItems.subList(startIndex, endIndex+1).clear();
adapter.notifyItemRangeRemoved(startIndex, endIndex+1);
boolean isEmpty=displayItems.isEmpty(); boolean isEmpty=displayItems.isEmpty();
displayItems.addAll(startIndex, items); displayItems.addAll(startIndex, items);
if(!isEmpty) if(!isEmpty)
adapter.notifyItemRangeChanged(startIndex, items.size()); adapter.notifyItemRangeInserted(startIndex, items.size());
} }
} }