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

BoundaryCaching and dataChange #12

Open
Armaxis opened this issue Jul 2, 2014 · 0 comments
Open

BoundaryCaching and dataChange #12

Armaxis opened this issue Jul 2, 2014 · 0 comments

Comments

@Armaxis
Copy link

Armaxis commented Jul 2, 2014

Hi,
I've faced a problem, when if boundaryCaching is set to true and notifyDataSetChanged() is called, first and last elements of viewpager become unpredictable. In my situation, after updating the viewpager current item was replaced by first element, so duplicates appeared in view pager.
I've fixed it by forcing adapter to destroy all existing toDestroy objects while doing notifyDataSetChanged(). So maybe it should be included to library too.

LoopPagerAdapterWrapper:

    public void notifyDataSetChanged() {
        for(int i = 0; i < mToDestroy.size(); i++){
            ToDestroy value = mToDestroy.valueAt(i);
            mAdapter.destroyItem(value.container, value.position, value.object);
        }
        mToDestroy = new SparseArray<ToDestroy>();
        super.notifyDataSetChanged();
    }
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