fix(unofficial-quotes): try to fix the sudden reload to the top (again)

This commit is contained in:
LucasGGamerM 2024-07-17 12:09:07 -03:00
parent 519cb672d2
commit 1829dc1d9d
1 changed files with 4 additions and 4 deletions

View File

@ -721,12 +721,12 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
// Only StatusListFragments/NotificationsListFragments can display status with quotes // Only StatusListFragments/NotificationsListFragments can display status with quotes
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);
int itemCount = displayItems.subList(startIndex, endIndex+1).size()-1;
displayItems.subList(startIndex, endIndex+1).clear(); displayItems.subList(startIndex, endIndex+1).clear();
// adapter.notifyItemRangeRemoved(startIndex, endIndex+1); adapter.notifyItemRangeChanged(startIndex, itemCount);
boolean isEmpty=displayItems.isEmpty();
displayItems.addAll(startIndex, items); displayItems.addAll(startIndex, items);
if(!isEmpty) if(!displayItems.isEmpty())
adapter.notifyItemRangeInserted(startIndex, items.size()); adapter.notifyItemRangeChanged(startIndex, items.size()-1);
} }
} }