timusus / RecyclerView-FastScroll

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

Fixed lag while scrolling through large lists #4

Closed kabouzeid closed 8 years ago

kabouzeid commented 8 years ago

Also updated .gitignore and prettified the sample

timusus commented 8 years ago

There are a few issues here:

1) This pull request introduces bugs related to GridLayoutManager support.

2) The issue of FastScroll lag has already been resolved. I understand you're looking to improve the smoothness of the list scrolling when dragging the FastScroll thumb. While your pull request does make things smoother, I think it's important to try and understand why using an offset of 'offset % rowHeight' solves the problem.. I'd like to test this further, as well as investigate whether this is indeed the correct way to resolve the issue.

kabouzeid commented 8 years ago

I understood what I did here. This resolves the issue because now it doesn't try to scroll to a position with the whole offset from position 0 which can get a very large number. Now it jumps between positions (the way that is currently used for lists > 50) and interpolates between them with an offset of exactly the amount that is missing. The offset is always between 0 and the item height. Obviously offset is expensive and jumping is cheap, so it makes sense to jump as near as we can to the position and then use the missing offset to move to the exact position. I'm currently really struggling to explain what I mean, my english skills obviously lack here.

The GridLayoutManager is a problem of course.

timusus commented 8 years ago

No problem. I understand what you're saying. your english is fine ;)

I'm not worried about your understanding of what you did, I'm worried about mine - before I accept your pull request! Fixing the GridLayoutManager issue should be simple.