Skipping resetting transition if the same transition is running

Bug: 73838765
Change-Id: I1a428f1b5d5b04397a317e0f35f3effb53c24405
This commit is contained in:
Sunny Goyal committed 2018-03-01 10:25:55 -08:00
1 parent 43936eb05c
commit f58e0df0ab
1 file changed
+19 -6
@@ -162,13 +162,26 @@ public class LauncherStateManager {
}
public void goToState(LauncherState state, boolean animated, long delay, long overrideDuration,
Runnable onCompleteRunnable) {
if (mLauncher.isInState(state) && mConfig.mCurrentAnimation == null) {
// Run any queued runnable
if (onCompleteRunnable != null) {
onCompleteRunnable.run();
final Runnable onCompleteRunnable) {
if (mLauncher.isInState(state)) {
if (mConfig.mCurrentAnimation == null) {
// Run any queued runnable
if (onCompleteRunnable != null) {
onCompleteRunnable.run();
}
return;
} else if (!mConfig.userControlled && animated) {
// We are running the same animation as requested
if (onCompleteRunnable != null) {
mConfig.mCurrentAnimation.addListener(new AnimationSuccessListener() {
@Override
public void onAnimationSuccess(Animator animator) {
onCompleteRunnable.run();
}
});
}
return;
}
return;
}
// Cancel the current animation