Skip to content

Commit

Permalink
Add prefix to all MrVector attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Ambrisco committed Mar 4, 2015
1 parent ff14eca commit f73332f
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 122 deletions.
14 changes: 7 additions & 7 deletions demo/src/main/res/drawable/logo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
xmlns:auto="http://schemas.android.com/apk/res-auto"
tools:targetApi="21"

auto:width="@dimen/logo_side"
auto:mvWidth="@dimen/logo_side"
auto:height="@dimen/logo_side"
auto:viewportWidth="@integer/logo_viewport_side"
auto:viewportHeight="@integer/logo_viewport_side"
auto:mvViewportWidth="@integer/logo_viewport_side"
auto:mvViewportHeight="@integer/logo_viewport_side"

android:width="@dimen/logo_side"
android:height="@dimen/logo_side"
Expand All @@ -17,15 +17,15 @@

<group>
<path
auto:fillColor="@color/logo_fill_color"
auto:pathData="@string/logo_path_1"
auto:mvFillColor="@color/logo_fill_color"
auto:mvPathData="@string/logo_path_1"

android:fillColor="@color/logo_fill_color"
android:pathData="@string/logo_path_1"
/>
<path
auto:fillColor="@color/logo_fill_color"
auto:pathData="@string/logo_path_2"
auto:mvFillColor="@color/logo_fill_color"
auto:mvPathData="@string/logo_path_2"

android:fillColor="@color/logo_fill_color"
android:pathData="@string/logo_path_2"
Expand Down
22 changes: 11 additions & 11 deletions demo/src/main/res/drawable/sample_vector_drawable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,31 @@ limitations under the License.
xmlns:tools="http://schemas.android.com/tools"
xmlns:auto="http://schemas.android.com/apk/res-auto"
tools:targetApi="21"
auto:height="64dp"
auto:width="64dp"
auto:viewportWidth="600"
auto:viewportHeight="600"
auto:mvHeight="64dp"
auto:mvWidth="64dp"
auto:mvViewportWidth="600"
auto:mvViewportHeight="600"

android:height="64dp"
android:width="64dp"
android:viewportWidth="600"
android:viewportHeight="600"
>
<group
auto:name="rotationGroup"
auto:pivotX="300.0"
auto:pivotY="300.0"
auto:rotation="45.0"
auto:mvName="rotationGroup"
auto:mvPivotX="300.0"
auto:mvPivotY="300.0"
auto:mvRotation="45.0"

android:name="rotationGroup"
android:pivotX="300.0"
android:pivotY="300.0"
android:rotation="45.0"
>
<path
auto:name="v"
auto:fillColor="#000000"
auto:pathData="M300,70 l 0,-70 70,70 0,0 -70,70z"
auto:mvName="v"
auto:mvFillColor="#000000"
auto:mvPathData="M300,70 l 0,-70 70,70 0,0 -70,70z"

android:name="v"
android:fillColor="#000000"
Expand Down
14 changes: 7 additions & 7 deletions demo/src/main/res/drawable/simple.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
xmlns:auto="http://schemas.android.com/apk/res-auto"
tools:targetApi="21"

auto:width="@dimen/simple_vector_width"
auto:height="@dimen/simple_vector_height"
auto:viewportWidth="@integer/simple_vector_viewport_width"
auto:viewportHeight="@integer/simple_vector_viewport_height"
auto:mvWidth="@dimen/simple_vector_width"
auto:mvHeight="@dimen/simple_vector_height"
auto:mvViewportWidth="@integer/simple_vector_viewport_width"
auto:mvViewportHeight="@integer/simple_vector_viewport_height"

android:width="@dimen/simple_vector_width"
android:height="@dimen/simple_vector_height"
Expand All @@ -27,9 +27,9 @@
>

<path
auto:strokeColor="@color/simple_vector_stroke_color"
auto:strokeWidth="@integer/simple_vector_stroke_width"
auto:pathData="@string/simple_vector_path_data"
auto:mvStrokeColor="@color/simple_vector_stroke_color"
auto:mvStrokeWidth="@integer/simple_vector_stroke_width"
auto:mvPathData="@string/simple_vector_path_data"

android:strokeColor="@color/simple_vector_stroke_color"
android:strokeWidth="@integer/simple_vector_stroke_width"
Expand Down
12 changes: 6 additions & 6 deletions demo/src/main/res/drawable/vector_android.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ limitations under the License.
xmlns:tools="http://schemas.android.com/tools"
xmlns:auto="http://schemas.android.com/apk/res-auto"
tools:targetApi="21"
auto:width="48dp"
auto:height="48dp"
auto:viewportWidth="48"
auto:viewportHeight="48"
auto:mvWidth="48dp"
auto:mvHeight="48dp"
auto:mvViewportWidth="48"
auto:mvViewportHeight="48"

