From 10c78b94f5438df19acce0313e96c528476b0284 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Sat, 25 Feb 2023 00:10:45 +0000 Subject: [PATCH] Translate taskbar to hotseat without jump when swiping up from overview Also use this code path to reset translation when going from an app to launcher. Test: swipe up from overview, goes home without hotseat jumping Fixes: 262826748 Change-Id: If8a4278a61e3786cfe16c388eabefacc63e8f327 --- .../launcher3/taskbar/LauncherTaskbarUIController.java | 10 +--------- .../taskbar/TaskbarLauncherStateController.java | 8 ++++++++ .../taskbar/TaskbarTranslationController.java | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java index 3046076ec3..856bfdbb50 100644 --- a/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java +++ b/quickstep/src/com/android/launcher3/taskbar/LauncherTaskbarUIController.java @@ -202,15 +202,7 @@ public class LauncherTaskbarUIController extends TaskbarUIController { */ public Animator createAnimToLauncher(@NonNull LauncherState toState, @NonNull RecentsAnimationCallbacks callbacks, long duration) { - AnimatorSet set = new AnimatorSet(); - 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; + return mTaskbarLauncherStateController.createAnimToLauncher(toState, callbacks, duration); } public boolean isDraggingItem() { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index 1c6aca7332..e124482dba 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -435,6 +435,14 @@ import java.util.StringJoiner; }); 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() { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarTranslationController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarTranslationController.java index a6b2a8abd0..062b4ce52a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarTranslationController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarTranslationController.java @@ -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); animator.setInterpolator(Interpolators.LINEAR); animator.setDuration(duration);