fix(unofficial-quote-toots): try and fix the adapter madness
I ended up adapting the poll items logic for this. I hope this is stable enough.
This commit is contained in:
parent
18079454a9
commit
55ad624209
|
@ -717,17 +717,18 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
|
|||
}
|
||||
}
|
||||
|
||||
if (startIndex!=-1 && endIndex!=-1) {
|
||||
// Only StatusListFragments/NotificationsListFragments can display status with quotes
|
||||
assert (this instanceof StatusListFragment) || (this instanceof NotificationsListFragment);
|
||||
List<StatusDisplayItem> 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<StatusDisplayItem> oldItems = displayItems.subList(startIndex, endIndex+1);
|
||||
List<StatusDisplayItem> 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) {
|
||||
|
|
Loading…
Reference in New Issue