android:width="48dp"
android:height="48dp"
Expand All @@ -26,8 +26,8 @@ limitations under the License.
>

<path
auto:fillColor="@color/branding"
auto:pathData="M12 36c0 1.1 0.9 2 2 2h2v7c0 1.66 1.34 3 3 3s3-1.34 3-3v-7h4v7c0 1.66 1.34 3 3 3s3-1.34 3-3v-7h2c1.1 0 2-.9 2-2v-20h-24v20zm-5-20c-1.66 0-3 1.34-3 3v14c0 1.66 1.34 3 3 3s3-1.34 3-3v-14c0-1.66-1.34-3-3-3zm34 0c-1.66 0-3 1.34-3 3v14c0 1.66 1.34 3 3 3s3-1.34 3-3v-14c0-1.66-1.34-3-3-3zm-9.94-11.68l2.61-2.61c 0.39 -0.39 0.39 -1.02 0-1.41-.39-.39-1.02-.39-1.41 0l-2.96 2.95c-1.6-.79-3.39-1.25-5.3-1.25-1.92 0-3.72 0.46 -5.33 1.26l-2.97-2.97c-.39-.39-1.02-.39-1.41 0 -0.39 0.39-.39 1.02 0 1.41l2.62 2.62c-2.97 2.19-4.91 5.71-4.91 9.68h24c0-3.98-1.95-7.5-4.94-9.68zm-11.06 5.68h-2v-2h2v2zm10 0h-2v-2h2v2z"
auto:mvFillColor="@color/branding"
auto:mvPathData="M12 36c0 1.1 0.9 2 2 2h2v7c0 1.66 1.34 3 3 3s3-1.34 3-3v-7h4v7c0 1.66 1.34 3 3 3s3-1.34 3-3v-7h2c1.1 0 2-.9 2-2v-20h-24v20zm-5-20c-1.66 0-3 1.34-3 3v14c0 1.66 1.34 3 3 3s3-1.34 3-3v-14c0-1.66-1.34-3-3-3zm34 0c-1.66 0-3 1.34-3 3v14c0 1.66 1.34 3 3 3s3-1.34 3-3v-14c0-1.66-1.34-3-3-3zm-9.94-11.68l2.61-2.61c 0.39 -0.39 0.39 -1.02 0-1.41-.39-.39-1.02-.39-1.41 0l-2.96 2.95c-1.6-.79-3.39-1.25-5.3-1.25-1.92 0-3.72 0.46 -5.33 1.26l-2.97-2.97c-.39-.39-1.02-.39-1.41 0 -0.39 0.39-.39 1.02 0 1.41l2.62 2.62c-2.97 2.19-4.91 5.71-4.91 9.68h24c0-3.98-1.95-7.5-4.94-9.68zm-11.06 5.68h-2v-2h2v2zm10 0h-2v-2h2v2z"

android:fillColor="@color/branding"
android:pathData="M12 36c0 1.1 0.9 2 2 2h2v7c0 1.66 1.34 3 3 3s3-1.34 3-3v-7h4v7c0 1.66 1.34 3 3 3s3-1.34 3-3v-7h2c1.1 0 2-.9 2-2v-20h-24v20zm-5-20c-1.66 0-3 1.34-3 3v14c0 1.66 1.34 3 3 3s3-1.34 3-3v-14c0-1.66-1.34-3-3-3zm34 0c-1.66 0-3 1.34-3 3v14c0 1.66 1.34 3 3 3s3-1.34 3-3v-14c0-1.66-1.34-3-3-3zm-9.94-11.68l2.61-2.61c 0.39 -0.39 0.39 -1.02 0-1.41-.39-.39-1.02-.39-1.41 0l-2.96 2.95c-1.6-.79-3.39-1.25-5.3-1.25-1.92 0-3.72 0.46 -5.33 1.26l-2.97-2.97c-.39-.39-1.02-.39-1.41 0 -0.39 0.39-.39 1.02 0 1.41l2.62 2.62c-2.97 2.19-4.91 5.71-4.91 9.68h24c0-3.98-1.95-7.5-4.94-9.68zm-11.06 5.68h-2v-2h2v2zm10 0h-2v-2h2v2z"
Expand Down
64 changes: 32 additions & 32 deletions library/src/main/java/com/telly/mrvector/VectorDrawable.java
Original file line number Diff line number Diff line change
Expand Up @@ -486,23 +486,23 @@ private void updateStateFromTypedArray(TypedArray a) throws XmlPullParserExcepti
// Extract the theme attributes, if any.
state.mThemeAttrs = null; // TODO THEME TINT Not supported yet a.extractThemeAttrs();

