diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java index 168154ade..4aaa6b3b6 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/BaseStatusListFragment.java @@ -717,17 +717,18 @@ public abstract class BaseStatusListFragment exten } } - if (startIndex!=-1 && endIndex!=-1) { - // Only StatusListFragments/NotificationsListFragments can display status with quotes - assert (this instanceof StatusListFragment) || (this instanceof NotificationsListFragment); - List items=this.buildDisplayItems((T) parent); - int itemCount = displayItems.subList(startIndex, endIndex+1).size()-1; - displayItems.subList(startIndex, endIndex+1).clear(); - adapter.notifyItemRangeChanged(startIndex, itemCount); - displayItems.addAll(startIndex, items); - if(!displayItems.isEmpty()) - adapter.notifyItemRangeChanged(startIndex, items.size()-1); - } + if (startIndex==-1 && endIndex==-1) + return; + + // Only StatusListFragments/NotificationsListFragments can display status with quotes + assert (this instanceof StatusListFragment) || (this instanceof NotificationsListFragment); + List oldItems = displayItems.subList(startIndex, endIndex+1); + List newItems=this.buildDisplayItems((T) parent); + int prevSize=oldItems.size(); + oldItems.clear(); + displayItems.addAll(startIndex, newItems); + adapter.notifyItemRangeRemoved(startIndex, prevSize); + adapter.notifyItemRangeInserted(startIndex, newItems.size()); } public void onVisibilityIconClick(HeaderStatusDisplayItem.Holder holder) {