Merge "Translate taskbar to hotseat without jump when swiping up from overview" into tm-qpr-dev am: 3dd1440520 am: f5153d5de2 am: 0ef1f9eae0

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

Change-Id: I0b0681684f5ecc9aef3340a0b686dcab2adffb8f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
TreeHugger Robot
2023-03-07 03:48:54 +00:00
committed by Automerger Merge Worker
3 changed files with 11 additions and 11 deletions
@@ -197,15 +197,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
*/ */
public Animator createAnimToLauncher(@NonNull LauncherState toState, public Animator createAnimToLauncher(@NonNull LauncherState toState,
@NonNull RecentsAnimationCallbacks callbacks, long duration) { @NonNull RecentsAnimationCallbacks callbacks, long duration) {
AnimatorSet set = new AnimatorSet(); return mTaskbarLauncherStateController.createAnimToLauncher(toState, callbacks, duration);
Animator taskbarState = mTaskbarLauncherStateController
.createAnimToLauncher(toState, callbacks, duration);
long halfDuration = Math.round(duration * 0.5f);
Animator translation =
mControllers.taskbarTranslationController.createAnimToLauncher(halfDuration);
set.playTogether(taskbarState, translation);
return set;
} }
public boolean isDraggingItem() { public boolean isDraggingItem() {
@@ -433,6 +433,14 @@ import java.util.StringJoiner;
}); });
animatorSet.play(stashAnimator); animatorSet.play(stashAnimator);
} }
if (isAnimatingToLauncher() || mLauncherState == LauncherState.NORMAL) {
// Translate back to 0 at a shorter or same duration as the icon alignment animation.
// This ensures there is no jump after switching to hotseat, e.g. when swiping up from
// overview to home. Currently we do duration / 2 just to make it feel snappier.
animatorSet.play(mControllers.taskbarTranslationController
.createAnimToResetTranslation(duration / 2));
}
} }
private boolean isInLauncher() { private boolean isInLauncher() {
@@ -135,9 +135,9 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable
} }
/** /**
* Returns an animation to reset the taskbar translation for animation back to launcher. * Returns an animation to reset the taskbar translation to {@code 0}.
*/ */
public ObjectAnimator createAnimToLauncher(long duration) { public ObjectAnimator createAnimToResetTranslation(long duration) {
ObjectAnimator animator = ObjectAnimator.ofFloat(mTranslationYForSwipe, VALUE, 0); ObjectAnimator animator = ObjectAnimator.ofFloat(mTranslationYForSwipe, VALUE, 0);
animator.setInterpolator(Interpolators.LINEAR); animator.setInterpolator(Interpolators.LINEAR);
animator.setDuration(duration); animator.setDuration(duration);