From 21cdbd298d937a99e61b80775f04d4882dce683a Mon Sep 17 00:00:00 2001 From: Yigit Boyar Date: Mon, 18 May 2015 23:38:41 +0000 Subject: [PATCH] Revert "Make VPA.setInterpolator(null) unset the interpolator." This reverts commit 58ae164100060d1b8a9709aeea7a2b488ff0ac98. Change-Id: I6d9942b41694f6a5e6c211df839aa385eea0c496 --- core/java/android/view/ViewPropertyAnimator.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/core/java/android/view/ViewPropertyAnimator.java b/core/java/android/view/ViewPropertyAnimator.java index 13b4583e3af93..b73b9fa07933e 100644 --- a/core/java/android/view/ViewPropertyAnimator.java +++ b/core/java/android/view/ViewPropertyAnimator.java @@ -82,11 +82,17 @@ public class ViewPropertyAnimator { /** * The interpolator of the underlying Animator object. By default, we don't set the interpolator - * on the Animator and just use its default interpolator. If the interpolator is set to a - * non-null value on this Animator, then we use the interpolator that it was set to. + * on the Animator and just use its default interpolator. If the interpolator is ever set on + * this Animator, then we use the interpolator that it was set to. */ private TimeInterpolator mInterpolator; + /** + * A flag indicating whether the interpolator has been set on this object. If not, we don't set + * the interpolator on the underlying Animator, but instead just use its default interpolator. + */ + private boolean mInterpolatorSet = false; + /** * Listener for the lifecycle events of the underlying ValueAnimator object. */ @@ -334,6 +340,7 @@ public class ViewPropertyAnimator { * @return This object, allowing calls to methods in this class to be chained. */ public ViewPropertyAnimator setInterpolator(TimeInterpolator interpolator) { + mInterpolatorSet = true; mInterpolator = interpolator; return this; } @@ -344,7 +351,7 @@ public class ViewPropertyAnimator { * @return The timing interpolator for this animation. */ public TimeInterpolator getInterpolator() { - if (mInterpolator != null) { + if (mInterpolatorSet) { return mInterpolator; } else { // Just return the default from ValueAnimator, since that's what we'd get if @@ -892,7 +899,7 @@ public class ViewPropertyAnimator { if (mDurationSet) { animator.setDuration(mDuration); } - if (mInterpolator != null) { + if (mInterpolatorSet) { animator.setInterpolator(mInterpolator); } animator.start();