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

Commit de5a75ea authored by Yigit Boyar's avatar Yigit Boyar
Browse files

Clone animators before running in StateListAnimator

Bug: 15678925
Change-Id: I81d88c08d515b90b3105936c2d665b417483dfe1
parent 9cf22309
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@ public class StateListAnimator {
            return;
        }
        if (mLastMatch != null) {
            cancel(mLastMatch);
            cancel();
        }
        mLastMatch = match;
        if (match != null) {
@@ -151,13 +151,15 @@ public class StateListAnimator {

    private void start(Tuple match) {
        match.mAnimator.setTarget(getTarget());
        mRunningAnimator = match.mAnimator;
        match.mAnimator.start();
        mRunningAnimator = match.mAnimator.clone();
        mRunningAnimator.start();
    }

    private void cancel(Tuple lastMatch) {
        lastMatch.mAnimator.cancel();
        lastMatch.mAnimator.setTarget(null);
    private void cancel() {
        if (mRunningAnimator != null) {
            mRunningAnimator.cancel();
            mRunningAnimator = null;
        }
    }

    /**