From 1c89ee8cb1f93083a2a5826a7d95d74baff0ed86 Mon Sep 17 00:00:00 2001 From: Luca Zuccarini Date: Fri, 13 May 2022 21:54:23 +0000 Subject: [PATCH] Additional polish for the NORMAL<->ALL_APPS transitions. The depth of ALL_APPS is set to 2 because in the legacy transitions the swap happens at 0.5. The depth controller bounds the value to 1, so for the second half of the animation the value is always 1. Because of this, in order to have the right timing during the blur and scale we cap the interpolator to 0.5. Workspace fade is also removed, per spec. Bug: 232418544 Test: manual Change-Id: Idfd92c8b2b571ad911a0a5a59d39c5911e4131e4 --- .../PortraitStatesTouchController.java | 11 ++++++++--- .../launcher3/touch/AllAppsSwipeController.java | 13 ++++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java index e874bf0904..e56c90c20c 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java @@ -80,13 +80,18 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr // Custom timing for NORMAL -> ALL_APPS on phones only. private static final float ALL_APPS_STATE_TRANSITION = 0.4f; + private static final float ALL_APPS_FULL_DEPTH_PROGRESS = 0.5f; // Custom interpolators for NORMAL -> ALL_APPS on phones only. private static final Interpolator LINEAR_EARLY = Interpolators.clampToProgress(LINEAR, 0f, ALL_APPS_STATE_TRANSITION); private static final Interpolator STEP_TRANSITION = Interpolators.clampToProgress(FINAL_FRAME, 0f, ALL_APPS_STATE_TRANSITION); - public static final Interpolator BLUR = LINEAR_EARLY; + // The blur to and from All Apps is set to be complete when the interpolator is at 0.5. + public static final Interpolator BLUR = + Interpolators.clampToProgress( + Interpolators.mapToProgress(LINEAR, 0f, ALL_APPS_FULL_DEPTH_PROGRESS), + 0f, ALL_APPS_STATE_TRANSITION); public static final Interpolator WORKSPACE_FADE = STEP_TRANSITION; public static final Interpolator WORKSPACE_SCALE = LINEAR_EARLY; public static final Interpolator HOTSEAT_FADE = STEP_TRANSITION; @@ -97,8 +102,8 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr Interpolators.clampToProgress(LINEAR, ALL_APPS_STATE_TRANSITION, 1f); public static final Interpolator ALL_APPS_VERTICAL_PROGRESS = Interpolators.clampToProgress( - Interpolators.mapToProgress(LINEAR, ALL_APPS_STATE_TRANSITION, 1.0f), - ALL_APPS_STATE_TRANSITION, 1.0f); + Interpolators.mapToProgress(LINEAR, ALL_APPS_STATE_TRANSITION, 1f), + ALL_APPS_STATE_TRANSITION, 1f); private final PortraitOverviewStateTouchHelper mOverviewPortraitStateTouchHelper; diff --git a/src/com/android/launcher3/touch/AllAppsSwipeController.java b/src/com/android/launcher3/touch/AllAppsSwipeController.java index fb916287c6..787d9ea8e0 100644 --- a/src/com/android/launcher3/touch/AllAppsSwipeController.java +++ b/src/com/android/launcher3/touch/AllAppsSwipeController.java @@ -30,6 +30,7 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_SCA import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_TRANSLATE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PROGRESS; +import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE; import android.view.MotionEvent; @@ -52,6 +53,7 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController { private static final float WORKSPACE_MOTION_START = 0.1667f; private static final float ALL_APPS_STATE_TRANSITION = 0.305f; private static final float ALL_APPS_FADE_END = 0.4717f; + private static final float ALL_APPS_FULL_DEPTH_PROGRESS = 0.5f; public static final Interpolator ALLAPPS_STAGGERED_FADE_EARLY_RESPONDER = Interpolators.clampToProgress(LINEAR, 0, ALLAPPS_STAGGERED_FADE_THRESHOLD); @@ -59,14 +61,18 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController { Interpolators.clampToProgress(LINEAR, ALLAPPS_STAGGERED_FADE_THRESHOLD, 1f); // Custom interpolators for NORMAL -> ALL_APPS on phones only. + // The blur to All Apps is set to be complete when the interpolator is at 0.5. public static final Interpolator BLUR = Interpolators.clampToProgress( - EMPHASIZED_DECELERATE, WORKSPACE_MOTION_START, ALL_APPS_STATE_TRANSITION); + Interpolators.mapToProgress( + EMPHASIZED_DECELERATE, 0f, ALL_APPS_FULL_DEPTH_PROGRESS), + WORKSPACE_MOTION_START, ALL_APPS_STATE_TRANSITION); + public static final Interpolator WORKSPACE_FADE = + Interpolators.clampToProgress(FINAL_FRAME, 0f, ALL_APPS_STATE_TRANSITION); public static final Interpolator WORKSPACE_SCALE = Interpolators.clampToProgress( EMPHASIZED_DECELERATE, WORKSPACE_MOTION_START, ALL_APPS_STATE_TRANSITION); - public static final Interpolator HOTSEAT_FADE = - Interpolators.clampToProgress(FINAL_FRAME, 0f, ALL_APPS_STATE_TRANSITION); + public static final Interpolator HOTSEAT_FADE = WORKSPACE_FADE; public static final Interpolator HOTSEAT_SCALE = HOTSEAT_FADE; public static final Interpolator HOTSEAT_TRANSLATE = Interpolators.clampToProgress( @@ -163,6 +169,7 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController { config.setInterpolator(ANIM_ALL_APPS_FADE, INSTANT); } else { config.setInterpolator(ANIM_DEPTH, BLUR); + config.setInterpolator(ANIM_WORKSPACE_FADE, WORKSPACE_FADE); config.setInterpolator(ANIM_WORKSPACE_SCALE, WORKSPACE_SCALE); config.setInterpolator(ANIM_HOTSEAT_FADE, HOTSEAT_FADE); config.setInterpolator(ANIM_HOTSEAT_SCALE, HOTSEAT_SCALE);