Loading src/com/android/launcher3/views/RecyclerViewFastScroller.java +19 −2 Original line number Diff line number Diff line Loading @@ -109,6 +109,13 @@ public class RecyclerViewFastScroller extends View { private float mLastTouchY; private boolean mIsDragging; /** * Tracks whether a keyboard hide request has been sent due to downward scrolling. * <p> * Set to true when scrolling down and reset when scrolling up to prevents redundant hide * requests during continuous downward scrolls. */ private boolean mRequestedHideKeyboard; private boolean mIsThumbDetached; private final boolean mCanThumbDetach; private boolean mIgnoreDragGesture; Loading @@ -127,6 +134,7 @@ public class RecyclerViewFastScroller extends View { protected FastScrollRecyclerView mRv; private RecyclerView.OnScrollListener mOnScrollListener; private final ActivityContext mActivityContext; private int mDownX; private int mDownY; Loading Loading @@ -163,7 +171,7 @@ public class RecyclerViewFastScroller extends View { mDeltaThreshold = res.getDisplayMetrics().density * SCROLL_DELTA_THRESHOLD_DP; mScrollbarLeftOffsetTouchDelegate = res.getDisplayMetrics().density * SCROLLBAR_LEFT_OFFSET_TOUCH_DELEGATE_DP; mActivityContext = ActivityContext.lookupContext(context); TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.RecyclerViewFastScroller, defStyleAttr, 0); mCanThumbDetach = ta.getBoolean(R.styleable.RecyclerViewFastScroller_canThumbDetach, false); Loading Loading @@ -248,6 +256,7 @@ public class RecyclerViewFastScroller extends View { mDownX = x; mDownY = mLastY = y; mDownTimeStampMillis = ev.getDownTime(); mRequestedHideKeyboard = false; if ((Math.abs(mDy) < mDeltaThreshold && mRv.getScrollState() != SCROLL_STATE_IDLE)) { Loading @@ -260,6 +269,7 @@ public class RecyclerViewFastScroller extends View { } break; case MotionEvent.ACTION_MOVE: boolean isScrollingDown = y > mLastY; mLastY = y; int absDeltaY = Math.abs(y - mDownY); int absDeltaX = Math.abs(x - mDownX); Loading @@ -275,6 +285,14 @@ public class RecyclerViewFastScroller extends View { } } if (mIsDragging) { if (isScrollingDown) { if (!mRequestedHideKeyboard) { mActivityContext.hideKeyboard(); } mRequestedHideKeyboard = true; } else { mRequestedHideKeyboard = false; } updateFastScrollSectionNameAndThumbOffset(y); } break; Loading @@ -294,7 +312,6 @@ public class RecyclerViewFastScroller extends View { } private void calcTouchOffsetAndPrepToFastScroll(int downY, int lastY) { ActivityContext.lookupContext(getContext()).hideKeyboard(); mIsDragging = true; if (mCanThumbDetach) { mIsThumbDetached = true; Loading Loading
src/com/android/launcher3/views/RecyclerViewFastScroller.java +19 −2 Original line number Diff line number Diff line Loading @@ -109,6 +109,13 @@ public class RecyclerViewFastScroller extends View { private float mLastTouchY; private boolean mIsDragging; /** * Tracks whether a keyboard hide request has been sent due to downward scrolling. * <p> * Set to true when scrolling down and reset when scrolling up to prevents redundant hide * requests during continuous downward scrolls. */ private boolean mRequestedHideKeyboard; private boolean mIsThumbDetached; private final boolean mCanThumbDetach; private boolean mIgnoreDragGesture; Loading @@ -127,6 +134,7 @@ public class RecyclerViewFastScroller extends View { protected FastScrollRecyclerView mRv; private RecyclerView.OnScrollListener mOnScrollListener; private final ActivityContext mActivityContext; private int mDownX; private int mDownY; Loading Loading @@ -163,7 +171,7 @@ public class RecyclerViewFastScroller extends View { mDeltaThreshold = res.getDisplayMetrics().density * SCROLL_DELTA_THRESHOLD_DP; mScrollbarLeftOffsetTouchDelegate = res.getDisplayMetrics().density * SCROLLBAR_LEFT_OFFSET_TOUCH_DELEGATE_DP; mActivityContext = ActivityContext.lookupContext(context); TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.RecyclerViewFastScroller, defStyleAttr, 0); mCanThumbDetach = ta.getBoolean(R.styleable.RecyclerViewFastScroller_canThumbDetach, false); Loading Loading @@ -248,6 +256,7 @@ public class RecyclerViewFastScroller extends View { mDownX = x; mDownY = mLastY = y; mDownTimeStampMillis = ev.getDownTime(); mRequestedHideKeyboard = false; if ((Math.abs(mDy) < mDeltaThreshold && mRv.getScrollState() != SCROLL_STATE_IDLE)) { Loading @@ -260,6 +269,7 @@ public class RecyclerViewFastScroller extends View { } break; case MotionEvent.ACTION_MOVE: boolean isScrollingDown = y > mLastY; mLastY = y; int absDeltaY = Math.abs(y - mDownY); int absDeltaX = Math.abs(x - mDownX); Loading @@ -275,6 +285,14 @@ public class RecyclerViewFastScroller extends View { } } if (mIsDragging) { if (isScrollingDown) { if (!mRequestedHideKeyboard) { mActivityContext.hideKeyboard(); } mRequestedHideKeyboard = true; } else { mRequestedHideKeyboard = false; } updateFastScrollSectionNameAndThumbOffset(y); } break; Loading @@ -294,7 +312,6 @@ public class RecyclerViewFastScroller extends View { } private void calcTouchOffsetAndPrepToFastScroll(int downY, int lastY) { ActivityContext.lookupContext(getContext()).hideKeyboard(); mIsDragging = true; if (mCanThumbDetach) { mIsThumbDetached = true; Loading