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

Commit e48ef2a3 authored by George Mount's avatar George Mount
Browse files

Cancel animation when target changes.

Bug 18201083

Change-Id: I2ea15063b18881c4b31ae6cdc287649dbc4a61f7
parent a68da938
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -885,7 +885,8 @@ public final class ObjectAnimator extends ValueAnimator {
    }

    /**
     * Sets the target object whose property will be animated by this animation
     * Sets the target object whose property will be animated by this animation. If the
     * animator has been started, it will be canceled.
     *
     * @param target The object being animated
     */
@@ -893,6 +894,9 @@ public final class ObjectAnimator extends ValueAnimator {
    public void setTarget(@Nullable Object target) {
        final Object oldTarget = getTarget();
        if (oldTarget != target) {
            if (isStarted()) {
                cancel();
            }
            mTarget = target == null ? null : new WeakReference<Object>(target);
            // New target should cause re-initialization prior to starting
            mInitialized = false;