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

Commit 3007a91b authored by Tracy Zhou's avatar Tracy Zhou Committed by Android (Google) Code Review
Browse files

Merge "Delay showing task bar until the user releases their finger dragging...

Merge "Delay showing task bar until the user releases their finger dragging from all apps to normal"
parents c4f2560b bec00acf
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -113,6 +113,11 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
        return !mTaskbarLauncherStateController.isAnimatingToLauncher();
    }

    public void setShouldDelayLauncherStateAnim(boolean shouldDelayLauncherStateAnim) {
        mTaskbarLauncherStateController.setShouldDelayLauncherStateAnim(
                shouldDelayLauncherStateAnim);
    }

    /**
     * Should be called from onResume() and onPause(), and animates the Taskbar accordingly.
     */
+14 −1
Original line number Diff line number Diff line
@@ -74,6 +74,8 @@ import java.util.function.Supplier;
    private boolean mIsAnimatingToLauncherViaGesture;
    private boolean mIsAnimatingToLauncherViaResume;

    private boolean mShouldDelayLauncherStateAnim;

    private final StateManager.StateListener<LauncherState> mStateListener =
            new StateManager.StateListener<LauncherState>() {

@@ -86,8 +88,10 @@ import java.util.function.Supplier;
                        mLauncherState = toState;
                    }
                    updateStateForFlag(FLAG_TRANSITION_STATE_RUNNING, true);
                    if (!mShouldDelayLauncherStateAnim) {
                        applyState();
                    }
                }

                @Override
                public void onStateTransitionComplete(LauncherState finalState) {
@@ -159,6 +163,15 @@ import java.util.function.Supplier;
        return mIsAnimatingToLauncherViaResume || mIsAnimatingToLauncherViaGesture;
    }

    public void setShouldDelayLauncherStateAnim(boolean shouldDelayLauncherStateAnim) {
        if (!shouldDelayLauncherStateAnim && mShouldDelayLauncherStateAnim) {
            // Animate the animation we have delayed immediately. This is usually triggered when
            // the user has released their finger.
            applyState();
        }
        mShouldDelayLauncherStateAnim = shouldDelayLauncherStateAnim;
    }

    /**
     * Updates the proper flag to change the state of the task bar.
     *
+17 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.launcher3.uioverrides.touchcontrollers;

import static com.android.launcher3.LauncherAnimUtils.VIEW_BACKGROUND_COLOR;
import static com.android.launcher3.LauncherAnimUtils.newCancelListener;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.HINT_STATE;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
@@ -33,11 +34,13 @@ import android.graphics.PointF;
import android.view.MotionEvent;
import android.view.ViewConfiguration;

import com.android.launcher3.BaseQuickstepLauncher;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.taskbar.LauncherTaskbarUIController;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.util.AnimatorControllerWithResistance;
import com.android.quickstep.util.MotionPauseDetector;
@@ -109,6 +112,14 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch

    @Override
    public void onDragStart(boolean start, float startDisplacement) {
        if (mLauncher.isInState(ALL_APPS)) {
            LauncherTaskbarUIController controller =
                    ((BaseQuickstepLauncher) mLauncher).getTaskbarUIController();
            if (controller != null) {
                controller.setShouldDelayLauncherStateAnim(true);
            }
        }

        super.onDragStart(start, startDisplacement);

        mMotionPauseDetector.clear();
@@ -139,6 +150,12 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch

    @Override
    public void onDragEnd(float velocity) {
        LauncherTaskbarUIController controller =
                ((BaseQuickstepLauncher) mLauncher).getTaskbarUIController();
        if (controller != null) {
            controller.setShouldDelayLauncherStateAnim(false);
        }

        if (mStartedOverview) {
            goToOverviewOrHomeOnDragEnd(velocity);
        } else {