Update interpolators and durations for state animations

When we enter overview (overview appears, workspace disappears):
- Workspace scales down from 1f to .8f with OvershootInterpolator(1.2f) at 200 ms
- Workspace fades from 1f to 0 with OvershootInterpolator(1.2f) at 200 ms
- Overview scales down from 1.33f to 1f with OvershootInterpolator(1.2f) at 200 ms
- Overview fades from 0 to 1f with OvershootInterpolator(1.2f) at 200 ms

When we exit overview (overview disappears, workspace appears):
- Workspace scales up from .92f to .1f with DecelerateInterpolator() at 200 ms
- Workspace fades from 0 to 1f with AccelerateInterpolator() at 200 ms
- Overview scales up from 1f to 1.1f with AccelerateInterpolator() at 180ms
- Overview fades from 1f to 0 with DecelerateInterpolator(1.7f) at 200 ms

Parallax while the finger moves: Workspace translates half the distance as the shelf

Bug: 79776746
Change-Id: I319d982cf202bcd6dbbcd68ffc5c0c7853629c7e
This commit is contained in:
Tony Wickham
2018-05-16 12:23:12 -07:00
parent 07b8b0b1f0
commit b2ddf10041
13 changed files with 119 additions and 41 deletions

View File

@@ -64,8 +64,7 @@ public abstract class AbstractStateChangeTouchController
* Play an atomic recents animation when the progress from NORMAL to OVERVIEW reaches this.
*/
public static final float ATOMIC_OVERVIEW_ANIM_THRESHOLD = 0.5f;
private static final long ATOMIC_NORMAL_TO_OVERVIEW_DURATION = 120;
private static final long ATOMIC_OVERVIEW_TO_NORMAL_DURATION = 200;
protected static final long ATOMIC_DURATION = 200;
protected final Launcher mLauncher;
protected final SwipeDetector mDetector;
@@ -213,7 +212,7 @@ public abstract class AbstractStateChangeTouchController
mAtomicComponentsStartProgress = mCurrentAnimation.getProgressFraction();
long duration = (long) (getShiftRange() * 2);
mAtomicComponentsController = AnimatorPlaybackController.wrap(
createAtomicAnimForState(mToState, duration), duration);
createAtomicAnimForState(mFromState, mToState, duration), duration);
mAtomicComponentsController.dispatchOnStart();
}
});
@@ -295,14 +294,13 @@ public abstract class AbstractStateChangeTouchController
: 1f - ATOMIC_OVERVIEW_ANIM_THRESHOLD;
boolean passedThreshold = progress >= threshold;
if (passedThreshold != mPassedOverviewAtomicThreshold) {
LauncherState targetState = passedThreshold ? toState : fromState;
LauncherState atomicFromState = passedThreshold ? fromState: toState;
LauncherState atomicToState = passedThreshold ? toState : fromState;
mPassedOverviewAtomicThreshold = passedThreshold;
if (mAtomicAnim != null) {
mAtomicAnim.cancel();
}
long duration = targetState == OVERVIEW ? ATOMIC_NORMAL_TO_OVERVIEW_DURATION
: ATOMIC_OVERVIEW_TO_NORMAL_DURATION;
mAtomicAnim = createAtomicAnimForState(targetState, duration);
mAtomicAnim = createAtomicAnimForState(atomicFromState, atomicToState, ATOMIC_DURATION);
mAtomicAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
@@ -314,8 +312,10 @@ public abstract class AbstractStateChangeTouchController
}
}
private AnimatorSet createAtomicAnimForState(LauncherState targetState, long duration) {
private AnimatorSet createAtomicAnimForState(LauncherState fromState, LauncherState targetState,
long duration) {
AnimatorSetBuilder builder = new AnimatorSetBuilder();
mLauncher.getStateManager().prepareForAtomicAnimation(fromState, targetState, builder);
AnimationConfig config = new AnimationConfig();
config.animComponents = ATOMIC_COMPONENT;
config.duration = duration;