Use separator handler for fast scroll delay

pull/200/head
M66B 4 years ago
parent 162306268c
commit 10a9c80e13

@ -465,14 +465,17 @@ public class FastScrollerEx extends RecyclerView.ItemDecoration implements Recyc
float percentage = (scrollbarLength == 0 ? 0 : y / (float) scrollbarLength); float percentage = (scrollbarLength == 0 ? 0 : y / (float) scrollbarLength);
int pos = Math.round(count * percentage); int pos = Math.round(count * percentage);
scrollTo = pos; scrollTo = pos;
mRecyclerView.removeCallbacks(scroll); if (handler == null)
mRecyclerView.postDelayed(scroll, 100); handler = new android.os.Handler(android.os.Looper.getMainLooper());
handler.removeCallbacks(scroll);
handler.postDelayed(scroll, 100);
} }
mVerticalDragY = y; mVerticalDragY = y;
} }
private int scrollTo; private int scrollTo;
private android.os.Handler handler;
private final Runnable scroll = new Runnable() { private final Runnable scroll = new Runnable() {
@Override @Override

Loading…
Cancel
Save