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

Commit 47ffde25 authored by John Spurlock's avatar John Spurlock Committed by Android (Google) Code Review
Browse files

Merge "Delay settings panel visibility until touch slop exceeded."

parents 250bb6e3 4e9d7c17
Loading
Loading
Loading
Loading
+17 −10
Original line number Original line Diff line number Diff line
@@ -375,6 +375,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
    private InterceptedNotifications mIntercepted;
    private InterceptedNotifications mIntercepted;
    private VelocityTracker mSettingsTracker;
    private VelocityTracker mSettingsTracker;
    private float mSettingsDownY;
    private float mSettingsDownY;
    private boolean mSettingsStarted;
    private boolean mSettingsCancelled;
    private boolean mSettingsCancelled;
    private boolean mSettingsClosing;
    private boolean mSettingsClosing;
    private int mNotificationPadding;
    private int mNotificationPadding;
@@ -766,16 +767,16 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
        if (mSettingsTracker != null) {
        if (mSettingsTracker != null) {
            mSettingsTracker.addMovement(event);
            mSettingsTracker.addMovement(event);
        }
        }

        final int slop = ViewConfiguration.get(mContext).getScaledTouchSlop();
        if (event.getAction() == MotionEvent.ACTION_DOWN) {
        if (event.getAction() == MotionEvent.ACTION_DOWN) {
            mSettingsTracker = VelocityTracker.obtain();
            mSettingsTracker = VelocityTracker.obtain();
            mSettingsDownY = event.getY();
            mSettingsDownY = event.getY();
            mSettingsCancelled = false;
            mSettingsCancelled = false;
            mSettingsStarted = false;
            mSettingsClosing = mFlipSettingsView.getVisibility() == View.VISIBLE;
            mSettingsClosing = mFlipSettingsView.getVisibility() == View.VISIBLE;
            mFlipSettingsView.setVisibility(View.VISIBLE);
            if (mSettingsClosing) {
                mStackScroller.setVisibility(View.VISIBLE);
                mStackScroller.setVisibility(View.VISIBLE);
            positionSettings(0);
            } else {
            if (!mSettingsClosing) {
                mFlipSettingsView.setTranslationY(-mNotificationPanel.getMeasuredHeight());
                mFlipSettingsView.setTranslationY(-mNotificationPanel.getMeasuredHeight());
            }
            }
            dispatchSettingsEvent(event);
            dispatchSettingsEvent(event);
@@ -784,7 +785,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
            final float dy = event.getY() - mSettingsDownY;
            final float dy = event.getY() - mSettingsDownY;
            final FlipperButton flipper = mOnKeyguard ? mKeyguardFlipper : mHeaderFlipper;
            final FlipperButton flipper = mOnKeyguard ? mKeyguardFlipper : mHeaderFlipper;
            final boolean inButton = flipper.inHolderBounds(event);
            final boolean inButton = flipper.inHolderBounds(event);
            final int slop = ViewConfiguration.get(mContext).getScaledTouchSlop();
            final boolean qsTap = mSettingsClosing && Math.abs(dy) < slop;
            final boolean qsTap = mSettingsClosing && Math.abs(dy) < slop;
            if (!qsTap && !inButton) {
            if (!qsTap && !inButton) {
                mSettingsTracker.computeCurrentVelocity(1000);
                mSettingsTracker.computeCurrentVelocity(1000);
@@ -801,10 +801,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
            dispatchSettingsEvent(event);
            dispatchSettingsEvent(event);
        } else if (mSettingsTracker != null && event.getAction() == MotionEvent.ACTION_MOVE) {
        } else if (mSettingsTracker != null && event.getAction() == MotionEvent.ACTION_MOVE) {
            final float dy = event.getY() - mSettingsDownY;
            final float dy = event.getY() - mSettingsDownY;
            positionSettings(dy);
            if (mSettingsClosing) {
            if (mSettingsClosing) {
                final boolean qsTap =
                positionSettings(dy);
                        Math.abs(dy) < ViewConfiguration.get(mContext).getScaledTouchSlop();
                final boolean qsTap = Math.abs(dy) < slop;
                if (!mSettingsCancelled && !qsTap) {
                if (!mSettingsCancelled && !qsTap) {
                    MotionEvent cancelEvent = MotionEvent.obtainNoHistory(event);
                    MotionEvent cancelEvent = MotionEvent.obtainNoHistory(event);
                    cancelEvent.setAction(MotionEvent.ACTION_CANCEL);
                    cancelEvent.setAction(MotionEvent.ACTION_CANCEL);
@@ -812,6 +811,14 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
                    mSettingsCancelled = true;
                    mSettingsCancelled = true;
                }
                }
            } else {
            } else {
                if (!mSettingsStarted && dy > slop) {
                    mSettingsStarted = true;
                    mFlipSettingsView.setVisibility(View.VISIBLE);
                    mStackScroller.setVisibility(View.VISIBLE);
                }
                if (mSettingsStarted) {
                    positionSettings(dy);
                }
                dispatchSettingsEvent(event);
                dispatchSettingsEvent(event);
            }
            }
        }
        }