final int tintMode = a.getInt(R.styleable.VectorDrawable_tintMode, -1);
final int tintMode = a.getInt(R.styleable.VectorDrawable_mvTintMode, -1);
if (tintMode != -1) {
state.mTintMode = Utils.parseTintMode(tintMode, DEFAULT_TINT_MODE);
}

final ColorStateList tint = a.getColorStateList(R.styleable.VectorDrawable_tint);
final ColorStateList tint = a.getColorStateList(R.styleable.VectorDrawable_mvTint);
if (tint != null) {
state.mTint = tint;
}

state.mAutoMirrored = a.getBoolean(
R.styleable.VectorDrawable_autoMirrored, state.mAutoMirrored);
R.styleable.VectorDrawable_mvAutoMirrored, state.mAutoMirrored);

pathRenderer.mViewportWidth = a.getFloat(
R.styleable.VectorDrawable_viewportWidth, pathRenderer.mViewportWidth);
R.styleable.VectorDrawable_mvViewportWidth, pathRenderer.mViewportWidth);
pathRenderer.mViewportHeight = a.getFloat(
R.styleable.VectorDrawable_viewportHeight, pathRenderer.mViewportHeight);
R.styleable.VectorDrawable_mvViewportHeight, pathRenderer.mViewportHeight);

if (pathRenderer.mViewportWidth <= 0) {
throw new XmlPullParserException(a.getPositionDescription() +
Expand All @@ -513,9 +513,9 @@ private void updateStateFromTypedArray(TypedArray a) throws XmlPullParserExcepti
}

pathRenderer.mBaseWidth = a.getDimension(
R.styleable.VectorDrawable_width, pathRenderer.mBaseWidth);
R.styleable.VectorDrawable_mvWidth, pathRenderer.mBaseWidth);
pathRenderer.mBaseHeight = a.getDimension(
R.styleable.VectorDrawable_height, pathRenderer.mBaseHeight);
R.styleable.VectorDrawable_mvHeight, pathRenderer.mBaseHeight);

if (pathRenderer.mBaseWidth <= 0) {
throw new XmlPullParserException(a.getPositionDescription() +
Expand All @@ -525,11 +525,11 @@ private void updateStateFromTypedArray(TypedArray a) throws XmlPullParserExcepti
"<vector> tag requires height > 0");
}

