Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6aac06ab authored by Doris Liu's avatar Doris Liu
Browse files

Add per-interval interpolation support for keyframe in xml resources

Bug: 19913234
Change-Id: Ie46af02b2db3dad6ace667480aa556e0f645d278
parent b929d658
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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;
+4 −2
Original line number Diff line number Diff line
@@ -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>
+3 −0
Original line number Diff line number Diff line
@@ -5961,6 +5961,9 @@
        <attr name="valueType" />
        <attr name="value" />
        <attr name="fraction" format="float" />
        <!-- Defines a per-interval interpolator for this keyframe. This interpolator will be used
             to interpolate between this keyframe and the previous keyframe.-->
        <attr name="interpolator" />
    </declare-styleable>

    <!-- ========================== -->