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

Commit e8c8617c authored by Yigit Boyar's avatar Yigit Boyar Committed by Android (Google) Code Review
Browse files

Merge "Clone animators before running in StateListAnimator"

parents d271c1c0 de5a75ea
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;
        }
    }

    /**