diff options
author | Tony <twickham@google.com> | 2019-03-20 12:38:35 -0500 |
---|---|---|
committer | Tony <twickham@google.com> | 2019-03-27 19:45:04 -0500 |
commit | 1787ee9596f0906fe639a577d95090ff92617274 (patch) | |
tree | f432b254daf3686272b150925f3a4da70c1d31e5 /src/com/android/launcher3/touch | |
parent | cb15a24cfe4c5d9efd7b690b6be41e032a46f08d (diff) | |
download | android_packages_apps_Trebuchet-1787ee9596f0906fe639a577d95090ff92617274.tar.gz android_packages_apps_Trebuchet-1787ee9596f0906fe639a577d95090ff92617274.tar.bz2 android_packages_apps_Trebuchet-1787ee9596f0906fe639a577d95090ff92617274.zip |
Peek overview on motion pause, then animate fully on touch up
Add AnimationComponents.ATOMIC_OVERVIEW_PEEK_COMPONENT, and rename
previous ATOMIC_COMPONENT to ATOMIC_OVERVIEW_SCALE_COMPONENT.
When SWIPE_HOME is enabled:
- Overview lives to the left of Workspace, which is encoded in
LauncherState.NORMAL.getOverviewScaleAndTranslation().
- Create atomic animation based on ATOMIC_OVERVIEW_PEEK_COMPONENT
and OVERVIEW_PEEK state when swiping and holding from home screen.
Bug: 111926330
Change-Id: Iab6dbef7238dae15b3036d4b2a026b781eee6b4b
Diffstat (limited to 'src/com/android/launcher3/touch')
-rw-r--r-- | src/com/android/launcher3/touch/AbstractStateChangeTouchController.java | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java index c125c10d7..86deb43e0 100644 --- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java +++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java @@ -20,7 +20,7 @@ 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.LauncherStateManager.ANIM_ALL; -import static com.android.launcher3.LauncherStateManager.ATOMIC_COMPONENT; +import static com.android.launcher3.LauncherStateManager.ATOMIC_OVERVIEW_SCALE_COMPONENT; import static com.android.launcher3.LauncherStateManager.NON_ATOMIC_COMPONENT; import static com.android.launcher3.Utilities.SINGLE_FRAME_MS; import static com.android.launcher3.anim.Interpolators.scrollInterpolatorForVelocity; @@ -38,9 +38,6 @@ import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAnimUtils; import com.android.launcher3.LauncherState; import com.android.launcher3.LauncherStateManager.AnimationComponents; -import com.android.launcher3.LauncherStateManager.AnimationConfig; -import com.android.launcher3.LauncherStateManager.StateHandler; -import com.android.launcher3.TestProtocol; import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.anim.AnimatorPlaybackController; @@ -68,7 +65,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; - protected static final long ATOMIC_DURATION = 200; + protected final long ATOMIC_DURATION = getAtomicDuration(); protected final Launcher mLauncher; protected final SwipeDetector mDetector; @@ -110,6 +107,10 @@ public abstract class AbstractStateChangeTouchController mDetector = new SwipeDetector(l, this, dir); } + protected long getAtomicDuration() { + return 200; + } + protected abstract boolean canInterceptTouch(MotionEvent ev); @Override @@ -214,7 +215,7 @@ public abstract class AbstractStateChangeTouchController } if (mAtomicComponentsController != null) { - animComponents &= ~ATOMIC_COMPONENT; + animComponents &= ~ATOMIC_OVERVIEW_SCALE_COMPONENT; } mProgressMultiplier = initCurrentAnimation(animComponents); mCurrentAnimation.dispatchOnStart(); @@ -297,7 +298,7 @@ public abstract class AbstractStateChangeTouchController * When going between normal and overview states, see if we passed the overview threshold and * play the appropriate atomic animation if so. */ - protected void maybeUpdateAtomicAnim(LauncherState fromState, LauncherState toState, + private void maybeUpdateAtomicAnim(LauncherState fromState, LauncherState toState, float progress) { if (!goingBetweenNormalAndOverview(fromState, toState)) { return; @@ -347,14 +348,8 @@ public abstract class AbstractStateChangeTouchController private AnimatorSet createAtomicAnimForState(LauncherState fromState, LauncherState targetState, long duration) { AnimatorSetBuilder builder = getAnimatorSetBuilderForStates(fromState, targetState); - mLauncher.getStateManager().prepareForAtomicAnimation(fromState, targetState, builder); - AnimationConfig config = new AnimationConfig(); - config.animComponents = ATOMIC_COMPONENT; - config.duration = duration; - for (StateHandler handler : mLauncher.getStateManager().getStateHandlers()) { - handler.setStateWithAnimation(targetState, builder, config); - } - return builder.build(); + return mLauncher.getStateManager().createAtomicAnimation(fromState, targetState, builder, + ATOMIC_OVERVIEW_SCALE_COMPONENT, duration); } protected AnimatorSetBuilder getAnimatorSetBuilderForStates(LauncherState fromState, @@ -434,11 +429,7 @@ public abstract class AbstractStateChangeTouchController mLauncher.getAppsView().addSpringFromFlingUpdateListener(anim, velocity); } anim.start(); - settleAtomicAnimation(endProgress, anim.getDuration()); - } - - protected void settleAtomicAnimation(float endProgress, long duration) { - mAtomicAnimAutoPlayInfo = new AutoPlayAtomicAnimationInfo(endProgress, duration); + mAtomicAnimAutoPlayInfo = new AutoPlayAtomicAnimationInfo(endProgress, anim.getDuration()); maybeAutoPlayAtomicComponentsAnim(); } |