From b35f50cf55742a26c6e319ec324f9118c6886b88 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Mon, 9 Apr 2018 16:30:51 -0700 Subject: [PATCH] Do not reset the previous state animation, if it is a part of the new state animaiton Change-Id: Ic433db8cd2b0701923185d0a2db2a4361567437f --- .../launcher3/LauncherAppTransitionManagerImpl.java | 4 +++- src/com/android/launcher3/LauncherStateManager.java | 11 ++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java index ad0b7344b6..74d455faa3 100644 --- a/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java +++ b/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java @@ -261,6 +261,7 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag return false; } + Animator childStateAnimation = null; // Found a visible recents task that matches the opening app, lets launch the app from there Animator launcherAnim; final AnimatorListenerAdapter windowAnimEndListener; @@ -276,6 +277,7 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag mLauncher.getStateManager() .createAnimationToNewWorkspace(NORMAL, RECENTS_LAUNCH_DURATION); controller.dispatchOnStart(); + childStateAnimation = controller.getOriginalTarget(); launcherAnim = controller.getAnimationPlayer().setDuration(RECENTS_LAUNCH_DURATION); windowAnimEndListener = new AnimatorListenerAdapter() { @Override @@ -291,7 +293,7 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag // Set the current animation first, before adding windowAnimEndListener. Setting current // animation adds some listeners which need to be called before windowAnimEndListener // (the ordering of listeners matter in this case). - mLauncher.getStateManager().setCurrentAnimation(target); + mLauncher.getStateManager().setCurrentAnimation(target, childStateAnimation); target.addListener(windowAnimEndListener); return true; } diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java index 534c8ae351..d5e6a9ddde 100644 --- a/src/com/android/launcher3/LauncherStateManager.java +++ b/src/com/android/launcher3/LauncherStateManager.java @@ -354,8 +354,17 @@ public class LauncherStateManager { /** * Sets the animation as the current state animation, i.e., canceled when * starting another animation and may block some launcher interactions while running. + * + * @param childAnimations Set of animations with the new target is controlling. */ - public void setCurrentAnimation(AnimatorSet anim) { + public void setCurrentAnimation(AnimatorSet anim, Animator... childAnimations) { + for (Animator childAnim : childAnimations) { + if (childAnim != null && mConfig.mCurrentAnimation == childAnim) { + mConfig.mCurrentAnimation.removeListener(mConfig); + mConfig.mCurrentAnimation = null; + break; + } + } boolean reapplyNeeded = mConfig.mCurrentAnimation != null; cancelAnimation(); if (reapplyNeeded) {