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

Commit 416ee425 authored by Chet Haase's avatar Chet Haase Committed by Android (Google) Code Review
Browse files

Merge "Fix ValueAnimator.getCurrentPlayTime()"

parents 10e8ff2b 4365e5a1
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -625,14 +625,19 @@ public class ValueAnimator extends Animator implements AnimationHandler.Animatio
    /**
     * Gets the current position of the animation in time, which is equal to the current
     * time minus the time that the animation started. An animation that is not yet started will
     * return a value of zero.
     * return a value of zero, unless the animation has has its play time set via
     * {@link #setCurrentPlayTime(long)} or {@link #setCurrentFraction(float)}, in which case
     * it will return the time that was set.
     *
     * @return The current position in time of the animation.
     */
    public long getCurrentPlayTime() {
        if (!mInitialized || !mStarted) {
        if (!mInitialized || (!mStarted && mSeekFraction < 0)) {
            return 0;
        }
        if (mSeekFraction >= 0) {
            return (long) (mUnscaledDuration * mSeekFraction);
        }
        return AnimationUtils.currentAnimationTimeMillis() - mStartTime;
    }