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

Manager Throws Irrelated Exception when Swaping Adapters #52

Open
abedzinskas opened this issue Jan 9, 2018 · 0 comments
Open

Manager Throws Irrelated Exception when Swaping Adapters #52

abedzinskas opened this issue Jan 9, 2018 · 0 comments

Comments

@abedzinskas
Copy link

Greetings,

I have 2 recyclerview adapters that are of same class, for example:
val firstAdapter: SomeAdapter
val secondAdapter: SomeAdapter

Lets take, that firstAdapter have 100 values, and secondAdapter has 0 values. Lets also take that first adapter is visible. To produce a bug:

  1. Remove element from firstAdapter and add to secondAdapter.
  2. Make secondAdapter visible via recyclerView.swapAdapter(secondAdapter) or recyclerView.setAdapter(secondAdapter)
  3. An Exception is thrown:
    ava.lang.IllegalArgumentException: you can't move above of maxItemCount
    at com.beloo.widget.chipslayoutmanager.layouter.AbstractPositionIterator.move(AbstractPositionIterator.java:17)
    at com.beloo.widget.chipslayoutmanager.ChipsLayoutManager.fillWithLayouter(ChipsLayoutManager.java:852)
    at com.beloo.widget.chipslayoutmanager.ChipsLayoutManager.fill(ChipsLayoutManager.java:815)
    at com.beloo.widget.chipslayoutmanager.ChipsLayoutManager.onLayoutChildren(ChipsLayoutManager.java:719)
    at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3693)
    at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3410)
    at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3962)

However, if you use recyclerView.scrollToPosition(0) and then swapAdapters - everything works fine.

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