Merge changes from topics "presubmit-am-0ed6d9a2502540239b46d7d3573bd44e", "presubmit-am-7a77b5bffdb04bf38bcec9ec17d4d6ee" into tm-qpr-dev am: f583786984

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

Change-Id: Iea9d0c287c3acd640467f4cd0430dbad031e39df
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jon Miranda
2023-04-13 20:11:52 +00:00
committed by Automerger Merge Worker
2 changed files with 6 additions and 17 deletions

View File

@@ -642,7 +642,7 @@ public class TaskbarLauncherStateController {
long resetDuration = mControllers.taskbarStashController.isInApp()
? duration
: duration / 2;
if (mControllers.taskbarTranslationController.shouldResetBackToZero(resetDuration)
if (!mControllers.taskbarTranslationController.willAnimateToZeroBefore(resetDuration)
&& (isAnimatingToLauncher() || mLauncherState == LauncherState.NORMAL)) {
animatorSet.play(mControllers.taskbarTranslationController
.createAnimToResetTranslation(resetDuration));

View File

@@ -54,7 +54,6 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
private boolean mHasSprungOnceThisGesture;
private @Nullable ValueAnimator mSpringBounce;
private boolean mGestureEnded;
private boolean mGestureInProgress;
private boolean mAnimationToHomeRunning;
private final boolean mIsTransientTaskbar;
@@ -124,7 +123,6 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
private void reset() {
mGestureEnded = false;
mGestureInProgress = false;
mHasSprungOnceThisGesture = false;
}
@@ -136,24 +134,18 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
}
/**
* Returns {@code true} if we should reset the animation back to zero.
*
* Returns {@code false} if there is a gesture in progress, or if we are already animating
* to 0 within the specified duration.
* Returns true if we will animate to zero before the input duration.
*/
public boolean shouldResetBackToZero(long duration) {
if (mGestureInProgress) {
return false;
}
public boolean willAnimateToZeroBefore(long duration) {
if (mSpringBounce != null && mSpringBounce.isRunning()) {
long springDuration = mSpringBounce.getDuration();
long current = mSpringBounce.getCurrentPlayTime();
return (springDuration - current >= duration);
return (springDuration - current < duration);
}
if (mTranslationYForSwipe.isAnimatingToValue(0)) {
return mTranslationYForSwipe.getRemainingTime() >= duration;
return mTranslationYForSwipe.getRemainingTime() < duration;
}
return true;
return false;
}
/**
@@ -196,7 +188,6 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
mAnimationToHomeRunning = false;
cancelSpringIfExists();
reset();
mGestureInProgress = true;
}
/**
* Called when there is movement to move the taskbar.
@@ -220,7 +211,6 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
mGestureEnded = true;
startSpring();
}
mGestureInProgress = false;
}
}
@@ -232,7 +222,6 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
pw.println(prefix + "\tmHasSprungOnceThisGesture=" + mHasSprungOnceThisGesture);
pw.println(prefix + "\tmAnimationToHomeRunning=" + mAnimationToHomeRunning);
pw.println(prefix + "\tmGestureEnded=" + mGestureEnded);
pw.println(prefix + "\tmGestureInProgress=" + mGestureInProgress);
pw.println(prefix + "\tmSpringBounce is running=" + (mSpringBounce != null
&& mSpringBounce.isRunning()));
}