diff options
| author | 2013-07-25 14:52:31 -0700 | |
|---|---|---|
| committer | 2013-07-25 14:52:31 -0700 | |
| commit | d766d71a4ccb2d2a6966b2319f272f64fdcbfa7d (patch) | |
| tree | 9bf8be5dce5275e29238bf1c518570ef1e5e1df9 | |
| parent | 240966faf796378530d9c485d6e5fdb370ba68da (diff) | |
| parent | d547bcec5634f99195a2b12522b6977f61c40d55 (diff) | |
am d547bcec: Merge "Return the actual interpolator of the ViewPropertyAnimator"
* commit 'd547bcec5634f99195a2b12522b6977f61c40d55':
Return the actual interpolator of the ViewPropertyAnimator
| -rw-r--r-- | core/java/android/view/ViewPropertyAnimator.java | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/core/java/android/view/ViewPropertyAnimator.java b/core/java/android/view/ViewPropertyAnimator.java index 71a85bc7a2f5..e6bf420acccc 100644 --- a/core/java/android/view/ViewPropertyAnimator.java +++ b/core/java/android/view/ViewPropertyAnimator.java @@ -98,6 +98,12 @@ public class ViewPropertyAnimator { private Animator.AnimatorListener mListener = null; /** + * A lazily-created ValueAnimator used in order to get some default animator properties + * (duration, start delay, interpolator, etc.). + */ + private ValueAnimator mTempValueAnimator; + + /** * This listener is the mechanism by which the underlying Animator causes changes to the * properties currently being animated, as well as the cleanup after an animation is * complete. @@ -268,7 +274,10 @@ public class ViewPropertyAnimator { } else { // Just return the default from ValueAnimator, since that's what we'd get if // the value has not been set otherwise - return new ValueAnimator().getDuration(); + if (mTempValueAnimator == null) { + mTempValueAnimator = new ValueAnimator(); + } + return mTempValueAnimator.getDuration(); } } @@ -328,7 +337,16 @@ public class ViewPropertyAnimator { * @return The timing interpolator for this animation. */ public TimeInterpolator getInterpolator() { - return null; + if (mInterpolatorSet) { + return mInterpolator; + } else { + // Just return the default from ValueAnimator, since that's what we'd get if + // the value has not been set otherwise + if (mTempValueAnimator == null) { + mTempValueAnimator = new ValueAnimator(); + } + return mTempValueAnimator.getInterpolator(); + } } /** |