mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 09:56:49 +00:00
Track OverviewToHomeAnim with StateManager
This way we mark the the current state as NORMAL at the start of the animation, and cancel it as part of other state transitions. This allows us to interact with launcher (e.g. to go to all apps or pull down the notification shade) during the animation. Also use OverviewToHomeAnim from RecentsView#startHome() to ensure the animation is consistent, e.g. doesn't fade out RecentsView, scrolls to page 1, etc. Bug: 144170434 Change-Id: I5348565b9e705d8ffba39818dde9efe82b16bb7a
This commit is contained in:
@@ -312,7 +312,13 @@ public class StateManager<STATE_TYPE extends BaseState<STATE_TYPE>> {
|
||||
handler.setStateWithAnimation(state, mConfig, builder);
|
||||
}
|
||||
}
|
||||
builder.addListener(new AnimationSuccessListener() {
|
||||
builder.addListener(createStateAnimationListener(state));
|
||||
mConfig.setAnimation(builder.buildAnim(), state);
|
||||
return builder;
|
||||
}
|
||||
|
||||
private AnimatorListener createStateAnimationListener(STATE_TYPE state) {
|
||||
return new AnimationSuccessListener() {
|
||||
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
@@ -327,9 +333,7 @@ public class StateManager<STATE_TYPE extends BaseState<STATE_TYPE>> {
|
||||
}
|
||||
onStateTransitionEnd(state);
|
||||
}
|
||||
});
|
||||
mConfig.setAnimation(builder.buildAnim(), state);
|
||||
return builder;
|
||||
};
|
||||
}
|
||||
|
||||
private void onStateTransitionStart(STATE_TYPE state) {
|
||||
@@ -396,6 +400,19 @@ public class StateManager<STATE_TYPE extends BaseState<STATE_TYPE>> {
|
||||
mConfig.playbackController = controller;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #setCurrentAnimation(AnimatorSet, Animator...). Using this method tells the StateManager
|
||||
* that this is a custom animation to the given state, and thus the StateManager will add an
|
||||
* animation listener to call {@link #onStateTransitionStart} and {@link #onStateTransitionEnd}.
|
||||
* @param anim The custom animation to the given state.
|
||||
* @param toState The state we are animating towards.
|
||||
*/
|
||||
public void setCurrentAnimation(AnimatorSet anim, STATE_TYPE toState) {
|
||||
cancelAnimation();
|
||||
setCurrentAnimation(anim);
|
||||
anim.addListener(createStateAnimationListener(toState));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the animation as the current state animation, i.e., canceled when
|
||||
* starting another animation and may block some launcher interactions while running.
|
||||
|
||||
Reference in New Issue
Block a user