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

Commit 1dfe35b8 authored by Doris Liu's avatar Doris Liu Committed by Android (Google) Code Review
Browse files

Merge "Skip to end for 0-duration animation" into nyc-dev

parents 2d135ab1 56b0b570
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -1200,13 +1200,17 @@ public class ValueAnimator extends Animator implements AnimationHandler.Animatio
    boolean animateBasedOnTime(long currentTime) {
        boolean done = false;
        if (mRunning) {
            final float fraction = getScaledDuration() > 0 ?
                    (float)(currentTime - mStartTime) / getScaledDuration() : 1f;
            final long scaledDuration = getScaledDuration();
            final float fraction = scaledDuration > 0 ?
                    (float)(currentTime - mStartTime) / scaledDuration : 1f;
            final float lastFraction = mOverallFraction;
            final boolean newIteration = (int) fraction > (int) lastFraction;
            final boolean lastIterationFinished = (fraction >= mRepeatCount + 1) &&
                    (mRepeatCount != INFINITE);
            if (newIteration && !lastIterationFinished) {
            if (scaledDuration == 0) {
                // 0 duration animator, ignore the repeat count and skip to the end
                done = true;
            } else if (newIteration && !lastIterationFinished) {
                // Time to repeat
                if (mListeners != null) {
                    int numListeners = mListeners.size();