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

Support UpdatingGroup inside ExpandableGroup #56

Closed
chip2n opened this issue Jan 4, 2017 · 1 comment
Closed

Support UpdatingGroup inside ExpandableGroup #56

chip2n opened this issue Jan 4, 2017 · 1 comment
Labels

Comments

@chip2n
Copy link

chip2n commented Jan 4, 2017

Using an UpdatingGroup as a child of an ExpandableGroup seems to cause the following error:

E/UncaughtException: java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{2fe4242 position=30 id=-1, oldPos=5, pLpos:5 scrap [attachedScrap] tmpDetached no parent}
                          at android.support.v7.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(RecyclerView.java:5046)
                          at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5177)
                          at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5158)
                          at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2061)
                          at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1445)
                          at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1408)
                          at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:580)
                          at android.support.v7.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:3330)
                          at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3186)
                          at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3632)

I noticed that UpdatingGroup dispatches updates even though the ExpandableGroup is collapsed, which is probably the issue. I've solved this by passing a boolean flag (dispatchUpdates) to UpdatingGroup.update which is set to true if the ExpandableGroup is expanded. This seems to work, although there might be a better solution.

@lisawray lisawray added the bug label Jan 4, 2017
@lisawray
Copy link
Owner

lisawray commented Jan 4, 2017

Ah, I see. The UpdatingGroup is dispatching updates to its parent the ExpandableGroup -- the ExpandableGroup should decide whether or not to forward these to its parent as a function of its collapsed state. This could happen with any child group which dispatches notifications while the parent is collapsed.

ExpandableGroup should probably override onXXChanged, etc and swallow these events while it's collapsed.

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

No branches or pull requests

2 participants