From 10c2b4f9d9b398bde933c1e10c10480819eb8e56 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Mon, 1 Jun 2020 14:20:30 -0500 Subject: [PATCH] Update home to overview depth interpolator to match other motion Overview comes in and workspace goes out at overshoot(1.2), so the wallpaper depth/blur should match that speed. Test: go to overview from home in 3 button or 0 button mode, ensure wallpaper scales down at the same rate as other elements Bug: 154637581 Change-Id: I03254fa3fdf19f468852bed8aab7ba21203c429a --- .../uioverrides/states/QuickstepAtomicAnimationFactory.java | 2 ++ .../android/launcher3/statehandlers/DepthController.java | 4 +++- src/com/android/launcher3/states/StateAnimationConfig.java | 6 ++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java index 94c7771513..bf4c05da99 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java @@ -36,6 +36,7 @@ import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_7; import static com.android.launcher3.anim.Interpolators.clampToProgress; import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS; import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE; +import static com.android.launcher3.states.StateAnimationConfig.ANIM_DEPTH; import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_SCALE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_TRANSLATE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FADE; @@ -209,6 +210,7 @@ public class QuickstepAtomicAnimationFactory extends } config.setInterpolator(ANIM_WORKSPACE_FADE, OVERSHOOT_1_2); config.setInterpolator(ANIM_OVERVIEW_SCALE, OVERSHOOT_1_2); + config.setInterpolator(ANIM_DEPTH, OVERSHOOT_1_2); Interpolator translationInterpolator = ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(mActivity) ? OVERSHOOT_1_2 diff --git a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java index 8292a92af6..df1b18e018 100644 --- a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java +++ b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java @@ -17,6 +17,7 @@ package com.android.launcher3.statehandlers; import static com.android.launcher3.anim.Interpolators.LINEAR; +import static com.android.launcher3.states.StateAnimationConfig.ANIM_DEPTH; import static com.android.launcher3.states.StateAnimationConfig.SKIP_DEPTH_CONTROLLER; import android.os.IBinder; @@ -172,11 +173,12 @@ public class DepthController implements StateHandler { float toDepth = toState.getDepth(mLauncher); if (Float.compare(mDepth, toDepth) != 0) { - animation.setFloat(this, DEPTH, toDepth, LINEAR); + animation.setFloat(this, DEPTH, toDepth, config.getInterpolator(ANIM_DEPTH, LINEAR)); } } private void setDepth(float depth) { + depth = Utilities.boundToRange(depth, 0, 1); // Round out the depth to dedupe frequent, non-perceptable updates int depthI = (int) (depth * 256); float depthF = depthI / 256f; diff --git a/src/com/android/launcher3/states/StateAnimationConfig.java b/src/com/android/launcher3/states/StateAnimationConfig.java index 1c4986728f..f90ad3cd0b 100644 --- a/src/com/android/launcher3/states/StateAnimationConfig.java +++ b/src/com/android/launcher3/states/StateAnimationConfig.java @@ -69,7 +69,8 @@ public class StateAnimationConfig { ANIM_ALL_APPS_FADE, ANIM_OVERVIEW_SCRIM_FADE, ANIM_ALL_APPS_HEADER_FADE, - ANIM_OVERVIEW_MODAL + ANIM_OVERVIEW_MODAL, + ANIM_DEPTH, }) @Retention(RetentionPolicy.SOURCE) public @interface AnimType {} @@ -87,8 +88,9 @@ public class StateAnimationConfig { public static final int ANIM_OVERVIEW_SCRIM_FADE = 11; public static final int ANIM_ALL_APPS_HEADER_FADE = 12; // e.g. predictions public static final int ANIM_OVERVIEW_MODAL = 13; + public static final int ANIM_DEPTH = 14; - private static final int ANIM_TYPES_COUNT = 14; + private static final int ANIM_TYPES_COUNT = 15; private final Interpolator[] mInterpolators = new Interpolator[ANIM_TYPES_COUNT];