Loading core/java/android/content/res/TypedArray.java +3 −3 Original line number Diff line number Diff line Loading @@ -885,9 +885,9 @@ public class TypedArray { /** * Extracts theme attributes from a typed array for later resolution using * {@link Theme#resolveAttributes(int[], int[])}. Removes the entries from * the typed array so that subsequent calls to typed getters will return the * default value without crashing. * {@link android.content.res.Resources.Theme#resolveAttributes(int[], int[])}. * Removes the entries from the typed array so that subsequent calls to typed * getters will return the default value without crashing. * * @return an array of length {@link #getIndexCount()} populated with theme * attributes, or null if there are no theme attributes in the typed Loading core/res/res/values/attrs.xml +10 −0 Original line number Diff line number Diff line Loading @@ -4978,6 +4978,16 @@ <!-- ========================== --> <eat-comment /> <!-- Drawable used to draw vector paths. --> <declare-styleable name="VectorDrawable"> <!-- If set, specifies the color to apply to the drawable as a tint. By default, no tint is applied. May be a color state list. --> <attr name="tint" /> <!-- When a tint color is set, specifies its Porter-Duff blending mode. The default value is src_in, which treats the drawable as an alpha mask. --> <attr name="tintMode" /> </declare-styleable> <!-- Define the virtual size of the drawing surface paths will draw to. --> <declare-styleable name="VectorDrawableViewport"> <!-- The width of the canvas the drawing is on. --> Loading graphics/java/android/graphics/drawable/VectorDrawable.java +26 −0 Original line number Diff line number Diff line Loading @@ -378,6 +378,8 @@ public class VectorDrawable extends Drawable { mVGTargetsMap.put(newChildGroup.getGroupName(), newChildGroup); } noGroupTag = false; } else if (SHAPE_VECTOR.equals(tagName)) { parseVector(res, attrs); } } else if (eventType == XmlPullParser.END_TAG) { final String tagName = parser.getName(); Loading Loading @@ -417,9 +419,31 @@ public class VectorDrawable extends Drawable { throw new XmlPullParserException("no " + tag + " defined"); } mTintFilter = updateTintFilter(mTintFilter, mVectorState.mTint, mVectorState.mTintMode); mVectorState.mVPathRenderer.setColorFilter(mTintFilter); return pathRenderer; } private void parseVector(Resources r, AttributeSet attrs) throws XmlPullParserException { final TypedArray a = r.obtainAttributes(attrs, R.styleable.VectorDrawable); final VectorDrawableState state = mVectorState; state.mThemeAttrs = a.extractThemeAttrs(); final int tintMode = a.getInt(R.styleable.BitmapDrawable_tintMode, -1); if (tintMode != -1) { state.mTintMode = Drawable.parseTintMode(tintMode, Mode.SRC_IN); } final ColorStateList tint = a.getColorStateList(R.styleable.BitmapDrawable_tint); if (tint != null) { state.mTint = tint; } a.recycle(); } private void printGroupTree(VGroup currentGroup, int level) { String indent = ""; for (int i = 0 ; i < level ; i++) { Loading @@ -440,6 +464,7 @@ public class VectorDrawable extends Drawable { } private static class VectorDrawableState extends ConstantState { int[] mThemeAttrs; int mChangingConfigurations; VPathRenderer mVPathRenderer; Rect mPadding; Loading @@ -448,6 +473,7 @@ public class VectorDrawable extends Drawable { public VectorDrawableState(VectorDrawableState copy) { if (copy != null) { mThemeAttrs = copy.mThemeAttrs; mChangingConfigurations = copy.mChangingConfigurations; // TODO: Make sure the constant state are handled correctly. mVPathRenderer = new VPathRenderer(copy.mVPathRenderer); Loading Loading
core/java/android/content/res/TypedArray.java +3 −3 Original line number Diff line number Diff line Loading @@ -885,9 +885,9 @@ public class TypedArray { /** * Extracts theme attributes from a typed array for later resolution using * {@link Theme#resolveAttributes(int[], int[])}. Removes the entries from * the typed array so that subsequent calls to typed getters will return the * default value without crashing. * {@link android.content.res.Resources.Theme#resolveAttributes(int[], int[])}. * Removes the entries from the typed array so that subsequent calls to typed * getters will return the default value without crashing. * * @return an array of length {@link #getIndexCount()} populated with theme * attributes, or null if there are no theme attributes in the typed Loading
core/res/res/values/attrs.xml +10 −0 Original line number Diff line number Diff line Loading @@ -4978,6 +4978,16 @@ <!-- ========================== --> <eat-comment /> <!-- Drawable used to draw vector paths. --> <declare-styleable name="VectorDrawable"> <!-- If set, specifies the color to apply to the drawable as a tint. By default, no tint is applied. May be a color state list. --> <attr name="tint" /> <!-- When a tint color is set, specifies its Porter-Duff blending mode. The default value is src_in, which treats the drawable as an alpha mask. --> <attr name="tintMode" /> </declare-styleable> <!-- Define the virtual size of the drawing surface paths will draw to. --> <declare-styleable name="VectorDrawableViewport"> <!-- The width of the canvas the drawing is on. --> Loading
graphics/java/android/graphics/drawable/VectorDrawable.java +26 −0 Original line number Diff line number Diff line Loading @@ -378,6 +378,8 @@ public class VectorDrawable extends Drawable { mVGTargetsMap.put(newChildGroup.getGroupName(), newChildGroup); } noGroupTag = false; } else if (SHAPE_VECTOR.equals(tagName)) { parseVector(res, attrs); } } else if (eventType == XmlPullParser.END_TAG) { final String tagName = parser.getName(); Loading Loading @@ -417,9 +419,31 @@ public class VectorDrawable extends Drawable { throw new XmlPullParserException("no " + tag + " defined"); } mTintFilter = updateTintFilter(mTintFilter, mVectorState.mTint, mVectorState.mTintMode); mVectorState.mVPathRenderer.setColorFilter(mTintFilter); return pathRenderer; } private void parseVector(Resources r, AttributeSet attrs) throws XmlPullParserException { final TypedArray a = r.obtainAttributes(attrs, R.styleable.VectorDrawable); final VectorDrawableState state = mVectorState; state.mThemeAttrs = a.extractThemeAttrs(); final int tintMode = a.getInt(R.styleable.BitmapDrawable_tintMode, -1); if (tintMode != -1) { state.mTintMode = Drawable.parseTintMode(tintMode, Mode.SRC_IN); } final ColorStateList tint = a.getColorStateList(R.styleable.BitmapDrawable_tint); if (tint != null) { state.mTint = tint; } a.recycle(); } private void printGroupTree(VGroup currentGroup, int level) { String indent = ""; for (int i = 0 ; i < level ; i++) { Loading @@ -440,6 +464,7 @@ public class VectorDrawable extends Drawable { } private static class VectorDrawableState extends ConstantState { int[] mThemeAttrs; int mChangingConfigurations; VPathRenderer mVPathRenderer; Rect mPadding; Loading @@ -448,6 +473,7 @@ public class VectorDrawable extends Drawable { public VectorDrawableState(VectorDrawableState copy) { if (copy != null) { mThemeAttrs = copy.mThemeAttrs; mChangingConfigurations = copy.mChangingConfigurations; // TODO: Make sure the constant state are handled correctly. mVPathRenderer = new VPathRenderer(copy.mVPathRenderer); Loading