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) {
|
if (startIndex==-1 && endIndex==-1)
|
||||||
// Only StatusListFragments/NotificationsListFragments can display status with quotes
|
return;
|
||||||
assert (this instanceof StatusListFragment) || (this instanceof NotificationsListFragment);
|
|
||||||
List<StatusDisplayItem> items=this.buildDisplayItems((T) parent);
|
// Only StatusListFragments/NotificationsListFragments can display status with quotes
|
||||||
int itemCount = displayItems.subList(startIndex, endIndex+1).size()-1;
|
assert (this instanceof StatusListFragment) || (this instanceof NotificationsListFragment);
|
||||||
displayItems.subList(startIndex, endIndex+1).clear();
|
List<StatusDisplayItem> oldItems = displayItems.subList(startIndex, endIndex+1);
|
||||||
adapter.notifyItemRangeChanged(startIndex, itemCount);
|
List<StatusDisplayItem> newItems=this.buildDisplayItems((T) parent);
|
||||||
displayItems.addAll(startIndex, items);
|
int prevSize=oldItems.size();
|
||||||
if(!displayItems.isEmpty())
|
oldItems.clear();
|
||||||
adapter.notifyItemRangeChanged(startIndex, items.size()-1);
|
displayItems.addAll(startIndex, newItems);
|
||||||
}
|
adapter.notifyItemRangeRemoved(startIndex, prevSize);
|
||||||
|
adapter.notifyItemRangeInserted(startIndex, newItems.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onVisibilityIconClick(HeaderStatusDisplayItem.Holder holder) {
|
public void onVisibilityIconClick(HeaderStatusDisplayItem.Holder holder) {
|
||||||
|
|
Loading…
Reference in New Issue