Merge "Update home to overview depth interpolator to match other motion" into ub-launcher3-rvc-dev

This commit is contained in:
TreeHugger Robot 2020-06-02 20:18:01 +00:00 committed by Android (Google) Code Review
commit 62382c3f95
3 changed files with 9 additions and 3 deletions

View File

@ -37,6 +37,7 @@ import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_7;
import static com.android.launcher3.anim.Interpolators.clampToProgress; import static com.android.launcher3.anim.Interpolators.clampToProgress;
import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS; 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_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_SCALE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_TRANSLATE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_TRANSLATE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FADE;
@ -210,6 +211,7 @@ public class QuickstepAtomicAnimationFactory extends
} }
config.setInterpolator(ANIM_WORKSPACE_FADE, OVERSHOOT_1_2); config.setInterpolator(ANIM_WORKSPACE_FADE, OVERSHOOT_1_2);
config.setInterpolator(ANIM_OVERVIEW_SCALE, OVERSHOOT_1_2); config.setInterpolator(ANIM_OVERVIEW_SCALE, OVERSHOOT_1_2);
config.setInterpolator(ANIM_DEPTH, OVERSHOOT_1_2);
Interpolator translationInterpolator = ENABLE_OVERVIEW_ACTIONS.get() Interpolator translationInterpolator = ENABLE_OVERVIEW_ACTIONS.get()
&& removeShelfFromOverview(mActivity) && removeShelfFromOverview(mActivity)
? OVERSHOOT_1_2 ? OVERSHOOT_1_2

View File

@ -17,6 +17,7 @@
package com.android.launcher3.statehandlers; package com.android.launcher3.statehandlers;
import static com.android.launcher3.anim.Interpolators.LINEAR; 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 static com.android.launcher3.states.StateAnimationConfig.SKIP_DEPTH_CONTROLLER;
import android.os.IBinder; import android.os.IBinder;
@ -191,11 +192,12 @@ public class DepthController implements StateHandler<LauncherState> {
float toDepth = toState.getDepth(mLauncher); float toDepth = toState.getDepth(mLauncher);
if (Float.compare(mDepth, toDepth) != 0) { 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) { private void setDepth(float depth) {
depth = Utilities.boundToRange(depth, 0, 1);
// Round out the depth to dedupe frequent, non-perceptable updates // Round out the depth to dedupe frequent, non-perceptable updates
int depthI = (int) (depth * 256); int depthI = (int) (depth * 256);
float depthF = depthI / 256f; float depthF = depthI / 256f;

View File

@ -69,7 +69,8 @@ public class StateAnimationConfig {
ANIM_ALL_APPS_FADE, ANIM_ALL_APPS_FADE,
ANIM_OVERVIEW_SCRIM_FADE, ANIM_OVERVIEW_SCRIM_FADE,
ANIM_ALL_APPS_HEADER_FADE, ANIM_ALL_APPS_HEADER_FADE,
ANIM_OVERVIEW_MODAL ANIM_OVERVIEW_MODAL,
ANIM_DEPTH,
}) })
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
public @interface AnimType {} public @interface AnimType {}
@ -87,8 +88,9 @@ public class StateAnimationConfig {
public static final int ANIM_OVERVIEW_SCRIM_FADE = 11; 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_ALL_APPS_HEADER_FADE = 12; // e.g. predictions
public static final int ANIM_OVERVIEW_MODAL = 13; 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]; private final Interpolator[] mInterpolators = new Interpolator[ANIM_TYPES_COUNT];