Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cb77b79f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Prevent quickscrub when swipe up has already started"

parents 1ef5b6fa db2734ca
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -88,7 +88,7 @@ public class NavigationBarGestureHelper implements TunerService.Tunable, Gesture
        @Override
        public void onRecentsAnimationStarted() {
            mRecentsAnimationStarted = true;
            mQuickScrubController.cancelQuickSwitch();
            mQuickScrubController.setRecentsAnimationStarted(true /* started */);
        }
    };

@@ -163,6 +163,7 @@ public class NavigationBarGestureHelper implements TunerService.Tunable, Gesture
                mNavigationBarView.transformMatrixToGlobal(mTransformGlobalMatrix);
                mNavigationBarView.transformMatrixToLocal(mTransformLocalMatrix);
                mRecentsAnimationStarted = false;
                mQuickScrubController.setRecentsAnimationStarted(false /* started */);
                break;
            }
        }
+9 −1
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ public class QuickScrubController extends GestureDetector.SimpleOnGestureListene
    private boolean mDraggingActive;
    private boolean mQuickScrubActive;
    private boolean mAllowQuickSwitch;
    private boolean mRecentsAnimationStarted;
    private float mDownOffset;
    private float mTranslation;
    private int mTouchDownX;
@@ -279,7 +280,7 @@ public class QuickScrubController extends GestureDetector.SimpleOnGestureListene
                    }

                    // Control the button movement
                    if (!mDraggingActive && exceededTouchSlop) {
                    if (!mDraggingActive && exceededTouchSlop && !mRecentsAnimationStarted) {
                        boolean allowDrag = !mDragPositive
                                ? offset < 0 && pos < touchDown : offset >= 0 && pos > touchDown;
                        if (allowDrag) {
@@ -417,6 +418,13 @@ public class QuickScrubController extends GestureDetector.SimpleOnGestureListene
        mDraggingActive = false;
    }

    public void setRecentsAnimationStarted(boolean started) {
        mRecentsAnimationStarted = started;
        if (started) {
            cancelQuickSwitch();
        }
    }

    public void cancelQuickSwitch() {
        mAllowQuickSwitch = false;
        mHandler.removeCallbacks(mLongPressRunnable);