Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d754dcd5 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Only skip the animation, if we are going to the same state

Bug: 77487950
Change-Id: I2d3e376094b0fb0d3120ab6c4d6569f52ab8273f
parent fd21de44
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ public class LauncherStateManager {
                    onCompleteRunnable.run();
                }
                return;
            } else if (!mConfig.userControlled && animated) {
            } else if (!mConfig.userControlled && animated && mConfig.mTargetState == state) {
                // We are running the same animation as requested
                if (onCompleteRunnable != null) {
                    mConfig.mCurrentAnimation.addListener(new AnimationSuccessListener() {
@@ -280,7 +280,7 @@ public class LauncherStateManager {
                onStateTransitionEnd(state);
            }
        });
        mConfig.setAnimation(animation);
        mConfig.setAnimation(animation, state);
        return mConfig.mCurrentAnimation;
    }

@@ -370,7 +370,7 @@ public class LauncherStateManager {
        if (reapplyNeeded) {
            reapplyState();
        }
        mConfig.setAnimation(anim);
        mConfig.setAnimation(anim, null);
    }

    private class StartAnimRunnable implements Runnable {
@@ -401,11 +401,13 @@ public class LauncherStateManager {
        private PropertySetter mProperSetter;

        private AnimatorSet mCurrentAnimation;
        private LauncherState mTargetState;

        public void reset() {
            duration = 0;
            userControlled = false;
            mProperSetter = null;
            mTargetState = null;

            if (mCurrentAnimation != null) {
                mCurrentAnimation.setDuration(0);
@@ -429,8 +431,9 @@ public class LauncherStateManager {
            }
        }

        public void setAnimation(AnimatorSet animation) {
        public void setAnimation(AnimatorSet animation, LauncherState targetState) {
            mCurrentAnimation = animation;
            mTargetState = targetState;
            mCurrentAnimation.addListener(this);
        }
    }