Merge "Fix bug where unstash animation plays twice." into udc-dev am: ba4fcb0171

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/23153653

Change-Id: Ib5d86f5a96daf9d199aec06f3b421ee3f9f5f6e7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2023-05-13 02:33:24 +00:00
committed by Automerger Merge Worker
2 changed files with 22 additions and 0 deletions
@@ -17,6 +17,7 @@ package com.android.launcher3.taskbar;
import static com.android.launcher3.anim.AnimatedFloat.VALUE;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import androidx.annotation.Nullable;
@@ -85,6 +86,15 @@ public class TaskbarSpringOnStashController implements LoggableTaskbarController
.build(mTranslationForStash, VALUE);
}
/**
* Returns an animation to reset the stash translation back to 0 when unstashing.
*/
public @Nullable ObjectAnimator createResetAnimForUnstash() {
if (!mIsTransientTaskbar) {
return null;
}
return mTranslationForStash.animateToValue(0);
}
@Override
public void dumpLogs(String prefix, PrintWriter pw) {
@@ -799,6 +799,9 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
if (isStashed) {
play(skippable, mControllers.taskbarSpringOnStashController.createSpringToStash(),
0, duration, LINEAR);
} else {
play(skippable, mControllers.taskbarSpringOnStashController.createResetAnimForUnstash(),
0, duration, LINEAR);
}
mControllers.taskbarViewController.addRevealAnimToIsStashed(skippable, isStashed, duration,
@@ -1218,6 +1221,15 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
&& mLastStartedTransitionType == TRANSITION_DEFAULT
&& animationType != TRANSITION_DEFAULT;
// It is possible for stash=false to be requested by TRANSITION_HOME_TO_APP and
// TRANSITION_DEFAULT in quick succession. In this case, we should ignore
// transitionTypeChanged because the animations are exactly the same.
if (transitionTypeChanged
&& (!mIsStashed && !isStashed)
&& animationType == TRANSITION_HOME_TO_APP) {
transitionTypeChanged = false;
}
if (mIsStashed != isStashed || transitionTypeChanged) {
mIsStashed = isStashed;
mLastStartedTransitionType = animationType;