From 10a9c80e13e9f8bcd6bc5d631187799f91ef2481 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 22 Jul 2021 21:30:13 +0200 Subject: [PATCH] Use separator handler for fast scroll delay --- .../java/androidx/recyclerview/widget/FastScrollerEx.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/androidx/recyclerview/widget/FastScrollerEx.java b/app/src/main/java/androidx/recyclerview/widget/FastScrollerEx.java index 0f1fd85a1c..c4efb3e2fb 100644 --- a/app/src/main/java/androidx/recyclerview/widget/FastScrollerEx.java +++ b/app/src/main/java/androidx/recyclerview/widget/FastScrollerEx.java @@ -465,14 +465,17 @@ public class FastScrollerEx extends RecyclerView.ItemDecoration implements Recyc float percentage = (scrollbarLength == 0 ? 0 : y / (float) scrollbarLength); int pos = Math.round(count * percentage); scrollTo = pos; - mRecyclerView.removeCallbacks(scroll); - mRecyclerView.postDelayed(scroll, 100); + if (handler == null) + handler = new android.os.Handler(android.os.Looper.getMainLooper()); + handler.removeCallbacks(scroll); + handler.postDelayed(scroll, 100); } mVerticalDragY = y; } private int scrollTo; + private android.os.Handler handler; private final Runnable scroll = new Runnable() { @Override