Skip to content

Commit

Permalink
Merge pull request #15 from dambrisco/master
Browse files Browse the repository at this point in the history
Add prefix to all MrVector attributes
  • Loading branch information
eveliotc committed Mar 4, 2015
2 parents ff14eca + 77dc29a commit b7f9675
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 123 deletions.
16 changes: 8 additions & 8 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:height="@dimen/logo_side"
auto:viewportWidth="@integer/logo_viewport_side"
auto:viewportHeight="@integer/logo_viewport_side"
auto:mv_width="@dimen/logo_side"
auto:mv_height="@dimen/logo_side"
auto:mv_viewportWidth="@integer/logo_viewport_side"
auto:mv_viewportHeight="@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:mv_fillColor="@color/logo_fill_color"
auto:mv_pathData="@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:mv_fillColor="@color/logo_fill_color"
auto:mv_pathData="@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:mv_height="64dp"
auto:mv_width="64dp"
auto:mv_viewportWidth="600"
auto:mv_viewportHeight="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:mv_name="rotationGroup"
auto:mv_pivotX="300.0"
auto:mv_pivotY="300.0"
auto:mv_rotation="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:mv_name="v"
auto:mv_fillColor="#000000"
auto:mv_pathData="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:mv_width="@dimen/simple_vector_width"
auto:mv_height="@dimen/simple_vector_height"
auto:mv_viewportWidth="@integer/simple_vector_viewport_width"
auto:mv_viewportHeight="@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:mv_strokeColor="@color/simple_vector_stroke_color"
auto:mv_strokeWidth="@integer/simple_vector_stroke_width"
auto:mv_pathData="@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:mv_width="48dp"
auto:mv_height="48dp"
auto:mv_viewportWidth="48"
auto:mv_viewportHeight="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:mv_fillColor="@color/branding"
auto:mv_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"

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_mv_tintMode, -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_mv_tint);
if (tint != null) {
state.mTint = tint;
}

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

pathRenderer.mViewportWidth = a.getFloat(
R.styleable.VectorDrawable_viewportWidth, pathRenderer.mViewportWidth);
R.styleable.VectorDrawable_mv_viewportWidth, pathRenderer.mViewportWidth);
pathRenderer.mViewportHeight = a.getFloat(
R.styleable.VectorDrawable_viewportHeight, pathRenderer.mViewportHeight);
R.styleable.VectorDrawable_mv_viewportHeight, 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_mv_width, pathRenderer.mBaseWidth);
pathRenderer.mBaseHeight = a.getDimension(
R.styleable.VectorDrawable_height, pathRenderer.mBaseHeight);
R.styleable.VectorDrawable_mv_height, 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_mv_alpha,
pathRenderer.getAlpha());
pathRenderer.setAlpha(alphaInFloat);

final String name = a.getString(R.styleable.VectorDrawable_name);
final String name = a.getString(R.styleable.VectorDrawable_mv_name);
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_mv_rotation, mRotate);
mPivotX = a.getFloat(R.styleable.VectorDrawableGroup_mv_pivotX, mPivotX);
mPivotY = a.getFloat(R.styleable.VectorDrawableGroup_mv_pivotY, mPivotY);
mScaleX = a.getFloat(R.styleable.VectorDrawableGroup_mv_scaleX, mScaleX);
mScaleY = a.getFloat(R.styleable.VectorDrawableGroup_mv_scaleY, mScaleY);
mTranslateX = a.getFloat(R.styleable.VectorDrawableGroup_mv_translateX, mTranslateX);
mTranslateY = a.getFloat(R.styleable.VectorDrawableGroup_mv_translateY, mTranslateY);

final String groupName = a.getString(R.styleable.VectorDrawableGroup_name);
final String groupName = a.getString(R.styleable.VectorDrawableGroup_mv_name);
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_mv_name);
if (pathName != null) {
mPathName = pathName;
}

final String pathData = a.getString(R.styleable.VectorDrawableClipPath_pathData);
final String pathData = a.getString(R.styleable.VectorDrawableClipPath_mv_pathData);
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_mv_name);
if (pathName != null) {
mPathName = pathName;
}

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

mFillColor = a.getColor(R.styleable.VectorDrawablePath_fillColor,
mFillColor = a.getColor(R.styleable.VectorDrawablePath_mv_fillColor,
mFillColor);
mFillAlpha = a.getFloat(R.styleable.VectorDrawablePath_fillAlpha,
mFillAlpha = a.getFloat(R.styleable.VectorDrawablePath_mv_fillAlpha,
mFillAlpha);
mStrokeLineCap = getStrokeLineCap(a.getInt(
R.styleable.VectorDrawablePath_strokeLineCap, -1), mStrokeLineCap);
R.styleable.VectorDrawablePath_mv_strokeLineCap, -1), mStrokeLineCap);
mStrokeLineJoin = getStrokeLineJoin(a.getInt(
R.styleable.VectorDrawablePath_strokeLineJoin, -1), mStrokeLineJoin);
R.styleable.VectorDrawablePath_mv_strokeLineJoin, -1), mStrokeLineJoin);
mStrokeMiterlimit = a.getFloat(
R.styleable.VectorDrawablePath_strokeMiterLimit, mStrokeMiterlimit);
mStrokeColor = a.getColor(R.styleable.VectorDrawablePath_strokeColor,
R.styleable.VectorDrawablePath_mv_strokeMiterLimit, mStrokeMiterlimit);
mStrokeColor = a.getColor(R.styleable.VectorDrawablePath_mv_strokeColor,
mStrokeColor);
mStrokeAlpha = a.getFloat(R.styleable.VectorDrawablePath_strokeAlpha,
mStrokeAlpha = a.getFloat(R.styleable.VectorDrawablePath_mv_strokeAlpha,
mStrokeAlpha);
mStrokeWidth = a.getFloat(R.styleable.VectorDrawablePath_strokeWidth,
mStrokeWidth = a.getFloat(R.styleable.VectorDrawablePath_mv_strokeWidth,
mStrokeWidth);
mTrimPathEnd = a.getFloat(R.styleable.VectorDrawablePath_trimPathEnd,
mTrimPathEnd = a.getFloat(R.styleable.VectorDrawablePath_mv_trimPathEnd,
mTrimPathEnd);
mTrimPathOffset = a.getFloat(
R.styleable.VectorDrawablePath_trimPathOffset, mTrimPathOffset);
R.styleable.VectorDrawablePath_mv_trimPathOffset, mTrimPathOffset);
mTrimPathStart = a.getFloat(
R.styleable.VectorDrawablePath_trimPathStart, mTrimPathStart);
R.styleable.VectorDrawablePath_mv_trimPathStart, mTrimPathStart);
}

@Override
Expand Down
Loading

0 comments on commit b7f9675

Please sign in to comment.