Closed sikeeoh closed 5 years ago
~ Chiming in ~
I think this issue https://github.com/Arasthel/SpannedGridLayoutManager/issues/5 references the same bug 😃 I proposed a solution there that I still use today, I think it's worth the reflexion to find out which solution is the cleanest. What do you guys think @Arasthel @sikeeoh ?
~ Chiming in ~
I think this issue #5 references the same bug 😃 I proposed a solution there that I still use today, I think it's worth the reflexion to find out which solution is the cleanest. What do you guys think @Arasthel @sikeeoh ?
Actually, I just took a look at why your solution and @sikeeoh's both work and it helped me find the real cause. It was an edge case of allItemsInScreen
calculation when there are 0 elements, which in turn caused a buggy overscroll calculation which made the RecyclerView scroll and messed up the whole layouting of views until the scroll was corrected... by scrolling the RV manually.
Changing allItemsInScreen
to:
val allItemsInScreen = itemCount == 0 || (firstVisiblePosition == 0 && isLastItemInScreen)
Fixes this. I'm still testing if there are any side-effects with view restoration, rotation and scroll. If everything goes right I expect to release a fixed version tomorrow. Thank you both for your help!
I applied feedback @Arasthel
issue #36
When adding data to the adapter for the first time after receiving an asynchronous request, the scroll value is set to a different value which was supposed to be zero.