final float alphaInFloat = a.getFloat(R.styleable.VectorDrawable_alpha,
final float alphaInFloat = a.getFloat(R.styleable.VectorDrawable_mvAlpha,
pathRenderer.getAlpha());
pathRenderer.setAlpha(alphaInFloat);

final String name = a.getString(R.styleable.VectorDrawable_name);
final String name = a.getString(R.styleable.VectorDrawable_mvName);
if (name != null) {
pathRenderer.mRootName = name;
pathRenderer.mVGTargetsMap.put(name, pathRenderer);
Expand Down Expand Up @@ -1134,15 +1134,15 @@ private void updateStateFromTypedArray(TypedArray a) {
// Extract the theme attributes, if any.
mThemeAttrs = null; // TODO TINT THEME Not supported yet a.extractThemeAttrs();

mRotate = a.getFloat(R.styleable.VectorDrawableGroup_rotation, mRotate);
mPivotX = a.getFloat(R.styleable.VectorDrawableGroup_pivotX, mPivotX);
mPivotY = a.getFloat(R.styleable.VectorDrawableGroup_pivotY, mPivotY);
mScaleX = a.getFloat(R.styleable.VectorDrawableGroup_scaleX, mScaleX);
mScaleY = a.getFloat(R.styleable.VectorDrawableGroup_scaleY, mScaleY);
mTranslateX = a.getFloat(R.styleable.VectorDrawableGroup_translateX, mTranslateX);
mTranslateY = a.getFloat(R.styleable.VectorDrawableGroup_translateY, mTranslateY);
mRotate = a.getFloat(R.styleable.VectorDrawableGroup_mvRotation, mRotate);
mPivotX = a.getFloat(R.styleable.VectorDrawableGroup_mvPivotX, mPivotX);
mPivotY = a.getFloat(R.styleable.VectorDrawableGroup_mvPivotY, mPivotY);
mScaleX = a.getFloat(R.styleable.VectorDrawableGroup_mvScaleX, mScaleX);
mScaleY = a.getFloat(R.styleable.VectorDrawableGroup_mvScaleY, mScaleY);
mTranslateX = a.getFloat(R.styleable.VectorDrawableGroup_mvTranslateX, mTranslateX);
mTranslateY = a.getFloat(R.styleable.VectorDrawableGroup_mvTranslateY, mTranslateY);

final String groupName = a.getString(R.styleable.VectorDrawableGroup_name);
final String groupName = a.getString(R.styleable.VectorDrawableGroup_mvName);
if (groupName != null) {
mGroupName = groupName;
}
Expand Down Expand Up @@ -1349,12 +1349,12 @@ private void updateStateFromTypedArray(TypedArray a) {
// Account for any configuration changes.
mChangingConfigurations |= Utils.getChangingConfigurations(a);;

final String pathName = a.getString(R.styleable.VectorDrawableClipPath_name);
final String pathName = a.getString(R.styleable.VectorDrawableClipPath_mvName);
if (pathName != null) {
mPathName = pathName;
}

final String pathData = a.getString(R.styleable.VectorDrawableClipPath_pathData);
final String pathData = a.getString(R.styleable.VectorDrawableClipPath_mvPathData);
if (pathData != null) {
mNodes = PathParser.createNodesFromPathData(pathData);
}
Expand Down Expand Up @@ -1457,38 +1457,38 @@ private void updateStateFromTypedArray(TypedArray a) {
// Extract the theme attributes, if any.
mThemeAttrs = null; // TODO TINT THEME Not supported yet a.extractThemeAttrs();

final String pathName = a.getString(R.styleable.VectorDrawablePath_name);
final String pathName = a.getString(R.styleable.VectorDrawablePath_mvName);
if (pathName != null) {
mPathName = pathName;
}

final String pathData = a.getString(R.styleable.VectorDrawablePath_pathData);
final String pathData = a.getString(R.styleable.VectorDrawablePath_mvPathData);
if (pathData != null) {
mNodes = PathParser.createNodesFromPathData(pathData);
}

mFillColor = a.getColor(R.styleable.VectorDrawablePath_fillColor,
mFillColor = a.getColor(R.styleable.VectorDrawablePath_mvFillColor,
mFillColor);
mFillAlpha = a.getFloat(R.styleable.VectorDrawablePath_fillAlpha,
mFillAlpha = a.getFloat(R.styleable.VectorDrawablePath_mvFillAlpha,
mFillAlpha);
mStrokeLineCap = getStrokeLineCap(a.getInt(
R.styleable.VectorDrawablePath_strokeLineCap, -1), mStrokeLineCap);
R.styleable.VectorDrawablePath_mvStrokeLineCap, -1), mStrokeLineCap);
mStrokeLineJoin = getStrokeLineJoin(a.getInt(
R.styleable.VectorDrawablePath_strokeLineJoin, -1), mStrokeLineJoin);
R.styleable.VectorDrawablePath_mvStrokeLineJoin, -1), mStrokeLineJoin);
mStrokeMiterlimit = a.getFloat(
R.styleable.VectorDrawablePath_strokeMiterLimit, mStrokeMiterlimit);
mStrokeColor = a.getColor(R.styleable.VectorDrawablePath_strokeColor,
R.styleable.VectorDrawablePath_mvStrokeMiterLimit, mStrokeMiterlimit);
mStrokeColor = a.getColor(R.styleable.VectorDrawablePath_mvStrokeColor,
mStrokeColor);
mStrokeAlpha = a.getFloat(R.styleable.VectorDrawablePath_strokeAlpha,
mStrokeAlpha = a.getFloat(R.styleable.VectorDrawablePath_mvStrokeAlpha,
mStrokeAlpha);
mStrokeWidth = a.getFloat(R.styleable.VectorDrawablePath_strokeWidth,
mStrokeWidth = a.getFloat(R.styleable.VectorDrawablePath_mvStrokeWidth,
mStrokeWidth);
mTrimPathEnd = a.getFloat(R.styleable.VectorDrawablePath_trimPathEnd,
mTrimPathEnd = a.getFloat(R.styleable.VectorDrawablePath_mvTrimPathEnd,
mTrimPathEnd);
mTrimPathOffset = a.getFloat(
R.styleable.VectorDrawablePath_trimPathOffset, mTrimPathOffset);
R.styleable.VectorDrawablePath_mvTrimPathOffset, mTrimPathOffset);
mTrimPathStart = a.getFloat(
R.styleable.VectorDrawablePath_trimPathStart, mTrimPathStart);
R.styleable.VectorDrawablePath_mvTrimPathStart, mTrimPathStart);
}

@Override
Expand Down
Loading

0 comments on commit f73332f

Please sign in to comment.