diff options
author | Doris Liu <tianliu@google.com> | 2015-04-01 10:27:40 -0700 |
---|---|---|
committer | Doris Liu <tianliu@google.com> | 2015-04-02 16:28:40 -0700 |
commit | 6aac06ab940566020d050fdaa0d5e8d2e6c128ae (patch) | |
tree | 03d336fd8f2643f34a93ae1eedf624367f443c3c /core/java/android/animation | |
parent | b929d65800fcc91c04d385fe9ec23a924868883b (diff) | |
download | frameworks_base-6aac06ab940566020d050fdaa0d5e8d2e6c128ae.zip frameworks_base-6aac06ab940566020d050fdaa0d5e8d2e6c128ae.tar.gz frameworks_base-6aac06ab940566020d050fdaa0d5e8d2e6c128ae.tar.bz2 |
Add per-interval interpolation support for keyframe in xml resources
Bug: 19913234
Change-Id: Ie46af02b2db3dad6ace667480aa556e0f645d278
Diffstat (limited to 'core/java/android/animation')
-rw-r--r-- | core/java/android/animation/AnimatorInflater.java | 5 | ||||
-rw-r--r-- | core/java/android/animation/ObjectAnimator.java | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/core/java/android/animation/AnimatorInflater.java b/core/java/android/animation/AnimatorInflater.java index 021194c..81a01ee 100644 --- a/core/java/android/animation/AnimatorInflater.java +++ b/core/java/android/animation/AnimatorInflater.java @@ -947,6 +947,11 @@ public class AnimatorInflater { Keyframe.ofInt(fraction); } + final int resID = a.getResourceId(R.styleable.Keyframe_interpolator, 0); + if (resID > 0) { + final Interpolator interpolator = AnimationUtils.loadInterpolator(res, theme, resID); + keyframe.setInterpolator(interpolator); + } a.recycle(); return keyframe; diff --git a/core/java/android/animation/ObjectAnimator.java b/core/java/android/animation/ObjectAnimator.java index 3f71d51..f933373 100644 --- a/core/java/android/animation/ObjectAnimator.java +++ b/core/java/android/animation/ObjectAnimator.java @@ -50,9 +50,11 @@ import java.lang.ref.WeakReference; * value. Alternatively, you can leave the fractions off and the keyframes will be equally * distributed within the total duration. Also, a keyframe with no value will derive its value * from the target object when the animator starts, just like animators with only one - * value specified.</p> + * value specified. In addition, an optional interpolator can be specified. The interpolator will + * be applied on the interval between the keyframe that the interpolator is set on and the previous + * keyframe. When no interpolator is supplied, the default linear interpolator will be used. </p> * - * {@sample development/samples/ApiDemos/res/anim/object_animator_pvh_kf.xml KeyframeResources} + * {@sample development/samples/ApiDemos/res/anim/object_animator_pvh_kf_interpolated.xml KeyframeResources} * * <div class="special reference"> * <h3>Developer Guides</h3> |