From 28f422544e3b3c7470a324126dfebe086a0b72bd Mon Sep 17 00:00:00 2001 From: Andy Wickham Date: Fri, 2 May 2025 01:34:57 +0000 Subject: [PATCH] Update All Apps sheet interpolators. This is a bit of a stopgap until we are able to adopt a more versatile mechanism similar to SysUI, but here's the high level: - Workspace scale finishes more quickly than blur (53% vs 83% of the transition) - Closing All Apps reverses the opening interpolators (avoid blur disappearing too quickly). Design intent is described in the bug. Demo: https://drive.google.com/file/d/14Y28NeHoh_RBh3acXijhhx_ZIUK8GmYy/view?usp=drive_link&resourcekey=0-A9AUbEZcJsmP1GtSqbbrgg Bug: 415247657 Flag: com.android.launcher3.all_apps_sheet_for_handheld Flag: com.android.launcher3.all_apps_blur Test: Manual Change-Id: Iffa8e6f9dd98817899aadb3fb28fecd6c53bca7e --- .../touch/AllAppsSwipeController.java | 41 ++++++++++++++----- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/src/com/android/launcher3/touch/AllAppsSwipeController.java b/src/com/android/launcher3/touch/AllAppsSwipeController.java index 4c04b66c47..631661242c 100644 --- a/src/com/android/launcher3/touch/AllAppsSwipeController.java +++ b/src/com/android/launcher3/touch/AllAppsSwipeController.java @@ -15,7 +15,6 @@ */ package com.android.launcher3.touch; -import static com.android.app.animation.Interpolators.DECELERATED_EASE; import static com.android.app.animation.Interpolators.EMPHASIZED; import static com.android.app.animation.Interpolators.EMPHASIZED_ACCELERATE; import static com.android.app.animation.Interpolators.EMPHASIZED_DECELERATE; @@ -34,8 +33,10 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PR import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE; +import android.graphics.Path; import android.view.MotionEvent; import android.view.animation.Interpolator; +import android.view.animation.PathInterpolator; import com.android.app.animation.Interpolators; import com.android.launcher3.AbstractFloatingView; @@ -64,7 +65,9 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController { 1 - ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD); // Depth to apply behind All Apps when it's presented on a sheet. - private static final Interpolator ALL_APPS_SHEET_DEPTH = DECELERATED_EASE; + private static final Interpolator ALL_APPS_SHEET_DEPTH = createAllAppsSheetDepthInterpolator(); + // Scale to apply behind All Apps when it's presented on a sheet. + private static final Interpolator ALL_APPS_SHEET_SCALE = createAllAppsSheetScaleInterpolator(); // ---- Custom interpolators for NORMAL -> ALL_APPS on phones only. ---- @@ -203,15 +206,15 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController { */ public static void applyAllAppsToNormalConfig(Launcher launcher, StateAnimationConfig config) { if (launcher.getDeviceProfile().shouldShowAllAppsOnSheet()) { - config.setInterpolator(ANIM_SCRIM_FADE, - Interpolators.reverse(ALL_APPS_SCRIM_RESPONDER)); config.setInterpolator(ANIM_ALL_APPS_FADE, FINAL_FRAME); if (!config.isUserControlled()) { config.setInterpolator(ANIM_VERTICAL_PROGRESS, EMPHASIZED); } - config.setInterpolator(ANIM_WORKSPACE_SCALE, ALL_APPS_SHEET_DEPTH); - config.setInterpolator(ANIM_HOTSEAT_SCALE, ALL_APPS_SHEET_DEPTH); - config.setInterpolator(ANIM_DEPTH, ALL_APPS_SHEET_DEPTH); + config.setInterpolator( + ANIM_WORKSPACE_SCALE, Interpolators.reverse(ALL_APPS_SHEET_SCALE)); + config.setInterpolator(ANIM_HOTSEAT_SCALE, Interpolators.reverse(ALL_APPS_SHEET_SCALE)); + config.setInterpolator(ANIM_DEPTH, Interpolators.reverse(ALL_APPS_SHEET_DEPTH)); + config.setInterpolator(ANIM_SCRIM_FADE, Interpolators.reverse(ALL_APPS_SHEET_DEPTH)); if (!Flags.allAppsBlur() && launcher.getDeviceProfile().isPhone) { // On phones without blur, reveal the workspace and hotseat when leaving All Apps. config.setInterpolator(ANIM_WORKSPACE_FADE, INSTANT); @@ -253,13 +256,13 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController { Launcher launcher, StateAnimationConfig config) { if (launcher.getDeviceProfile().shouldShowAllAppsOnSheet()) { config.setInterpolator(ANIM_ALL_APPS_FADE, INSTANT); - config.setInterpolator(ANIM_SCRIM_FADE, ALL_APPS_SCRIM_RESPONDER); if (!config.isUserControlled()) { config.setInterpolator(ANIM_VERTICAL_PROGRESS, EMPHASIZED); } - config.setInterpolator(ANIM_WORKSPACE_SCALE, ALL_APPS_SHEET_DEPTH); - config.setInterpolator(ANIM_HOTSEAT_SCALE, ALL_APPS_SHEET_DEPTH); + config.setInterpolator(ANIM_WORKSPACE_SCALE, ALL_APPS_SHEET_SCALE); + config.setInterpolator(ANIM_HOTSEAT_SCALE, ALL_APPS_SHEET_SCALE); config.setInterpolator(ANIM_DEPTH, ALL_APPS_SHEET_DEPTH); + config.setInterpolator(ANIM_SCRIM_FADE, ALL_APPS_SHEET_DEPTH); if (!Flags.allAppsBlur() && launcher.getDeviceProfile().isPhone) { // On phones without blur, hide the workspace and hotseat when entering All Apps. config.setInterpolator(ANIM_WORKSPACE_FADE, FINAL_FRAME); @@ -292,6 +295,24 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController { } } + private static Interpolator createAllAppsSheetDepthInterpolator() { + Path path = new Path(); + path.moveTo(0f, 0f); + path.cubicTo(0.016f, 0f, 0.04f, 0.1f, 0.08f, 0.1f); + path.cubicTo(0.218f, 0.1f, 0.218f, 1f, 1f, 1f); + + return Interpolators.clampToProgress(new PathInterpolator(path), 0f, 0.83f); + } + + private static Interpolator createAllAppsSheetScaleInterpolator() { + Path path = new Path(); + path.moveTo(0f, 0f); + path.cubicTo(0.025f, 0f, 0.0625f, 0.2f, 0.125f, 0.2f); + path.cubicTo(0.3875f, 0.2f, 0.125f, 1f, 1f, 1f); + + return Interpolators.clampToProgress(new PathInterpolator(path), 0f, 0.53f); + } + /** Creates an interpolator that is 0 until the threshold, then follows given interpolator. */ private static Interpolator thresholdInterpolator(float threshold, Interpolator interpolator) { return progress -> progress <= threshold ? 0 : interpolator.getInterpolation(progress);