Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared RecycledViewPool not supported for expandable items? #753

Open
venjirai opened this issue Dec 11, 2019 · 1 comment
Open

Shared RecycledViewPool not supported for expandable items? #753

venjirai opened this issue Dec 11, 2019 · 1 comment

Comments

@venjirai
Copy link

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.

@venjirai venjirai changed the title Shared RecycledViewPool not suppored for expandable items? Shared RecycledViewPool not supported for expandable items? Dec 11, 2019
@venjirai
Copy link
Author

I think the problem is, that since the ViewHolder is reused from the other adapter, the reference of mAdapter also points to that instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant