Shared RecycledViewPool not supported for expandable items? #753
Description
Does the library support shared recycledViewPools ?
I have a tablayout with FragmentPagerAdapter and several tabs that each use the same FlexibleAdapter which consists of AbstractExpandableItem as items with AbstractFlexibleItem as subitems.
The ExpandableViewHolder toggles the expansion on item click:
view.setOnClickListener(v ->
{
toggleExpansion();
});
which works without problems.
Since the ViewHolders in each tab/adapter are the same, I decided to use a shared ViewPool for the RecyclerView that gets initialized in the parent fragment to reduce the calls to onCreateViewHolder().
Now I have the problem though, that sometimes when toggleExpansion() gets called, nothing happens at all. The item is not collapsed or expanded. I guess it's the case when the adapter uses a viewholder from another tab because without the recycledViewPool, everything is working fine.
Activity
venjirai commentedon Dec 11, 2019
I think the problem is, that since the ViewHolder is reused from the other adapter, the reference of mAdapter also points to that instance.