timusus / RecyclerView-FastScroll

A simple FastScroller for Android's RecyclerView
Other
1.39k stars 183 forks source link

The thumb position changes continuously during the view scrolling #107

Closed geometer closed 4 years ago

geometer commented 4 years ago

In the release version, the thumb does not move until the top item changes and jumps every time a new top item crosses the edge.

Actually the change is a partial rollback of https://github.com/timusus/RecyclerView-FastScroll/commit/7cc13a5d8dbf537ba6b57a3042a7b2737214252e. I did not test how this works with reverse layout, so maybe this requires some extra investigation before merging.

timusus commented 4 years ago

Thanks for this. I have noticed the issue but haven't looked into it.

Rather than partially rolling back 7cc13a5, I think we could add a simple check for isReverseLayout(), and only account for the scrollPosState.rowTopOffset if it returns false. This would ensure compatibility.

geometer commented 4 years ago

I agree this is a safe way.

On the other hand, if you know what the reverse layout is, it should be easy to check if it works or not. I'm sure the same jumps are visible in reverse layout mode too, as the current code only uses the item index. Maybe there should be "+ scrollPosState.rowTopOffset" instead of "- scrollPosState.rowTopOffset" :).

geometer commented 4 years ago

Hmm, I tried to call LayoutManager.setReverseLayout(true) in my app (GridLayoutManager, not measurable). Seems like the problem is deeper than I expected. There are jumps, and there is an additional vertical shift of the thumb.

timusus commented 4 years ago

OK, it sounds like this pull request is not in a state where it can be merged in. If I get a chance, I'll have a look into this issue. Feel free to reopen or file another PR if you do find time to implement a compatible fix.