/**@class android.graphics.drawable.AnimatedVectorDrawable implements android.graphics.drawable.Animatable2 @extends android.graphics.drawable.Drawable This class animates properties of a {@link android.graphics.drawable.VectorDrawable} with animations defined using {@link android.animation.ObjectAnimator} or {@link android.animation.AnimatorSet}. <p> Starting from API 25, AnimatedVectorDrawable runs on RenderThread (as opposed to on UI thread for earlier APIs). This means animations in AnimatedVectorDrawable can remain smooth even when there is heavy workload on the UI thread. Note: If the UI thread is unresponsive, RenderThread may continue animating until the UI thread is capable of pushing another frame. Therefore, it is not possible to precisely coordinate a RenderThread-enabled AnimatedVectorDrawable with UI thread animations. Additionally, {@link android.graphics.drawable.Animatable2.AnimationCallback#onAnimationEnd(Drawable)} will be called the frame after the AnimatedVectorDrawable finishes on the RenderThread. </p> <p> AnimatedVectorDrawable can be defined in either <a href="#ThreeXML">three separate XML files</a>, or <a href="#OneXML">one XML</a>. </p> <a name="ThreeXML"></a> <h3>Define an AnimatedVectorDrawable in three separate XML files</h3> <ul> <a name="VDExample"></a> <li><h4>XML for the VectorDrawable containing properties to be animated</h4> <p> Animations can be performed on the animatable attributes in {@link android.graphics.drawable.VectorDrawable}. These attributes will be animated by {@link android.animation.ObjectAnimator}. The ObjectAnimator's target can be the root element, a group element or a path element. The targeted elements need to be named uniquely within the same VectorDrawable. Elements without animation do not need to be named. </p> <p> Here are all the animatable attributes in {@link android.graphics.drawable.VectorDrawable}: <table border="2" align="center" cellpadding="5"> <thead> <tr> <th>Element Name</th> <th>Animatable attribute name</th> </tr> </thead> <tr> <td><vector></td> <td>alpha</td> </tr> <tr> <td rowspan="7"><group></td> <td>rotation</td> </tr> <tr> <td>pivotX</td> </tr> <tr> <td>pivotY</td> </tr> <tr> <td>scaleX</td> </tr> <tr> <td>scaleY</td> </tr> <tr> <td>translateX</td> </tr> <tr> <td>translateY</td> </tr> <tr> <td rowspan="9"><path></td> <td>pathData</td> </tr> <tr> <td>fillColor</td> </tr> <tr> <td>strokeColor</td> </tr> <tr> <td>strokeWidth</td> </tr> <tr> <td>strokeAlpha</td> </tr> <tr> <td>fillAlpha</td> </tr> <tr> <td>trimPathStart</td> </tr> <tr> <td>trimPathEnd</td> </tr> <tr> <td>trimPathOffset</td> </tr> <tr> <td><clip-path></td> <td>pathData</td> </tr> </table> </p> Below is an example of a VectorDrawable defined in vectordrawable.xml. This VectorDrawable is referred to by its file name (not including file suffix) in the <a href="#AVDExample">AnimatedVectorDrawable XML example</a>. <pre> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="64dp" android:width="64dp" android:viewportHeight="600" android:viewportWidth="600" > <group android:name="rotationGroup" android:pivotX="300.0" android:pivotY="300.0" android:rotation="45.0" > <path android:name="v" android:fillColor="#000000" android:pathData="M300,70 l 0,-70 70,70 0,0 -70,70z" /> </group> </vector> </pre></li> <a name="AVDExample"></a> <li><h4>XML for AnimatedVectorDrawable</h4> <p> An AnimatedVectorDrawable element has a VectorDrawable attribute, and one or more target element(s). The target element can specify its target by android:name attribute, and link the target with the proper ObjectAnimator or AnimatorSet by android:animation attribute. </p> The following code sample defines an AnimatedVectorDrawable. Note that the names refer to the groups and paths in the <a href="#VDExample">VectorDrawable XML above</a>. <pre> <animated-vector xmlns:android="http://schemas.android.com/apk/res/android" android:drawable="@drawable/vectordrawable" > <target android:name="rotationGroup" android:animation="@animator/rotation" /> <target android:name="v" android:animation="@animator/path_morph" /> </animated-vector> </pre> </li> <li><h4>XML for Animations defined using ObjectAnimator or AnimatorSet</h4> <p> From the previous <a href="#AVDExample">example of AnimatedVectorDrawable</a>, two animations were used: rotation.xml and path_morph.xml. </p> rotation.xml rotates the target group from 0 degree to 360 degrees over 6000ms: <pre> <objectAnimator android:duration="6000" android:propertyName="rotation" android:valueFrom="0" android:valueTo="360" /> </pre> path_morph.xml morphs the path from one shape into the other. Note that the paths must be compatible for morphing. Specifically, the paths must have the same commands, in the same order, and must have the same number of parameters for each command. It is recommended to store path strings as string resources for reuse. <pre> <set xmlns:android="http://schemas.android.com/apk/res/android"> <objectAnimator android:duration="3000" android:propertyName="pathData" android:valueFrom="M300,70 l 0,-70 70,70 0,0 -70,70z" android:valueTo="M300,70 l 0,-70 70,0 0,140 -70,0 z" android:valueType="pathType"/> </set> </pre> </ul> <a name="OneXML"></a> <h3>Define an AnimatedVectorDrawable all in one XML file</h3> <p> Since the AAPT tool supports a new format that bundles several related XML files together, we can merge the XML files from the previous examples into one XML file: </p> <pre> <animated-vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" > <aapt:attr name="android:drawable"> <vector android:height="64dp" android:width="64dp" android:viewportHeight="600" android:viewportWidth="600" > <group android:name="rotationGroup" android:pivotX="300.0" android:pivotY="300.0" android:rotation="45.0" > <path android:name="v" android:fillColor="#000000" android:pathData="M300,70 l 0,-70 70,70 0,0 -70,70z" /> </group> </vector> </aapt:attr> <target android:name="rotationGroup"> * <aapt:attr name="android:animation"> <objectAnimator android:duration="6000" android:propertyName="rotation" android:valueFrom="0" android:valueTo="360" /> </aapt:attr> </target> <target android:name="v" > <aapt:attr name="android:animation"> <set> <objectAnimator android:duration="3000" android:propertyName="pathData" android:valueFrom="M300,70 l 0,-70 70,70 0,0 -70,70z" android:valueTo="M300,70 l 0,-70 70,0 0,140 -70,0 z" android:valueType="pathType"/> </set> </aapt:attr> </target> </animated-vector> </pre> @attr ref android.R.styleable#AnimatedVectorDrawable_drawable @attr ref android.R.styleable#AnimatedVectorDrawableTarget_name @attr ref android.R.styleable#AnimatedVectorDrawableTarget_animation */ var AnimatedVectorDrawable = { /** */ mutate : function( ) {}, /** @hide */ clearMutated : function( ) {}, /** */ getConstantState : function( ) {}, /** */ getChangingConfigurations : function( ) {}, /**Draws the AnimatedVectorDrawable into the given canvas. <p> <strong>Note:</strong> Calling this method with a software canvas when the AnimatedVectorDrawable is being animated on RenderThread (for API 25 and later) may yield outdated result, as the UI thread is not guaranteed to be in sync with RenderThread on VectorDrawable's property changes during RenderThread animations. </p> @param {Object {Canvas}} canvas The canvas to draw into */ draw : function( ) {}, /** */ onLayoutDirectionChanged : function( ) {}, /**For API 25 and later, AnimatedVectorDrawable runs on RenderThread. Therefore, when the root alpha is being animated, this getter does not guarantee to return an up-to-date alpha value. @return {Number} the containing vector drawable's root alpha value. */ getAlpha : function( ) {}, /** */ setAlpha : function( ) {}, /** */ setColorFilter : function( ) {}, /** */ getColorFilter : function( ) {}, /** */ setTintList : function( ) {}, /** */ setHotspot : function( ) {}, /** */ setHotspotBounds : function( ) {}, /** */ setTintBlendMode : function( ) {}, /** */ setVisible : function( ) {}, /** */ isStateful : function( ) {}, /** */ getOpacity : function( ) {}, /** */ getIntrinsicWidth : function( ) {}, /** */ getIntrinsicHeight : function( ) {}, /** */ getOutline : function( ) {}, /** */ getOpticalInsets : function( ) {}, /** */ inflate : function( ) {}, /**Force to animate on UI thread. @hide */ forceAnimationOnUI : function( ) {}, /** */ canApplyTheme : function( ) {}, /** */ applyTheme : function( ) {}, /** */ isRunning : function( ) {}, /**Resets the AnimatedVectorDrawable to the start state as specified in the animators. */ reset : function( ) {}, /** */ start : function( ) {}, /** */ stop : function( ) {}, /**Reverses ongoing animations or starts pending animations in reverse. <p> NOTE: Only works if all animations support reverse. Otherwise, this will do nothing. @hide */ reverse : function( ) {}, /** @hide */ canReverse : function( ) {}, /** */ registerAnimationCallback : function( ) {}, /** */ unregisterAnimationCallback : function( ) {}, /** */ clearAnimationCallbacks : function( ) {}, };