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

Commit 8b08a1fd authored by Jon Miranda's avatar Jon Miranda
Browse files

Cancel existing launcher animation earlier to prevent unnecessary AllApps animation.

Prior to this change:
* User presses home before opening app transition finishes
* Close app transition starts
* AllAppsTransitionController#mProgress = 1.3 (starts offscreen)
* Launcher#onNewIntent makes call to AllAppsTransitionController#setStateWithAnimation
* targetProgress != mProgress (1 != 1.3),  so it runs an animator that looks odd
  ie. fast duration, only AllApps animates compared to expected full closing app transition

Change-Id: I755787aebf637675cb9aae23fc5784f5a5b6c811
parent 5f72d3b8
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -175,6 +175,7 @@ public class LauncherStateManager {
        mConfig.reset();

        if (!animated) {
            preOnStateTransitionStart();
            onStateTransitionStart(state);
            for (StateHandler handler : getStateHandlers()) {
                handler.setState(state);
@@ -231,6 +232,8 @@ public class LauncherStateManager {

    protected AnimatorSet createAnimationToNewWorkspaceInternal(final LauncherState state,
            AnimatorSetBuilder builder, final Runnable onCompleteRunnable) {
        preOnStateTransitionStart();

        for (StateHandler handler : getStateHandlers()) {
            builder.startTag(handler);
            handler.setStateWithAnimation(state, builder, mConfig);
@@ -269,6 +272,15 @@ public class LauncherStateManager {
        return mConfig.mCurrentAnimation;
    }

    private void preOnStateTransitionStart() {
        // If we are still animating to launcher from an app,
        // finish it and let this state animation take over.
        LauncherAppTransitionManager transitionManager = mLauncher.getAppTransitionManager();
        if (transitionManager != null) {
            transitionManager.finishLauncherAnimation();
        }
    }

    private void onStateTransitionStart(LauncherState state) {
        mState.onStateDisabled(mLauncher);
        mState = state;
@@ -279,13 +291,6 @@ public class LauncherStateManager {
            // Only disable clipping if needed, otherwise leave it as previous value.
            mLauncher.getWorkspace().setClipChildren(false);
        }

        // If we are still animating to launcher from an app,
        // finish it and let this state animation take over.
        LauncherAppTransitionManager transitionManager = mLauncher.getAppTransitionManager();
        if (transitionManager != null) {
            transitionManager.finishLauncherAnimation();
        }
    }

    private void onStateTransitionEnd(LauncherState state) {