Loading src/com/android/launcher3/allapps/AllAppsRecyclerView.java +2 −2 Original line number Diff line number Diff line Loading @@ -190,8 +190,6 @@ public class AllAppsRecyclerView extends BaseRecyclerView { case SCROLL_STATE_DRAGGING: mgr.logger().sendToInteractionJankMonitor( LAUNCHER_ALLAPPS_VERTICAL_SWIPE_BEGIN, this); hideKeyboardAsync(ActivityContext.lookupContext(getContext()), getApplicationWindowToken()); break; case SCROLL_STATE_IDLE: mgr.logger().sendToInteractionJankMonitor( Loading @@ -207,6 +205,8 @@ public class AllAppsRecyclerView extends BaseRecyclerView { && mEmptySearchBackground != null && mEmptySearchBackground.getAlpha() > 0) { mEmptySearchBackground.setHotspot(e.getX(), e.getY()); } hideKeyboardAsync(ActivityContext.lookupContext(getContext()), getApplicationWindowToken()); return result; } Loading src/com/android/launcher3/views/RecyclerViewFastScroller.java +30 −9 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Insets; import android.graphics.Paint; import android.graphics.Point; import android.graphics.Rect; Loading @@ -32,6 +33,7 @@ import android.util.Property; import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; import android.view.WindowInsets; import android.widget.TextView; import androidx.annotation.Nullable; Loading @@ -51,6 +53,7 @@ import java.util.List; */ public class RecyclerViewFastScroller extends View { private static final int FASTSCROLL_THRESHOLD_MILLIS = 200; private static final int SCROLL_DELTA_THRESHOLD_DP = 4; private static final Rect sTempRect = new Rect(); Loading Loading @@ -101,6 +104,7 @@ public class RecyclerViewFastScroller extends View { private final boolean mCanThumbDetach; private boolean mIgnoreDragGesture; private boolean mIsRecyclerViewFirstChildInParent = true; private long mDownTimeStampMillis; // This is the offset from the top of the scrollbar when the user first starts touching. To // prevent jumping, this offset is applied as the user scrolls. Loading @@ -112,6 +116,7 @@ public class RecyclerViewFastScroller extends View { private TextView mPopupView; private boolean mPopupVisible; private String mPopupSectionName; private Insets mSystemGestureInsets; protected BaseRecyclerView mRv; private RecyclerView.OnScrollListener mOnScrollListener; Loading Loading @@ -237,6 +242,7 @@ public class RecyclerViewFastScroller extends View { // Keep track of the down positions mDownX = x; mDownY = mLastY = y; mDownTimeStampMillis = ev.getDownTime(); if ((Math.abs(mDy) < mDeltaThreshold && mRv.getScrollState() != RecyclerView.SCROLL_STATE_IDLE)) { Loading @@ -246,23 +252,28 @@ public class RecyclerViewFastScroller extends View { } if (isNearThumb(x, y)) { mTouchOffsetY = mDownY - mThumbOffsetY; } else if (mRv.supportsFastScrolling() && isNearScrollBar(mDownX)) { calcTouchOffsetAndPrepToFastScroll(mDownY, mLastY); updateFastScrollSectionNameAndThumbOffset(y); } break; case MotionEvent.ACTION_MOVE: mLastY = y; int absDeltaY = Math.abs(y - mDownY); int absDeltaX = Math.abs(x - mDownX); // Check if we should start scrolling, but ignore this fastscroll gesture if we have // exceeded some fixed movement mIgnoreDragGesture |= Math.abs(y - mDownY) > mConfig.getScaledPagingTouchSlop(); if (!mIsDragging && !mIgnoreDragGesture && mRv.supportsFastScrolling() && isNearThumb(mDownX, mLastY) && Math.abs(y - mDownY) > mConfig.getScaledTouchSlop()) { mIgnoreDragGesture |= absDeltaY > mConfig.getScaledPagingTouchSlop(); if (!mIsDragging && !mIgnoreDragGesture && mRv.supportsFastScrolling()) { // condition #1: triggering thumb is distance, angle based if ((isNearThumb(mDownX, mLastY) && absDeltaY > mConfig.getScaledPagingTouchSlop() && absDeltaY > absDeltaX) // condition#2: Fastscroll function is now time based || (isNearScrollBar(mDownX) && ev.getEventTime() - mDownTimeStampMillis > FASTSCROLL_THRESHOLD_MILLIS)) { calcTouchOffsetAndPrepToFastScroll(mDownY, mLastY); } } if (mIsDragging) { updateFastScrollSectionNameAndThumbOffset(y); } Loading Loading @@ -328,12 +339,22 @@ public class RecyclerViewFastScroller extends View { canvas.drawRoundRect(mThumbBounds, r, r, mThumbPaint); if (Utilities.ATLEAST_Q) { mThumbBounds.roundOut(SYSTEM_GESTURE_EXCLUSION_RECT.get(0)); // swiping very close to the thumb area (not just within it's bound) // will also prevent back gesture SYSTEM_GESTURE_EXCLUSION_RECT.get(0).offset(mThumbDrawOffset.x, mThumbDrawOffset.y); SYSTEM_GESTURE_EXCLUSION_RECT.get(0).left = SYSTEM_GESTURE_EXCLUSION_RECT.get(0).right - mSystemGestureInsets.right; setSystemGestureExclusionRects(SYSTEM_GESTURE_EXCLUSION_RECT); } canvas.restoreToCount(saveCount); } @Override public WindowInsets onApplyWindowInsets(WindowInsets insets) { mSystemGestureInsets = insets.getSystemGestureInsets(); return super.onApplyWindowInsets(insets); } private float getScrollThumbRadius() { return mWidth + mThumbPadding + mThumbPadding; } Loading Loading
src/com/android/launcher3/allapps/AllAppsRecyclerView.java +2 −2 Original line number Diff line number Diff line Loading @@ -190,8 +190,6 @@ public class AllAppsRecyclerView extends BaseRecyclerView { case SCROLL_STATE_DRAGGING: mgr.logger().sendToInteractionJankMonitor( LAUNCHER_ALLAPPS_VERTICAL_SWIPE_BEGIN, this); hideKeyboardAsync(ActivityContext.lookupContext(getContext()), getApplicationWindowToken()); break; case SCROLL_STATE_IDLE: mgr.logger().sendToInteractionJankMonitor( Loading @@ -207,6 +205,8 @@ public class AllAppsRecyclerView extends BaseRecyclerView { && mEmptySearchBackground != null && mEmptySearchBackground.getAlpha() > 0) { mEmptySearchBackground.setHotspot(e.getX(), e.getY()); } hideKeyboardAsync(ActivityContext.lookupContext(getContext()), getApplicationWindowToken()); return result; } Loading
src/com/android/launcher3/views/RecyclerViewFastScroller.java +30 −9 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Insets; import android.graphics.Paint; import android.graphics.Point; import android.graphics.Rect; Loading @@ -32,6 +33,7 @@ import android.util.Property; import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; import android.view.WindowInsets; import android.widget.TextView; import androidx.annotation.Nullable; Loading @@ -51,6 +53,7 @@ import java.util.List; */ public class RecyclerViewFastScroller extends View { private static final int FASTSCROLL_THRESHOLD_MILLIS = 200; private static final int SCROLL_DELTA_THRESHOLD_DP = 4; private static final Rect sTempRect = new Rect(); Loading Loading @@ -101,6 +104,7 @@ public class RecyclerViewFastScroller extends View { private final boolean mCanThumbDetach; private boolean mIgnoreDragGesture; private boolean mIsRecyclerViewFirstChildInParent = true; private long mDownTimeStampMillis; // This is the offset from the top of the scrollbar when the user first starts touching. To // prevent jumping, this offset is applied as the user scrolls. Loading @@ -112,6 +116,7 @@ public class RecyclerViewFastScroller extends View { private TextView mPopupView; private boolean mPopupVisible; private String mPopupSectionName; private Insets mSystemGestureInsets; protected BaseRecyclerView mRv; private RecyclerView.OnScrollListener mOnScrollListener; Loading Loading @@ -237,6 +242,7 @@ public class RecyclerViewFastScroller extends View { // Keep track of the down positions mDownX = x; mDownY = mLastY = y; mDownTimeStampMillis = ev.getDownTime(); if ((Math.abs(mDy) < mDeltaThreshold && mRv.getScrollState() != RecyclerView.SCROLL_STATE_IDLE)) { Loading @@ -246,23 +252,28 @@ public class RecyclerViewFastScroller extends View { } if (isNearThumb(x, y)) { mTouchOffsetY = mDownY - mThumbOffsetY; } else if (mRv.supportsFastScrolling() && isNearScrollBar(mDownX)) { calcTouchOffsetAndPrepToFastScroll(mDownY, mLastY); updateFastScrollSectionNameAndThumbOffset(y); } break; case MotionEvent.ACTION_MOVE: mLastY = y; int absDeltaY = Math.abs(y - mDownY); int absDeltaX = Math.abs(x - mDownX); // Check if we should start scrolling, but ignore this fastscroll gesture if we have // exceeded some fixed movement mIgnoreDragGesture |= Math.abs(y - mDownY) > mConfig.getScaledPagingTouchSlop(); if (!mIsDragging && !mIgnoreDragGesture && mRv.supportsFastScrolling() && isNearThumb(mDownX, mLastY) && Math.abs(y - mDownY) > mConfig.getScaledTouchSlop()) { mIgnoreDragGesture |= absDeltaY > mConfig.getScaledPagingTouchSlop(); if (!mIsDragging && !mIgnoreDragGesture && mRv.supportsFastScrolling()) { // condition #1: triggering thumb is distance, angle based if ((isNearThumb(mDownX, mLastY) && absDeltaY > mConfig.getScaledPagingTouchSlop() && absDeltaY > absDeltaX) // condition#2: Fastscroll function is now time based || (isNearScrollBar(mDownX) && ev.getEventTime() - mDownTimeStampMillis > FASTSCROLL_THRESHOLD_MILLIS)) { calcTouchOffsetAndPrepToFastScroll(mDownY, mLastY); } } if (mIsDragging) { updateFastScrollSectionNameAndThumbOffset(y); } Loading Loading @@ -328,12 +339,22 @@ public class RecyclerViewFastScroller extends View { canvas.drawRoundRect(mThumbBounds, r, r, mThumbPaint); if (Utilities.ATLEAST_Q) { mThumbBounds.roundOut(SYSTEM_GESTURE_EXCLUSION_RECT.get(0)); // swiping very close to the thumb area (not just within it's bound) // will also prevent back gesture SYSTEM_GESTURE_EXCLUSION_RECT.get(0).offset(mThumbDrawOffset.x, mThumbDrawOffset.y); SYSTEM_GESTURE_EXCLUSION_RECT.get(0).left = SYSTEM_GESTURE_EXCLUSION_RECT.get(0).right - mSystemGestureInsets.right; setSystemGestureExclusionRects(SYSTEM_GESTURE_EXCLUSION_RECT); } canvas.restoreToCount(saveCount); } @Override public WindowInsets onApplyWindowInsets(WindowInsets insets) { mSystemGestureInsets = insets.getSystemGestureInsets(); return super.onApplyWindowInsets(insets); } private float getScrollThumbRadius() { return mWidth + mThumbPadding + mThumbPadding; } Loading