diff options
author | Tony <twickham@google.com> | 2018-05-29 17:33:16 -0700 |
---|---|---|
committer | Tony <twickham@google.com> | 2018-05-29 17:33:16 -0700 |
commit | 67f9cad75a5fd3088b7e5c1e987ba501a99b6d0a (patch) | |
tree | bab8d0c30a18c06fe4dacd749a4ad5f685db9651 | |
parent | ab66067defad22a632c390df8d0afaecc04bbe19 (diff) | |
download | android_packages_apps_Trebuchet-67f9cad75a5fd3088b7e5c1e987ba501a99b6d0a.tar.gz android_packages_apps_Trebuchet-67f9cad75a5fd3088b7e5c1e987ba501a99b6d0a.tar.bz2 android_packages_apps_Trebuchet-67f9cad75a5fd3088b7e5c1e987ba501a99b6d0a.zip |
Fix animation not playing when going home while another animation is playing
When going to a new state, we cancel any currently playing animation. When
canceling the animation, we reset mState = mCurrentStableState. Thus, when
determining the duration of the new animation, we have both state == NORMAL
and mState == NORMAL, leading to a duration of 0 and therefore no animation.
Storing the fromState before canceling/resetting fixes the issue.
Change-Id: I92332deae8058c4dd41212fe7f749955ede28b1c
-rw-r--r-- | src/com/android/launcher3/LauncherStateManager.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java index 02fa916b1..05c515bf4 100644 --- a/src/com/android/launcher3/LauncherStateManager.java +++ b/src/com/android/launcher3/LauncherStateManager.java @@ -17,7 +17,6 @@ package com.android.launcher3; import static android.view.View.VISIBLE; - import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_FADE; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_SCALE; @@ -222,7 +221,8 @@ public class LauncherStateManager { } } - // Cancel the current animation + // Cancel the current animation. This will reset mState to mCurrentStableState, so store it. + LauncherState fromState = mState; mConfig.reset(); if (!animated) { @@ -245,10 +245,10 @@ public class LauncherStateManager { // Since state NORMAL can be reached from multiple states, just assume that the // transition plays in reverse and use the same duration as previous state. - mConfig.duration = state == NORMAL ? mState.transitionDuration : state.transitionDuration; + mConfig.duration = state == NORMAL ? fromState.transitionDuration : state.transitionDuration; AnimatorSetBuilder builder = new AnimatorSetBuilder(); - prepareForAtomicAnimation(mState, state, builder); + prepareForAtomicAnimation(fromState, state, builder); AnimatorSet animation = createAnimationToNewWorkspaceInternal( state, builder, onCompleteRunnable); Runnable runnable = new StartAnimRunnable(animation); |