diff --git a/lottie/src/main/java/com/airbnb/lottie/utils/LottieValueAnimator.java b/lottie/src/main/java/com/airbnb/lottie/utils/LottieValueAnimator.java index a5fff5a64f..10d90eeffa 100644 --- a/lottie/src/main/java/com/airbnb/lottie/utils/LottieValueAnimator.java +++ b/lottie/src/main/java/com/airbnb/lottie/utils/LottieValueAnimator.java @@ -105,18 +105,14 @@ public void setUseCompositionFrameRate(boolean useCompositionFrameRate) { lastFrameTimeNs = frameTimeNanos; - if (!useCompositionFrameRate || frameRaw != previousFrameRaw) { - notifyUpdate(); - } if (ended) { if (getRepeatCount() != INFINITE && repeatCount >= getRepeatCount()) { frameRaw = speed < 0 ? getMinFrame() : getMaxFrame(); frame = frameRaw; removeFrameCallback(); + checkNotifyUpdate(previousFrameRaw); notifyEnd(isReversed()); } else { - notifyRepeat(); - repeatCount++; if (getRepeatMode() == REVERSE) { speedReversedForRepeatMode = !speedReversedForRepeatMode; reverseAnimationSpeed(); @@ -125,7 +121,12 @@ public void setUseCompositionFrameRate(boolean useCompositionFrameRate) { frame = frameRaw; } lastFrameTimeNs = frameTimeNanos; + checkNotifyUpdate(previousFrameRaw); + notifyRepeat(); + repeatCount++; } + } else { + checkNotifyUpdate(previousFrameRaw); } verifyFrame(); @@ -134,6 +135,12 @@ public void setUseCompositionFrameRate(boolean useCompositionFrameRate) { } } + private void checkNotifyUpdate(float previousFrameRaw) { + if (!useCompositionFrameRate || frameRaw != previousFrameRaw) { + notifyUpdate(); + } + } + private float getFrameDurationNs() { if (composition == null) { return Float.MAX_VALUE;