From d4ece9a74ca81b376bf9e40fc112ad0133637fe8 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Thu, 10 May 2018 09:55:07 -0700 Subject: [PATCH] Don't reapply state when setting user controlled animation Bug: 79525106 Change-Id: Ia41a51559196d4aa657fae47727c7366d9073295 --- .../launcher3/LauncherStateManager.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java index d04401e5ca..cf0c7fcb69 100644 --- a/src/com/android/launcher3/LauncherStateManager.java +++ b/src/com/android/launcher3/LauncherStateManager.java @@ -387,6 +387,7 @@ public class LauncherStateManager { } public void setCurrentUserControlledAnimation(AnimatorPlaybackController controller) { + clearCurrentAnimation(); setCurrentAnimation(controller.getTarget()); mConfig.userControlled = true; mConfig.playbackController = controller; @@ -405,15 +406,10 @@ public class LauncherStateManager { } if (mConfig.playbackController != null && mConfig.playbackController.getTarget() == childAnim) { - if (mConfig.mCurrentAnimation != null) { - mConfig.mCurrentAnimation.removeListener(mConfig); - mConfig.mCurrentAnimation = null; - } - mConfig.playbackController = null; + clearCurrentAnimation(); break; } else if (mConfig.mCurrentAnimation == childAnim) { - mConfig.mCurrentAnimation.removeListener(mConfig); - mConfig.mCurrentAnimation = null; + clearCurrentAnimation(); break; } } @@ -425,6 +421,14 @@ public class LauncherStateManager { mConfig.setAnimation(anim, null); } + private void clearCurrentAnimation() { + if (mConfig.mCurrentAnimation != null) { + mConfig.mCurrentAnimation.removeListener(mConfig); + mConfig.mCurrentAnimation = null; + } + mConfig.playbackController = null; + } + private class StartAnimRunnable implements Runnable { private final AnimatorSet mAnim;