mirror of https://github.com/M66B/FairEmail.git
Fixed fast scroll performance
This commit is contained in:
parent
b6b1768461
commit
7054afec29
|
@ -449,12 +449,14 @@ public class FastScrollerEx extends RecyclerView.ItemDecoration implements Recyc
|
|||
if (Math.abs(mVerticalThumbCenterY - y) < 2) {
|
||||
return;
|
||||
}
|
||||
int scrollingBy = scrollTo(mVerticalDragY, y, scrollbarRange,
|
||||
mRecyclerView.computeVerticalScrollRange(),
|
||||
mRecyclerView.computeVerticalScrollOffset(), mRecyclerViewHeight);
|
||||
if (scrollingBy != 0) {
|
||||
mRecyclerView.scrollBy(0, scrollingBy);
|
||||
}
|
||||
|
||||
int scrollbarLength = scrollbarRange[1] - scrollbarRange[0];
|
||||
float percentage = (scrollbarLength == 0 ? 0 : y / (float) scrollbarLength);
|
||||
androidx.recyclerview.widget.RecyclerView.Adapter adapter = mRecyclerView.getAdapter();
|
||||
int count = (adapter == null ? 0 : adapter.getItemCount());
|
||||
int pos = Math.round(count * percentage);
|
||||
mRecyclerView.scrollToPosition(pos);
|
||||
|
||||
mVerticalDragY = y;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue