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) {
|
if (Math.abs(mVerticalThumbCenterY - y) < 2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int scrollingBy = scrollTo(mVerticalDragY, y, scrollbarRange,
|
|
||||||
mRecyclerView.computeVerticalScrollRange(),
|
int scrollbarLength = scrollbarRange[1] - scrollbarRange[0];
|
||||||
mRecyclerView.computeVerticalScrollOffset(), mRecyclerViewHeight);
|
float percentage = (scrollbarLength == 0 ? 0 : y / (float) scrollbarLength);
|
||||||
if (scrollingBy != 0) {
|
androidx.recyclerview.widget.RecyclerView.Adapter adapter = mRecyclerView.getAdapter();
|
||||||
mRecyclerView.scrollBy(0, scrollingBy);
|
int count = (adapter == null ? 0 : adapter.getItemCount());
|
||||||
}
|
int pos = Math.round(count * percentage);
|
||||||
|
mRecyclerView.scrollToPosition(pos);
|
||||||
|
|
||||||
mVerticalDragY = y;
|
mVerticalDragY = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue