mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 18:58:19 +00:00
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
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user