From f0c7966a77f0a62896921b2174e18516fd02a15a Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Tue, 12 May 2020 16:20:04 -0500 Subject: [PATCH] Only set spring end value if animation wasn't canceled Animations should only be canceled (as opposed to ended) if the caller is intending to update the state from there. In that case, we shouldn't jump to the end value. Bug: 155335494 Change-Id: I93a21f0e2e1923ccdfab890adcb58c49ceb98a28 --- src/com/android/launcher3/anim/SpringAnimationBuilder.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/com/android/launcher3/anim/SpringAnimationBuilder.java b/src/com/android/launcher3/anim/SpringAnimationBuilder.java index 770df034fb..a9702b4784 100644 --- a/src/com/android/launcher3/anim/SpringAnimationBuilder.java +++ b/src/com/android/launcher3/anim/SpringAnimationBuilder.java @@ -18,7 +18,6 @@ package com.android.launcher3.anim; import static com.android.launcher3.anim.Interpolators.LINEAR; import android.animation.Animator; -import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.content.Context; import android.util.FloatProperty; @@ -197,9 +196,9 @@ public class SpringAnimationBuilder { animator.setDuration(getDuration()).setInterpolator(LINEAR); animator.addUpdateListener(anim -> property.set(target, getInterpolatedValue(anim.getAnimatedFraction()))); - animator.addListener(new AnimatorListenerAdapter() { + animator.addListener(new AnimationSuccessListener() { @Override - public void onAnimationEnd(Animator animation) { + public void onAnimationSuccess(Animator animation) { property.set(target, mEndValue); } });