epoxy
epoxy copied to clipboard
Sticky header does not call bind methods when it transitions from stuck header to scrollable item
trafficstars
We are using the Kotlin with the View Holder pattern. I added logging statements that are output when preBind, bind and unbind are called on the model to determine the root cause.
- In a recycler view add items, some with sticky headers - need to have multiple sticky header items with some other items between them. For this example assume we have Sticky Headers 0, 5, and 10 with 4 items between them.
- When the recycler view is first displayed observe that
prebindandbindis called for all headers displayed. - Scroll down so that a sticky header item 5 is in the middle of the recycler view.
- Scroll up until sticky header item 5 is stuck at the top. Observer that
prebindandbindare both called. - Scroll down until sticky header item 5 is not stuck at the top (scrolling in the list). Observe that
unbindis called, butprebindandbindare not called again once it is back to scrolling with the list. - At this point the only way to get
prebindandbindto be called for the instance scrolling in the list is to scroll down and back up again.
So the issue seems to be when the transition from header stuck at the top, to scrolling in the list the prebind / bind methods are not called. Similarly, when the transition from scrolling in the list to stuck header occurs unbind is not called.
May be related to Issue 1230 and this recent comment on the original PR.