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

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

Merge "Show escape toast when swipe up or quick scrub while pinned"

parents 53298191 20136e69
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -75,7 +75,6 @@ public class NavigationBarGestureHelper implements TunerService.Tunable, Gesture
    private int mTouchDownY;
    private boolean mDownOnRecents;
    private VelocityTracker mVelocityTracker;
    private boolean mIsInScreenPinning;
    private boolean mNotificationsVisibleOnDown;

    private boolean mDockWindowEnabled;
@@ -110,7 +109,6 @@ public class NavigationBarGestureHelper implements TunerService.Tunable, Gesture

    public boolean onInterceptTouchEvent(MotionEvent event) {
        if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
            mIsInScreenPinning = mNavigationBarView.inScreenPinning();
            mNotificationsVisibleOnDown = !mStatusBar.isPresenterFullyCollapsed();
        }
        if (!canHandleGestures()) {
@@ -277,8 +275,7 @@ public class NavigationBarGestureHelper implements TunerService.Tunable, Gesture
    }

    private boolean canHandleGestures() {
        return !mIsInScreenPinning && !mStatusBar.isKeyguardShowing()
                && !mNotificationsVisibleOnDown;
        return !mStatusBar.isKeyguardShowing() && !mNotificationsVisibleOnDown;
    }

    private int calculateDragMode() {
+20 −0
Original line number Diff line number Diff line
@@ -161,6 +161,13 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav

    private int mRotateBtnStyle = R.style.RotateButtonCCWStart90;

    /**
     * Helper that is responsible for showing the right toast when a disallowed activity operation
     * occurred. In pinned mode, we show instructions on how to break out of this mode, whilst in
     * fully locked mode we only show that unlocking is blocked.
     */
    private ScreenPinningNotify mScreenPinningNotify;

    private class NavTransitionListener implements TransitionListener {
        private boolean mBackTransitioning;
        private boolean mHomeAppearing;
@@ -286,6 +293,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
        mConfiguration.updateFrom(context.getResources().getConfiguration());
        reloadNavIcons();

        mScreenPinningNotify = new ScreenPinningNotify(mContext);
        mBarTransitions = new NavigationBarTransitions(this);

        mButtonDispatchers.put(R.id.back, new ButtonDispatcher(R.id.back));
@@ -983,6 +991,18 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
        mBarTransitions.reapplyDarkIntensity();
    }

    public void showPinningEnterExitToast(boolean entering) {
        if (entering) {
            mScreenPinningNotify.showPinningStartToast();
        } else {
            mScreenPinningNotify.showPinningExitToast();
        }
    }

    public void showPinningEscapeToast() {
        mScreenPinningNotify.showEscapeToast(isRecentsButtonVisible());
    }

    public boolean isVertical() {
        return mVertical;
    }
+16 −2
Original line number Diff line number Diff line
@@ -84,6 +84,7 @@ public class QuickStepController implements GestureHelper {
    private AnimatorSet mTrackAnimator;
    private ButtonDispatcher mHitTarget;
    private View mCurrentNavigationBarView;
    private boolean mIsInScreenPinning;

    private final Handler mHandler = new Handler();
    private final Rect mTrackRect = new Rect();
@@ -195,6 +196,7 @@ public class QuickStepController implements GestureHelper {
            case MotionEvent.ACTION_DOWN: {
                int x = (int) event.getX();
                int y = (int) event.getY();
                mIsInScreenPinning = mNavigationBarView.inScreenPinning();

                // End any existing quickscrub animations before starting the new transition
                if (mTrackAnimator != null) {
@@ -298,8 +300,8 @@ public class QuickStepController implements GestureHelper {

        // Proxy motion events to launcher if not handled by quick scrub
        // Proxy motion events up/cancel that would be sent after long press on any nav button
        if (!mQuickScrubActive && (mAllowGestureDetection || action == MotionEvent.ACTION_CANCEL
                || action == MotionEvent.ACTION_UP)) {
        if (!mQuickScrubActive && !mIsInScreenPinning && (mAllowGestureDetection
                || action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_UP)) {
            proxyMotionEvents(event);
        }
        return mQuickScrubActive || mQuickStepStarted;
@@ -382,6 +384,12 @@ public class QuickStepController implements GestureHelper {
    }

    private void startQuickStep(MotionEvent event) {
        if (mIsInScreenPinning) {
            mNavigationBarView.showPinningEscapeToast();
            mAllowGestureDetection = false;
            return;
        }

        mQuickStepStarted = true;
        event.transform(mTransformGlobalMatrix);
        try {
@@ -407,6 +415,12 @@ public class QuickStepController implements GestureHelper {
    }

    private void startQuickScrub() {
        if (mIsInScreenPinning) {
            mNavigationBarView.showPinningEscapeToast();
            mAllowGestureDetection = false;
            return;
        }

        if (!mQuickScrubActive) {
            mQuickScrubActive = true;
            mLightTrackColor = mContext.getColor(R.color.quick_step_track_background_light);
+5 −14
Original line number Diff line number Diff line
@@ -423,13 +423,6 @@ public class StatusBar extends SystemUI implements DemoMode,
    protected KeyguardViewMediator mKeyguardViewMediator;
    private ZenModeController mZenController;

    /**
     * Helper that is responsible for showing the right toast when a disallowed activity operation
     * occurred. In pinned mode, we show instructions on how to break out of this mode, whilst in
     * fully locked mode we only show that unlocking is blocked.
     */
    private ScreenPinningNotify mScreenPinningNotify;

    // for disabling the status bar
    private int mDisabled1 = 0;
    private int mDisabled2 = 0;
@@ -902,7 +895,6 @@ public class StatusBar extends SystemUI implements DemoMode,
        } catch (RemoteException ex) {
            // no window manager? good luck with that
        }
        mScreenPinningNotify = new ScreenPinningNotify(mContext);
        mStackScroller.setLongPressListener(mEntryManager.getNotificationLongClicker());
        mStackScroller.setStatusBar(this);
        mStackScroller.setGroupManager(mGroupManager);
@@ -2241,17 +2233,16 @@ public class StatusBar extends SystemUI implements DemoMode,

    @Override
    public void showPinningEnterExitToast(boolean entering) {
        if (entering) {
            mScreenPinningNotify.showPinningStartToast();
        } else {
            mScreenPinningNotify.showPinningExitToast();
        if (getNavigationBarView() != null) {
            getNavigationBarView().showPinningEnterExitToast(entering);
        }
    }

    @Override
    public void showPinningEscapeToast() {
        mScreenPinningNotify.showEscapeToast(getNavigationBarView() == null
                || getNavigationBarView().isRecentsButtonVisible());
        if (getNavigationBarView() != null) {
            getNavigationBarView().showPinningEscapeToast();
        }
    }

    boolean panelsEnabled() {