From 96d4ec4544204b8f27dd96bd043cd13927ecb4aa Mon Sep 17 00:00:00 2001 From: Hyunyoung Song Date: Tue, 4 May 2021 09:08:09 -0700 Subject: [PATCH] All apps motion tuning [1/n] - reverse spring direction to enable overshoot - change master interpolators for swipe / fling Test: manual Bug: 183001675 Bug: 186121789 Change-Id: I5869d84daab99594cc2a261cb8f5d28e0293afe1 --- .../launcher3/allapps/AllAppsContainerView.java | 4 ++-- .../allapps/AllAppsTransitionController.java | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 40f7ab167c..1d31caf745 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -75,7 +75,7 @@ import com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip.OnActivePag public class AllAppsContainerView extends SpringRelativeLayout implements DragSource, Insettable, OnDeviceProfileChangeListener, OnActivePageChangedListener { - private static final float FLING_VELOCITY_MULTIPLIER = 1800f; + private static final float FLING_VELOCITY_MULTIPLIER = 1000f; // Starts the springs after at least 25% of the animation has passed. private static final float FLING_ANIMATION_THRESHOLD = 0.25f; @@ -611,7 +611,7 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo public void onAnimationUpdate(ValueAnimator valueAnimator) { if (shouldSpring && valueAnimator.getAnimatedFraction() >= FLING_ANIMATION_THRESHOLD) { - absorbSwipeUpVelocity(-Math.abs( + absorbSwipeUpVelocity(Math.abs( Math.round(velocity * FLING_VELOCITY_MULTIPLIER))); shouldSpring = false; } diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java index c61c0d6d53..c4c7891d58 100644 --- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java +++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java @@ -15,13 +15,15 @@ */ package com.android.launcher3.allapps; +import static com.android.launcher3.LauncherState.ALL_APPS; import static com.android.launcher3.LauncherState.ALL_APPS_CONTENT; -import static com.android.launcher3.LauncherState.OVERVIEW; -import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN; +import static com.android.launcher3.anim.Interpolators.ACCEL_0_75; +import static com.android.launcher3.anim.Interpolators.ACCEL_2; +import static com.android.launcher3.anim.Interpolators.DEACCEL; +import static com.android.launcher3.anim.Interpolators.DEACCEL_2; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER; import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE; -import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PROGRESS; import static com.android.launcher3.util.SystemUiController.UI_STATE_ALLAPPS; @@ -154,9 +156,9 @@ public class AllAppsTransitionController return; } - Interpolator interpolator = config.userControlled ? LINEAR : toState == OVERVIEW - ? config.getInterpolator(ANIM_OVERVIEW_SCALE, FAST_OUT_SLOW_IN) - : FAST_OUT_SLOW_IN; + Interpolator interpolator = toState.equals(ALL_APPS) + ? (config.userControlled ? ACCEL_2 : ACCEL_0_75) : + (config.userControlled ? DEACCEL_2 : DEACCEL); Animator anim = createSpringAnimation(mProgress, targetProgress); anim.setInterpolator(config.getInterpolator(ANIM_VERTICAL_PROGRESS, interpolator));