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

Commit ac8d4232 authored by Aaron Heuckroth's avatar Aaron Heuckroth Committed by Android (Google) Code Review
Browse files

Merge "Fix regression where drag down could start during swipe."

parents 25827471 9dc9d4fb
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -88,8 +88,6 @@ public class SwipeHelper implements Gefingerpoken {
    private Runnable mWatchLongPress;
    private final long mLongPressTimeout;

    protected boolean mSwipingInProgress;

    final private int[] mTmpPos = new int[2];
    private final int mFalsingThreshold;
    private boolean mTouchAboveFalsingThreshold;
@@ -130,10 +128,6 @@ public class SwipeHelper implements Gefingerpoken {
        mDisableHwLayers = disableHwLayers;
    }

    public boolean isSwipingInProgress() {
        return mSwipingInProgress;
    }

    private float getPos(MotionEvent ev) {
        return mSwipeDirection == X ? ev.getX() : ev.getY();
    }
@@ -325,7 +319,6 @@ public class SwipeHelper implements Gefingerpoken {
                    if (Math.abs(delta) > mPagingTouchSlop
                            && Math.abs(delta) > Math.abs(deltaPerpendicular)) {
                        if (mCallback.canChildBeDragged(mCurrView)) {
                            mSwipingInProgress = true;
                            mCallback.onBeginDrag(mCurrView);
                            mDragging = true;
                            mInitialTouchPos = getPos(ev);
@@ -445,7 +438,6 @@ public class SwipeHelper implements Gefingerpoken {
                    wasRemoved = row.isRemoved();
                }
                if (!mCancelled || wasRemoved) {
                    mSwipingInProgress = false;
                    mCallback.onChildDismissed(animView);
                }
                if (endAction != null) {
@@ -637,7 +629,6 @@ public class SwipeHelper implements Gefingerpoken {
                                !swipedFastEnough() /* useAccelerateInterpolator */);
                    } else {
                        // snappity
                        mSwipingInProgress = false;
                        mCallback.onDragCancelled(mCurrView);
                        snapChild(mCurrView, 0 /* leftTarget */, velocity);
                    }
+16 −3
Original line number Diff line number Diff line
@@ -401,6 +401,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
     */
    private float mBackgroundXFactor = 1f;

    private boolean mSwipingInProgress;

    private boolean mUsingLightTheme;
    private boolean mQsExpanded;
    private boolean mForwardScrollable;
@@ -3286,7 +3288,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
                || ev.getActionMasked() == MotionEvent.ACTION_UP;
        handleEmptySpaceClick(ev);
        boolean expandWantsIt = false;
        boolean swipingInProgress = mSwipeHelper.isSwipingInProgress();
        boolean swipingInProgress = mSwipingInProgress;
        if (mIsExpanded && !swipingInProgress && !mOnlyScrollingInThisMotion) {
            if (isCancelOrUp) {
                mExpandHelper.onlyObserveMovements(false);
@@ -3341,7 +3343,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
    @Override
    @ShadeViewRefactor(RefactorComponent.INPUT)
    public boolean onGenericMotionEvent(MotionEvent event) {
        if (!isScrollingEnabled() || !mIsExpanded || mSwipeHelper.isSwipingInProgress() || mExpandingNotification
        if (!isScrollingEnabled() || !mIsExpanded || mSwipingInProgress || mExpandingNotification
                || mDisallowScrollingInThisMotion) {
            return false;
        }
@@ -3568,7 +3570,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
        initDownStates(ev);
        handleEmptySpaceClick(ev);
        boolean expandWantsIt = false;
        boolean swipingInProgress = mSwipeHelper.isSwipingInProgress();
        boolean swipingInProgress = mSwipingInProgress;
        if (!swipingInProgress && !mOnlyScrollingInThisMotion) {
            expandWantsIt = mExpandHelper.onInterceptTouchEvent(ev);
        }
@@ -3847,6 +3849,14 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
        }
    }

    @ShadeViewRefactor(RefactorComponent.INPUT)
    private void setSwipingInProgress(boolean swiping) {
        mSwipingInProgress = swiping;
        if (swiping) {
            requestDisallowInterceptTouchEvent(true);
        }
    }

    @Override
    @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
    public void onWindowFocusChanged(boolean hasWindowFocus) {
@@ -5642,6 +5652,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd

        @Override
        public void onDragCancelled(View v) {
            setSwipingInProgress(false);
            mFalsingManager.onNotificatonStopDismissing();
        }

@@ -5669,6 +5680,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
         */

        public void handleChildViewDismissed(View view) {
            setSwipingInProgress(false);
            if (mDismissAllInProgress) {
                return;
            }
@@ -5737,6 +5749,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
        @Override
        public void onBeginDrag(View v) {
            mFalsingManager.onNotificatonStartDismissing();
            setSwipingInProgress(true);
            mAmbientState.onBeginDrag(v);
            updateContinuousShadowDrawing();
            if (mAnimationsEnabled && (mIsExpanded || !isPinnedHeadsUp(v))) {
+0 −3
Original line number Diff line number Diff line
@@ -227,7 +227,6 @@ class NotificationSwipeHelper extends SwipeHelper
        if (mCallback.isExpanded()) {
            // We don't want to quick-dismiss when it's a heads up as this might lead to closing
            // of the panel early.
            mSwipingInProgress = false;
            mCallback.handleChildViewDismissed(view);
        }
        mCallback.onDismiss();
@@ -247,7 +246,6 @@ class NotificationSwipeHelper extends SwipeHelper
    @Override
    public void snapChild(final View animView, final float targetLeft, float velocity) {
        superSnapChild(animView, targetLeft, velocity);
        mSwipingInProgress = false;
        mCallback.onDragCancelled(animView);
        if (targetLeft == 0) {
            handleMenuCoveredOrDismissed();
@@ -354,7 +352,6 @@ class NotificationSwipeHelper extends SwipeHelper

    public void onMenuShown(View animView) {
        setExposedMenuView(getTranslatingParentView());
        mSwipingInProgress = false;
        mCallback.onDragCancelled(animView);
        Handler handler = getHandler();