From 82ab3fb3e3c49c2b0dab698584db9584cf9778ad Mon Sep 17 00:00:00 2001 From: Andy Wickham Date: Mon, 13 Feb 2023 13:32:09 -0800 Subject: [PATCH] Reset fast scroller when All Apps resets. This ensures the scrollbar is not left in a bad state, in particular if you close All Apps while still scrolling (e.g. pressing the Home button while holding the scroll bar). Fix: 267583704 Test: Manual Change-Id: I0e159f8e5ed289bf1628f77eab1879743b5aea00 --- .../allapps/ActivityAllAppsContainerView.java | 3 +++ .../views/RecyclerViewFastScroller.java | 23 +++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java index c3d24f995e..3253b3c0f4 100644 --- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java @@ -360,6 +360,9 @@ public class ActivityAllAppsContainerView mAH.get(i).mRecyclerView.scrollToTop(); } } + if (mTouchHandler != null) { + mTouchHandler.endFastScrolling(); + } if (mHeader != null && mHeader.getVisibility() == VISIBLE) { mHeader.reset(animate); } diff --git a/src/com/android/launcher3/views/RecyclerViewFastScroller.java b/src/com/android/launcher3/views/RecyclerViewFastScroller.java index 3af2e3c9dc..ead6886e5a 100644 --- a/src/com/android/launcher3/views/RecyclerViewFastScroller.java +++ b/src/com/android/launcher3/views/RecyclerViewFastScroller.java @@ -283,15 +283,7 @@ public class RecyclerViewFastScroller extends View { break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: - mRv.onFastScrollCompleted(); - mTouchOffsetY = 0; - mLastTouchY = 0; - mIgnoreDragGesture = false; - if (mIsDragging) { - mIsDragging = false; - animatePopupVisibility(false); - showActiveScrollbar(false); - } + endFastScrolling(); break; } if (DEBUG) { @@ -330,6 +322,19 @@ public class RecyclerViewFastScroller extends View { setThumbOffsetY((int) mLastTouchY); } + /** End any active fast scrolling touch handling, if applicable. */ + public void endFastScrolling() { + mRv.onFastScrollCompleted(); + mTouchOffsetY = 0; + mLastTouchY = 0; + mIgnoreDragGesture = false; + if (mIsDragging) { + mIsDragging = false; + animatePopupVisibility(false); + showActiveScrollbar(false); + } + } + public void onDraw(Canvas canvas) { if (mThumbOffsetY < 0) { return;