diff options
author | John Reck <jreck@google.com> | 2014-07-01 08:34:47 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2014-07-01 09:39:54 -0700 |
commit | a0b13bddb282b6b177c7756dcc8ff006eb8fc971 (patch) | |
tree | 72667643b0856292959a5c25e85d67e30514e36a | |
parent | d907e5b1efeae51c302fd502f42a06bd16d6cae3 (diff) | |
download | frameworks_base-a0b13bddb282b6b177c7756dcc8ff006eb8fc971.zip frameworks_base-a0b13bddb282b6b177c7756dcc8ff006eb8fc971.tar.gz frameworks_base-a0b13bddb282b6b177c7756dcc8ff006eb8fc971.tar.bz2 |
ViewPropAnimRT fixes
* Fixes NPE in isNativeInterpolator
* Fixes null interpolator to mean LinearInterpolator instead of
the default interpolator which is AccelerateDecelerateInterpolator
Bug: 15991759
Change-Id: I66ff27154de1e227a07daaebc0519ee3cc0dd38f
-rw-r--r-- | core/java/android/view/ViewPropertyAnimator.java | 3 | ||||
-rw-r--r-- | core/java/android/view/ViewPropertyAnimatorRT.java | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/core/java/android/view/ViewPropertyAnimator.java b/core/java/android/view/ViewPropertyAnimator.java index 3f72b4c..4ca5863 100644 --- a/core/java/android/view/ViewPropertyAnimator.java +++ b/core/java/android/view/ViewPropertyAnimator.java @@ -338,7 +338,8 @@ public class ViewPropertyAnimator { * By default, the animator uses the default interpolator for ValueAnimator. Calling this method * will cause the declared object to be used instead. * - * @param interpolator The TimeInterpolator to be used for ensuing property animations. + * @param interpolator The TimeInterpolator to be used for ensuing property animations. A value + * of <code>null</code> will result in linear interpolation. * @return This object, allowing calls to methods in this class to be chained. */ public ViewPropertyAnimator setInterpolator(TimeInterpolator interpolator) { diff --git a/core/java/android/view/ViewPropertyAnimatorRT.java b/core/java/android/view/ViewPropertyAnimatorRT.java index 8b4277a..31b360c 100644 --- a/core/java/android/view/ViewPropertyAnimatorRT.java +++ b/core/java/android/view/ViewPropertyAnimatorRT.java @@ -18,6 +18,8 @@ package android.view; import android.animation.TimeInterpolator; import android.view.ViewPropertyAnimator.NameValuesHolder; +import android.view.animation.Interpolator; +import android.view.animation.LinearInterpolator; import com.android.internal.view.animation.FallbackLUTInterpolator; @@ -29,6 +31,8 @@ import java.util.ArrayList; */ class ViewPropertyAnimatorRT { + private static final Interpolator sLinearInterpolator = new LinearInterpolator(); + private final View mView; private RenderNodeAnimator mAnimators[] = new RenderNodeAnimator[RenderNodeAnimator.LAST_VALUE + 1]; @@ -65,6 +69,10 @@ class ViewPropertyAnimatorRT { long startDelay = parent.getStartDelay(); long duration = parent.getDuration(); TimeInterpolator interpolator = parent.getInterpolator(); + if (interpolator == null) { + // Documented to be LinearInterpolator in ValueAnimator.setInterpolator + interpolator = sLinearInterpolator; + } if (!RenderNodeAnimator.isNativeInterpolator(interpolator)) { interpolator = new FallbackLUTInterpolator(interpolator, duration); } |