summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java49
-rw-r--r--graphics/java/android/graphics/drawable/VectorDrawable.java40
2 files changed, 81 insertions, 8 deletions
diff --git a/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java b/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
index c836204486b0..0f305f3cff3d 100644
--- a/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
+++ b/graphics/java/android/graphics/drawable/AnimatedVectorDrawable.java
@@ -144,6 +144,55 @@ import java.util.ArrayList;
* android:valueType="pathType"/>
* </set>
* </pre></li>
+ * <p>
+ * Since AAPT tool is now supporting a new format which can bundle several related XML files into
+ * one, we can merge the previous example into one XML file, like this:
+ * </p>
+ * <pre>
+ * &lt;animated-vector xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot; &gt;
+ * &lt;aapt:attr name="android:drawable"&gt;
+ * &lt;vector
+ * android:height=&quot;64dp&quot;
+ * android:width=&quot;64dp&quot;
+ * android:viewportHeight=&quot;600&quot;
+ * android:viewportWidth=&quot;600&quot; &gt;
+ * &lt;group
+ * android:name=&quot;rotationGroup&quot;
+ * android:pivotX=&quot;300.0&quot;
+ * android:pivotY=&quot;300.0&quot;
+ * android:rotation=&quot;45.0&quot; &gt;
+ * &lt;path
+ * android:name=&quot;v&quot;
+ * android:fillColor=&quot;#000000&quot;
+ * android:pathData=&quot;M300,70 l 0,-70 70,70 0,0 -70,70z&quot; /&gt;
+ * &lt;/group&gt;
+ * &lt;/vector&gt;
+ * &lt;/aapt:attr&gt;
+ *
+ * &lt;target android:name=&quot;rotationGroup&quot;&gt; *
+ * &lt;aapt:attr name="android:animation"&gt;
+ * &lt;objectAnimator
+ * android:duration=&quot;6000&quot;
+ * android:propertyName=&quot;rotation&quot;
+ * android:valueFrom=&quot;0&quot;
+ * android:valueTo=&quot;360&quot; /&gt;
+ * &lt;/aapt:attr&gt;
+ * &lt;/target&gt;
+ *
+ * &lt;target android:name=&quot;v&quot; &gt;
+ * &lt;aapt:attr name="android:animation"&gt;
+ * &lt;set&gt;
+ * &lt;objectAnimator
+ * android:duration=&quot;3000&quot;
+ * android:propertyName=&quot;pathData&quot;
+ * android:valueFrom=&quot;M300,70 l 0,-70 70,70 0,0 -70,70z&quot;
+ * android:valueTo=&quot;M300,70 l 0,-70 70,0 0,140 -70,0 z&quot;
+ * android:valueType=&quot;pathType&quot;/&gt;
+ * &lt;/set&gt;
+ * &lt;/aapt:attr&gt;
+ * &lt;/target&gt;
+ * &lt;/animated-vector&gt;
+ * </pre>
*
* @attr ref android.R.styleable#AnimatedVectorDrawable_drawable
* @attr ref android.R.styleable#AnimatedVectorDrawableTarget_name
diff --git a/graphics/java/android/graphics/drawable/VectorDrawable.java b/graphics/java/android/graphics/drawable/VectorDrawable.java
index dc1d18f3b2bd..9ff69650294d 100644
--- a/graphics/java/android/graphics/drawable/VectorDrawable.java
+++ b/graphics/java/android/graphics/drawable/VectorDrawable.java
@@ -27,9 +27,9 @@ import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Insets;
import android.graphics.PixelFormat;
+import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
-import android.graphics.PorterDuff.Mode;
import android.graphics.Shader;
import android.util.ArrayMap;
import android.util.AttributeSet;
@@ -140,12 +140,16 @@ import dalvik.system.VMRuntime;
* in the SVG's path data. This is defined in the viewport space.</dd>
* <dt><code>android:fillColor</code></dt>
* <dd>Specifies the color used to fill the path. May be a color or, for SDK 24+, a color state list
- * or a gradient color. If this property is animated, any value set by the animation will
- * override the original value. No path fill is drawn if this property is not specified.</dd>
+ * or a gradient color (See {@link android.R.styleable#GradientColor}
+ * and {@link android.R.styleable#GradientColorItem}).
+ * If this property is animated, any value set by the animation will override the original value.
+ * No path fill is drawn if this property is not specified.</dd>
* <dt><code>android:strokeColor</code></dt>
* <dd>Specifies the color used to draw the path outline. May be a color or, for SDK 24+, a color
- * state list or a gradient color. If this property is animated, any value set by the animation will
- * override the original value. No path outline is drawn if this property is not specified.</dd>
+ * state list or a gradient color (See {@link android.R.styleable#GradientColor}
+ * and {@link android.R.styleable#GradientColorItem}).
+ * If this property is animated, any value set by the animation will override the original value.
+ * No path outline is drawn if this property is not specified.</dd>
* <dt><code>android:strokeWidth</code></dt>
* <dd>The width a path stroke.</dd>
* <dt><code>android:strokeAlpha</code></dt>
@@ -166,8 +170,9 @@ import dalvik.system.VMRuntime;
* <dt><code>android:strokeMiterLimit</code></dt>
* <dd>Sets the Miter limit for a stroked path.</dd>
* <dt><code>android:fillType</code></dt>
- * <dd>Sets the fillType for a path. It is the same as SVG's "fill-rule" properties.
- * For more details, see https://www.w3.org/TR/SVG/painting.html#FillRuleProperty</dd>
+ * <dd>Sets the fillType for a path. The types can be either "evenOdd" or "nonZero". They behave the
+ * same as SVG's "fill-rule" properties. For more details, see
+ * <a href="https://www.w3.org/TR/SVG/painting.html#FillRuleProperty">FillRuleProperty</a></dd>
* </dl></dd>
* </dl>
*
@@ -201,7 +206,26 @@ import dalvik.system.VMRuntime;
* android:pathData=&quot;M300,70 l 0,-70 70,70 0,0 -70,70z&quot; /&gt;
* &lt;/group&gt;
* &lt;/vector&gt;
- * </pre></li>
+ * </pre>
+ * </li>
+ * <li>And here is an example of linear gradient color, which is supported in SDK 24+.
+ * See more details in {@link android.R.styleable#GradientColor} and
+ * {@link android.R.styleable#GradientColorItem}.
+ * <pre>
+ * &lt;gradient xmlns:android="http://schemas.android.com/apk/res/android"
+ * android:angle="90"
+ * android:startColor="?android:attr/colorPrimary"
+ * android:endColor="?android:attr/colorControlActivated"
+ * android:centerColor="#f00"
+ * android:startX="0"
+ * android:startY="0"
+ * android:endX="100"
+ * android:endY="100"
+ * android:type="linear"&gt;
+ * &lt;/gradient&gt;
+ * </pre>
+ * </li>
+ *
*/
public class VectorDrawable extends Drawable {