Skip to content

Shared RecycledViewPool not supported for expandable items? #753

Open
@venjirai

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

changed the title Shared RecycledViewPool not suppored for expandable items? Shared RecycledViewPool not supported for expandable items? on Dec 11, 2019
venjirai

venjirai commented on Dec 11, 2019

@venjirai
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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Shared RecycledViewPool not supported for expandable items? · Issue #753 · davideas/FlexibleAdapter