Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Exports assets as a VectorDrawable for Android. Say goodbye to a bajillion asset

![screenshot](img/screenshot1.png)

Supports [VectorDrawable] as well as [vector-compat].
Supports [VectorDrawable], [VectorDrawableCompat] as well as [vector-compat]

Added in the option to generate a VectorDrawable without the compat options.

Expand Down Expand Up @@ -37,4 +37,5 @@ _NOTE: If your Mac has not installed GitHub client, You need to install [GitHub
[svg2android]:https://github.com/inloop/svg2android
[sketch-export-assets]:https://github.com/geertwille/sketch-export-assets
[VectorDrawable]:https://developer.android.com/reference/android/graphics/drawable/VectorDrawable.html
[VectorDrawableCompat]:https://developer.android.com/guide/topics/graphics/vector-drawable-resources.html#vector-drawables-backward-solution
[vector-compat]:https://github.com/wnafee/vector-compat
8 changes: 2 additions & 6 deletions library/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ function parseFile(inputXml) {
//XML Vector start
generatedOutput = '<?xml version="1.0" encoding="utf-8"?>\n';
generatedOutput += '<vector xmlns:android="http://schemas.android.com/apk/res/android"\n';
generatedOutput += INDENT + 'xmlns:app="http://schemas.android.com/apk/res-auto"\n';
generatedOutput += INDENT + 'xmlns:tools="http://schemas.android.com/tools"\n';
generatedOutput += INDENT + 'tools:ignore="NewApi"\n';
generatedOutput += INDENT + 'android:width="{0}dp"\n'.f(width);
generatedOutput += INDENT + 'android:height="{0}dp"\n'.f(height);
generatedOutput += INDENT + 'android:viewportWidth="{0}"\n'.f(width);
Expand Down Expand Up @@ -389,11 +390,6 @@ function generateAttr(name, val, groupLevel, def, end) {
return INDENT.repeat(groupLevel + 2) + 'android:{0}="{1}"{2}\n'.f(name, val, end ? ' />' : '');
}

function generateCompatAttr(name, val, groupLevel, def, end) {
if (typeof val === "undefined" || val == def) return "";
return INDENT.repeat(groupLevel + 2) + 'app:{0}="{1}"{2}\n'.f(name, val, end ? ' />' : '');
}

function wordwrap(str, width, brk, cut) {
brk = brk || '\n';
width = width || 75;
Expand Down