Merge "Unify the source of truth for NORMAL <> ALL_APPS transitions." into tm-qpr-dev am: 4a0129fa5f
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/18911769 Change-Id: I2a7070c2a0c255fadb4f3b399c153d710a40cce0 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
+3
-24
@@ -42,17 +42,10 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SC
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y;
|
||||
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 static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE;
|
||||
import static com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController.ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD;
|
||||
import static com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController.ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD;
|
||||
import static com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController.ALL_APPS_SCRIM_OPAQUE_THRESHOLD;
|
||||
import static com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController.ALL_APPS_SCRIM_VISIBLE_THRESHOLD;
|
||||
import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY;
|
||||
import static com.android.systemui.animation.Interpolators.EMPHASIZED_ACCELERATE;
|
||||
import static com.android.systemui.animation.Interpolators.EMPHASIZED_DECELERATE;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
|
||||
@@ -60,8 +53,8 @@ import com.android.launcher3.CellLayout;
|
||||
import com.android.launcher3.Hotseat;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.Workspace;
|
||||
import com.android.launcher3.anim.Interpolators;
|
||||
import com.android.launcher3.states.StateAnimationConfig;
|
||||
import com.android.launcher3.touch.AllAppsSwipeController;
|
||||
import com.android.launcher3.uioverrides.QuickstepLauncher;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.quickstep.util.RecentsAtomicAnimationFactory;
|
||||
@@ -182,23 +175,9 @@ public class QuickstepAtomicAnimationFactory extends
|
||||
}
|
||||
config.duration = Math.max(config.duration, mHintToNormalDuration);
|
||||
} else if (fromState == ALL_APPS && toState == NORMAL) {
|
||||
boolean isTablet = mActivity.getDeviceProfile().isTablet;
|
||||
config.setInterpolator(ANIM_ALL_APPS_FADE,
|
||||
isTablet ? FINAL_FRAME : Interpolators.clampToProgress(LINEAR,
|
||||
1 - ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD,
|
||||
1 - ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD));
|
||||
config.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(LINEAR,
|
||||
1 - ALL_APPS_SCRIM_OPAQUE_THRESHOLD,
|
||||
1 - ALL_APPS_SCRIM_VISIBLE_THRESHOLD));
|
||||
config.setInterpolator(ANIM_VERTICAL_PROGRESS, EMPHASIZED_ACCELERATE);
|
||||
if (!isTablet) {
|
||||
config.setInterpolator(ANIM_WORKSPACE_FADE, INSTANT);
|
||||
}
|
||||
AllAppsSwipeController.applyAllAppsToNormalConfig(mActivity, config);
|
||||
} else if (fromState == NORMAL && toState == ALL_APPS) {
|
||||
if (mActivity.getDeviceProfile().isTablet) {
|
||||
config.setInterpolator(ANIM_VERTICAL_PROGRESS, EMPHASIZED_DECELERATE);
|
||||
}
|
||||
// TODO(b/231682175): centralize this setup in AllAppsSwipeController
|
||||
AllAppsSwipeController.applyNormalToAllAppsAnimConfig(mActivity, config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-115
@@ -21,21 +21,8 @@ import static com.android.launcher3.AbstractFloatingView.getTopOpenViewWithType;
|
||||
import static com.android.launcher3.LauncherState.ALL_APPS;
|
||||
import static com.android.launcher3.LauncherState.NORMAL;
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW;
|
||||
import static com.android.launcher3.anim.Interpolators.FINAL_FRAME;
|
||||
import static com.android.launcher3.anim.Interpolators.INSTANT;
|
||||
import static com.android.launcher3.anim.Interpolators.LINEAR;
|
||||
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_FADE;
|
||||
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_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;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Launcher;
|
||||
@@ -44,6 +31,7 @@ import com.android.launcher3.allapps.AllAppsTransitionController;
|
||||
import com.android.launcher3.anim.Interpolators;
|
||||
import com.android.launcher3.states.StateAnimationConfig;
|
||||
import com.android.launcher3.touch.AbstractStateChangeTouchController;
|
||||
import com.android.launcher3.touch.AllAppsSwipeController;
|
||||
import com.android.launcher3.touch.SingleAxisSwipeDetector;
|
||||
import com.android.launcher3.uioverrides.states.OverviewState;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
@@ -58,53 +46,6 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
|
||||
|
||||
private static final String TAG = "PortraitStatesTouchCtrl";
|
||||
|
||||
/**
|
||||
* The progress at which all apps content will be fully visible.
|
||||
*/
|
||||
public static final float ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD = 0.8f;
|
||||
|
||||
/**
|
||||
* Minimum clamping progress for fading in all apps content
|
||||
*/
|
||||
public static final float ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD = 0.5f;
|
||||
|
||||
/**
|
||||
* Minimum clamping progress for fading in all apps scrim
|
||||
*/
|
||||
public static final float ALL_APPS_SCRIM_VISIBLE_THRESHOLD = .1f;
|
||||
|
||||
/**
|
||||
* Maximum clamping progress for opaque all apps scrim
|
||||
*/
|
||||
public static final float ALL_APPS_SCRIM_OPAQUE_THRESHOLD = .5f;
|
||||
|
||||
// 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);
|
||||
// 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;
|
||||
public static final Interpolator HOTSEAT_SCALE = LINEAR_EARLY;
|
||||
public static final Interpolator HOTSEAT_TRANSLATE = STEP_TRANSITION;
|
||||
public static final Interpolator SCRIM_FADE = LINEAR_EARLY;
|
||||
public static final Interpolator ALL_APPS_FADE =
|
||||
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, 1f),
|
||||
ALL_APPS_STATE_TRANSITION, 1f);
|
||||
|
||||
private final PortraitOverviewStateTouchHelper mOverviewPortraitStateTouchHelper;
|
||||
|
||||
public PortraitStatesTouchController(Launcher l) {
|
||||
@@ -160,66 +101,15 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
|
||||
return fromState;
|
||||
}
|
||||
|
||||
private StateAnimationConfig getNormalToAllAppsAnimation() {
|
||||
StateAnimationConfig builder = new StateAnimationConfig();
|
||||
if (mLauncher.getDeviceProfile().isTablet) {
|
||||
builder.setInterpolator(ANIM_ALL_APPS_FADE, INSTANT);
|
||||
builder.setInterpolator(ANIM_SCRIM_FADE,
|
||||
Interpolators.clampToProgress(LINEAR,
|
||||
ALL_APPS_SCRIM_VISIBLE_THRESHOLD,
|
||||
ALL_APPS_SCRIM_OPAQUE_THRESHOLD));
|
||||
} else {
|
||||
// TODO(b/231682175): centralize this setup in AllAppsSwipeController.
|
||||
builder.setInterpolator(ANIM_DEPTH, BLUR);
|
||||
builder.setInterpolator(ANIM_WORKSPACE_FADE, WORKSPACE_FADE);
|
||||
builder.setInterpolator(ANIM_WORKSPACE_SCALE, WORKSPACE_SCALE);
|
||||
builder.setInterpolator(ANIM_HOTSEAT_FADE, HOTSEAT_FADE);
|
||||
builder.setInterpolator(ANIM_HOTSEAT_SCALE, HOTSEAT_SCALE);
|
||||
builder.setInterpolator(ANIM_HOTSEAT_TRANSLATE, HOTSEAT_TRANSLATE);
|
||||
builder.setInterpolator(ANIM_SCRIM_FADE, SCRIM_FADE);
|
||||
builder.setInterpolator(ANIM_ALL_APPS_FADE, ALL_APPS_FADE);
|
||||
builder.setInterpolator(ANIM_VERTICAL_PROGRESS, ALL_APPS_VERTICAL_PROGRESS);
|
||||
}
|
||||
return builder;
|
||||
}
|
||||
|
||||
private StateAnimationConfig getAllAppsToNormalAnimation() {
|
||||
StateAnimationConfig builder = new StateAnimationConfig();
|
||||
if (mLauncher.getDeviceProfile().isTablet) {
|
||||
builder.setInterpolator(ANIM_ALL_APPS_FADE, FINAL_FRAME);
|
||||
builder.setInterpolator(ANIM_SCRIM_FADE,
|
||||
Interpolators.clampToProgress(LINEAR,
|
||||
1 - ALL_APPS_SCRIM_OPAQUE_THRESHOLD,
|
||||
1 - ALL_APPS_SCRIM_VISIBLE_THRESHOLD));
|
||||
} else {
|
||||
// These interpolators are the reverse of the ones used above, so swiping out of All
|
||||
// Apps feels the same as swiping into it.
|
||||
// TODO(b/231682175): centralize this setup in AllAppsSwipeController.
|
||||
builder.setInterpolator(ANIM_DEPTH, Interpolators.reverse(BLUR));
|
||||
builder.setInterpolator(ANIM_WORKSPACE_FADE, Interpolators.reverse(WORKSPACE_FADE));
|
||||
builder.setInterpolator(ANIM_WORKSPACE_SCALE, Interpolators.reverse(WORKSPACE_SCALE));
|
||||
builder.setInterpolator(ANIM_HOTSEAT_FADE, Interpolators.reverse(HOTSEAT_FADE));
|
||||
builder.setInterpolator(ANIM_HOTSEAT_SCALE, Interpolators.reverse(HOTSEAT_SCALE));
|
||||
builder.setInterpolator(ANIM_HOTSEAT_TRANSLATE,
|
||||
Interpolators.reverse(HOTSEAT_TRANSLATE));
|
||||
builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.reverse(SCRIM_FADE));
|
||||
builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.reverse(ALL_APPS_FADE));
|
||||
builder.setInterpolator(ANIM_VERTICAL_PROGRESS,
|
||||
Interpolators.reverse(ALL_APPS_VERTICAL_PROGRESS));
|
||||
}
|
||||
return builder;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected StateAnimationConfig getConfigForStates(
|
||||
LauncherState fromState, LauncherState toState) {
|
||||
final StateAnimationConfig config;
|
||||
final StateAnimationConfig config = new StateAnimationConfig();
|
||||
config.userControlled = true;
|
||||
if (fromState == NORMAL && toState == ALL_APPS) {
|
||||
config = getNormalToAllAppsAnimation();
|
||||
AllAppsSwipeController.applyNormalToAllAppsAnimConfig(mLauncher, config);
|
||||
} else if (fromState == ALL_APPS && toState == NORMAL) {
|
||||
config = getAllAppsToNormalAnimation();
|
||||
} else {
|
||||
config = new StateAnimationConfig();
|
||||
AllAppsSwipeController.applyAllAppsToNormalConfig(mLauncher, config);
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
@@ -47,48 +47,88 @@ import com.android.launcher3.states.StateAnimationConfig;
|
||||
*/
|
||||
public class AllAppsSwipeController extends AbstractStateChangeTouchController {
|
||||
|
||||
private static final float ALLAPPS_STAGGERED_FADE_THRESHOLD = 0.5f;
|
||||
private static final float ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD = 0.8f;
|
||||
private static final float ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD = 0.5f;
|
||||
private static final float ALL_APPS_SCRIM_VISIBLE_THRESHOLD = 0.1f;
|
||||
private static final float ALL_APPS_STAGGERED_FADE_THRESHOLD = 0.5f;
|
||||
|
||||
// Custom timing for NORMAL -> ALL_APPS on phones only.
|
||||
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;
|
||||
public static final Interpolator ALL_APPS_SCRIM_RESPONDER =
|
||||
Interpolators.clampToProgress(
|
||||
LINEAR, ALL_APPS_SCRIM_VISIBLE_THRESHOLD, ALL_APPS_STAGGERED_FADE_THRESHOLD);
|
||||
public static final Interpolator ALL_APPS_CLAMPING_RESPONDER =
|
||||
Interpolators.clampToProgress(
|
||||
LINEAR,
|
||||
1 - ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD,
|
||||
1 - ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD);
|
||||
|
||||
// ---- Custom interpolators for NORMAL -> ALL_APPS on phones only. ----
|
||||
|
||||
private static final float WORKSPACE_MOTION_START_ATOMIC = 0.1667f;
|
||||
private static final float ALL_APPS_STATE_TRANSITION_ATOMIC = 0.305f;
|
||||
private static final float ALL_APPS_STATE_TRANSITION_MANUAL = 0.4f;
|
||||
private static final float ALL_APPS_FADE_END_ATOMIC = 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);
|
||||
public static final Interpolator ALLAPPS_STAGGERED_FADE_LATE_RESPONDER =
|
||||
Interpolators.clampToProgress(LINEAR, ALLAPPS_STAGGERED_FADE_THRESHOLD, 1f);
|
||||
private static final Interpolator LINEAR_EARLY_MANUAL =
|
||||
Interpolators.clampToProgress(LINEAR, 0f, ALL_APPS_STATE_TRANSITION_MANUAL);
|
||||
private static final Interpolator STEP_TRANSITION_ATOMIC =
|
||||
Interpolators.clampToProgress(FINAL_FRAME, 0f, ALL_APPS_STATE_TRANSITION_ATOMIC);
|
||||
private static final Interpolator STEP_TRANSITION_MANUAL =
|
||||
Interpolators.clampToProgress(FINAL_FRAME, 0f, ALL_APPS_STATE_TRANSITION_MANUAL);
|
||||
|
||||
// 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 =
|
||||
private static final Interpolator BLUR_ADJUSTED =
|
||||
Interpolators.mapToProgress(LINEAR, 0f, ALL_APPS_FULL_DEPTH_PROGRESS);
|
||||
public static final Interpolator BLUR_ATOMIC =
|
||||
Interpolators.clampToProgress(
|
||||
Interpolators.mapToProgress(
|
||||
LINEAR, 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 =
|
||||
BLUR_ADJUSTED, WORKSPACE_MOTION_START_ATOMIC, ALL_APPS_STATE_TRANSITION_ATOMIC);
|
||||
public static final Interpolator BLUR_MANUAL =
|
||||
Interpolators.clampToProgress(BLUR_ADJUSTED, 0f, ALL_APPS_STATE_TRANSITION_MANUAL);
|
||||
|
||||
public static final Interpolator WORKSPACE_FADE_ATOMIC = STEP_TRANSITION_ATOMIC;
|
||||
public static final Interpolator WORKSPACE_FADE_MANUAL = STEP_TRANSITION_MANUAL;
|
||||
|
||||
public static final Interpolator WORKSPACE_SCALE_ATOMIC =
|
||||
Interpolators.clampToProgress(
|
||||
EMPHASIZED_ACCELERATE, WORKSPACE_MOTION_START, 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 =
|
||||
EMPHASIZED_ACCELERATE, WORKSPACE_MOTION_START_ATOMIC,
|
||||
ALL_APPS_STATE_TRANSITION_ATOMIC);
|
||||
public static final Interpolator WORKSPACE_SCALE_MANUAL = LINEAR_EARLY_MANUAL;
|
||||
|
||||
public static final Interpolator HOTSEAT_FADE_ATOMIC = STEP_TRANSITION_ATOMIC;
|
||||
public static final Interpolator HOTSEAT_FADE_MANUAL = STEP_TRANSITION_MANUAL;
|
||||
|
||||
public static final Interpolator HOTSEAT_SCALE_ATOMIC = STEP_TRANSITION_ATOMIC;
|
||||
public static final Interpolator HOTSEAT_SCALE_MANUAL = LINEAR_EARLY_MANUAL;
|
||||
|
||||
public static final Interpolator HOTSEAT_TRANSLATE_ATOMIC =
|
||||
Interpolators.clampToProgress(
|
||||
EMPHASIZED_ACCELERATE, WORKSPACE_MOTION_START, ALL_APPS_STATE_TRANSITION);
|
||||
public static final Interpolator SCRIM_FADE =
|
||||
EMPHASIZED_ACCELERATE, WORKSPACE_MOTION_START_ATOMIC,
|
||||
ALL_APPS_STATE_TRANSITION_ATOMIC);
|
||||
public static final Interpolator HOTSEAT_TRANSLATE_MANUAL = STEP_TRANSITION_MANUAL;
|
||||
|
||||
public static final Interpolator SCRIM_FADE_ATOMIC =
|
||||
Interpolators.clampToProgress(
|
||||
Interpolators.mapToProgress(LINEAR, 0f, 0.8f),
|
||||
WORKSPACE_MOTION_START, ALL_APPS_STATE_TRANSITION);
|
||||
public static final Interpolator ALL_APPS_FADE =
|
||||
WORKSPACE_MOTION_START_ATOMIC, ALL_APPS_STATE_TRANSITION_ATOMIC);
|
||||
public static final Interpolator SCRIM_FADE_MANUAL = LINEAR_EARLY_MANUAL;
|
||||
|
||||
public static final Interpolator ALL_APPS_FADE_ATOMIC =
|
||||
Interpolators.clampToProgress(
|
||||
Interpolators.mapToProgress(DECELERATED_EASE, 0.2f, 1.0f),
|
||||
ALL_APPS_STATE_TRANSITION, ALL_APPS_FADE_END);
|
||||
public static final Interpolator ALL_APPS_VERTICAL_PROGRESS =
|
||||
Interpolators.mapToProgress(DECELERATED_EASE, 0.2f, 1f),
|
||||
ALL_APPS_STATE_TRANSITION_ATOMIC, ALL_APPS_FADE_END_ATOMIC);
|
||||
public static final Interpolator ALL_APPS_FADE_MANUAL =
|
||||
Interpolators.clampToProgress(LINEAR, ALL_APPS_STATE_TRANSITION_MANUAL, 1f);
|
||||
|
||||
public static final Interpolator ALL_APPS_VERTICAL_PROGRESS_ATOMIC =
|
||||
Interpolators.clampToProgress(
|
||||
Interpolators.mapToProgress(EMPHASIZED_DECELERATE, 0.4f, 1.0f),
|
||||
ALL_APPS_STATE_TRANSITION, 1.0f);
|
||||
Interpolators.mapToProgress(EMPHASIZED_DECELERATE, 0.4f, 1f),
|
||||
ALL_APPS_STATE_TRANSITION_ATOMIC, 1f);
|
||||
public static final Interpolator ALL_APPS_VERTICAL_PROGRESS_MANUAL =
|
||||
Interpolators.clampToProgress(
|
||||
Interpolators.mapToProgress(LINEAR, ALL_APPS_STATE_TRANSITION_MANUAL, 1f),
|
||||
ALL_APPS_STATE_TRANSITION_MANUAL, 1f);
|
||||
|
||||
// --------
|
||||
|
||||
public AllAppsSwipeController(Launcher l) {
|
||||
super(l, SingleAxisSwipeDetector.VERTICAL);
|
||||
@@ -141,6 +181,7 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController {
|
||||
protected StateAnimationConfig getConfigForStates(LauncherState fromState,
|
||||
LauncherState toState) {
|
||||
StateAnimationConfig config = super.getConfigForStates(fromState, toState);
|
||||
config.userControlled = true;
|
||||
if (fromState == NORMAL && toState == ALL_APPS) {
|
||||
applyNormalToAllAppsAnimConfig(mLauncher, config);
|
||||
} else if (fromState == ALL_APPS && toState == NORMAL) {
|
||||
@@ -150,36 +191,75 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController {
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies Animation config values for transition from all apps to home
|
||||
* Applies Animation config values for transition from all apps to home.
|
||||
*/
|
||||
public static void applyAllAppsToNormalConfig(Launcher launcher, StateAnimationConfig config) {
|
||||
boolean isTablet = launcher.getDeviceProfile().isTablet;
|
||||
config.setInterpolator(ANIM_SCRIM_FADE, ALLAPPS_STAGGERED_FADE_LATE_RESPONDER);
|
||||
config.setInterpolator(ANIM_ALL_APPS_FADE, isTablet
|
||||
? FINAL_FRAME : ALLAPPS_STAGGERED_FADE_EARLY_RESPONDER);
|
||||
if (!isTablet) {
|
||||
config.setInterpolator(ANIM_WORKSPACE_FADE, INSTANT);
|
||||
if (launcher.getDeviceProfile().isTablet) {
|
||||
config.setInterpolator(ANIM_SCRIM_FADE,
|
||||
Interpolators.reverse(ALL_APPS_SCRIM_RESPONDER));
|
||||
config.setInterpolator(ANIM_ALL_APPS_FADE, FINAL_FRAME);
|
||||
if (!config.userControlled) {
|
||||
config.setInterpolator(ANIM_VERTICAL_PROGRESS, EMPHASIZED_ACCELERATE);
|
||||
}
|
||||
} else {
|
||||
if (config.userControlled) {
|
||||
config.setInterpolator(ANIM_DEPTH, Interpolators.reverse(BLUR_MANUAL));
|
||||
config.setInterpolator(ANIM_WORKSPACE_FADE,
|
||||
Interpolators.reverse(WORKSPACE_FADE_MANUAL));
|
||||
config.setInterpolator(ANIM_WORKSPACE_SCALE,
|
||||
Interpolators.reverse(WORKSPACE_SCALE_MANUAL));
|
||||
config.setInterpolator(ANIM_HOTSEAT_FADE,
|
||||
Interpolators.reverse(HOTSEAT_FADE_MANUAL));
|
||||
config.setInterpolator(ANIM_HOTSEAT_SCALE,
|
||||
Interpolators.reverse(HOTSEAT_SCALE_MANUAL));
|
||||
config.setInterpolator(ANIM_HOTSEAT_TRANSLATE,
|
||||
Interpolators.reverse(HOTSEAT_TRANSLATE_MANUAL));
|
||||
config.setInterpolator(ANIM_SCRIM_FADE, Interpolators.reverse(SCRIM_FADE_MANUAL));
|
||||
config.setInterpolator(ANIM_ALL_APPS_FADE,
|
||||
Interpolators.reverse(ALL_APPS_FADE_MANUAL));
|
||||
config.setInterpolator(ANIM_VERTICAL_PROGRESS,
|
||||
Interpolators.reverse(ALL_APPS_VERTICAL_PROGRESS_MANUAL));
|
||||
} else {
|
||||
config.setInterpolator(ANIM_SCRIM_FADE,
|
||||
Interpolators.reverse(ALL_APPS_SCRIM_RESPONDER));
|
||||
config.setInterpolator(ANIM_ALL_APPS_FADE, ALL_APPS_CLAMPING_RESPONDER);
|
||||
config.setInterpolator(ANIM_WORKSPACE_FADE, INSTANT);
|
||||
config.setInterpolator(ANIM_VERTICAL_PROGRESS, EMPHASIZED_ACCELERATE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies Animation config values for transition from home to all apps
|
||||
* Applies Animation config values for transition from home to all apps.
|
||||
*/
|
||||
public static void applyNormalToAllAppsAnimConfig(Launcher launcher,
|
||||
StateAnimationConfig config) {
|
||||
public static void applyNormalToAllAppsAnimConfig(
|
||||
Launcher launcher, StateAnimationConfig config) {
|
||||
if (launcher.getDeviceProfile().isTablet) {
|
||||
config.setInterpolator(ANIM_SCRIM_FADE, ALLAPPS_STAGGERED_FADE_EARLY_RESPONDER);
|
||||
config.setInterpolator(ANIM_ALL_APPS_FADE, INSTANT);
|
||||
config.setInterpolator(ANIM_SCRIM_FADE, ALL_APPS_SCRIM_RESPONDER);
|
||||
if (!config.userControlled) {
|
||||
config.setInterpolator(ANIM_VERTICAL_PROGRESS, EMPHASIZED_DECELERATE);
|
||||
}
|
||||
} 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);
|
||||
config.setInterpolator(ANIM_HOTSEAT_TRANSLATE, HOTSEAT_TRANSLATE);
|
||||
config.setInterpolator(ANIM_SCRIM_FADE, SCRIM_FADE);
|
||||
config.setInterpolator(ANIM_ALL_APPS_FADE, ALL_APPS_FADE);
|
||||
config.setInterpolator(ANIM_VERTICAL_PROGRESS, ALL_APPS_VERTICAL_PROGRESS);
|
||||
config.setInterpolator(ANIM_DEPTH, config.userControlled ? BLUR_MANUAL : BLUR_ATOMIC);
|
||||
config.setInterpolator(ANIM_WORKSPACE_FADE,
|
||||
config.userControlled ? WORKSPACE_FADE_MANUAL : WORKSPACE_FADE_ATOMIC);
|
||||
config.setInterpolator(ANIM_WORKSPACE_SCALE,
|
||||
config.userControlled ? WORKSPACE_SCALE_MANUAL : WORKSPACE_SCALE_ATOMIC);
|
||||
config.setInterpolator(ANIM_HOTSEAT_FADE,
|
||||
config.userControlled ? HOTSEAT_FADE_MANUAL : HOTSEAT_FADE_ATOMIC);
|
||||
config.setInterpolator(ANIM_HOTSEAT_SCALE,
|
||||
config.userControlled ? HOTSEAT_SCALE_MANUAL : HOTSEAT_SCALE_ATOMIC);
|
||||
config.setInterpolator(ANIM_HOTSEAT_TRANSLATE,
|
||||
config.userControlled ? HOTSEAT_TRANSLATE_MANUAL : HOTSEAT_TRANSLATE_ATOMIC);
|
||||
config.setInterpolator(ANIM_SCRIM_FADE,
|
||||
config.userControlled ? SCRIM_FADE_MANUAL : SCRIM_FADE_ATOMIC);
|
||||
config.setInterpolator(ANIM_ALL_APPS_FADE,
|
||||
config.userControlled ? ALL_APPS_FADE_MANUAL : ALL_APPS_FADE_ATOMIC);
|
||||
config.setInterpolator(ANIM_VERTICAL_PROGRESS,
|
||||
config.userControlled
|
||||
? ALL_APPS_VERTICAL_PROGRESS_MANUAL
|
||||
: ALL_APPS_VERTICAL_PROGRESS_ATOMIC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user