-
Notifications
You must be signed in to change notification settings - Fork 554
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
Expandable Sticky Header becomes invalid after updateDataSet #404
Comments
@omgreel, can you enable Verbose logs and see what happens when you try to collapse? Did you try to debug as well? Do you somewhere call |
I will provide logs a bit later. This
come to this
and this method returns -1. |
|
@omgreel, can you debug that part of code and see what happens to the instance of that VH? |
Hello there. Sorry for late response.
However, it's never called because Any ideas what else could be wrong? |
@omgreel, ok I really don't know what happens to the position, I believed it is counted from the LayoutManager, so in that logic if we are able to retrieve the VH from a position, we can guess that we can retrieve the position from the VH, but probably is not as we suppose. I can try to force that backup position even if the holder is found, they should match. As you can read from the Javadoc that position is lost because the VH is generated out of the LayoutManager when is scrolled down (because the header is much higher than the showed and recycled items), so the RV doesn't know about that holder yet. I will move outsite that backup setting, I think it should work then. I believe instead that is the cause, because when it is checked if an item is enabled, the position -1 will make it return false, so the click event is interrupted. PS: Unfortunately, you can't even override the onClick, because indeed you don't have the position... |
There is one more thing that I noticed. |
Hi again.
I'm facing strange bug.
There is my case.
First of all, I create adapter passing null into adapter's constructor.
Then data loads from network and after data was loaded I map it into Expandable and Section items and call
updateDataSet(mappedItems)
. Everything works fine so far.The problem appears after data loaded from network, mapped and
updateDataSet
called again.If there were sticky header, it is never collapsing onClick, until it become unsticky.
I logged
holder.toString()
to see if there is different holders after update.For example, before
updateDataSet
called second time, sticky header has something like this:{3CA0C98E POSITION=2 ID=-1, OLDPOS=-1, PLPOS:-1, SCRAP[ATTACHEDSCRAP] TMPDETACHED NO PARENT}
After
updateDataSet
was called:{3CA0C98E POSITION=2 ID=-1, OLDPOS=-1, PLPOS:-1, INVALID UPDATE NOT RECYCLABLE(1) UNDEFINED ADAPTER POSITION NO PARENT}
And if I scroll a bit to made header unsticky I can see that this Expandable item has different
hashCode
's hex string, but it is still the same item.Sorry for kinda messy question. I just spent two hours to find the problem and ended up with nothing.
Hope you can say me what I missed.
Here is the snippets of ExpandableItem and SectionItem:
ExpandableItem
SectionItem
The text was updated successfully, but these errors were encountered: