trello-archive / victor

Use SVGs as resources in Android
Apache License 2.0
1.01k stars 49 forks source link

Generate Android vectors #43

Closed romainpiel closed 8 years ago

romainpiel commented 8 years ago

This is not merge-able as it is, I just want to open a discussion.

As an attempt to fix #27 I copied the sources from the Android Studio SVG to Android Vectors converter and made a gradle task based on it: https://github.com/RomainPiel/gradle-svg2android

I modified Victor so that it converts SVGs to Android Vectors instead of PNGs and it's working pretty well with the sample. SVG2Android hasn't been uploaded to maven central or bintray, I've only played with it with mavenLocal. So to test this PR:

I think a reasonable plan could be to add an option to victor to switch the export format between png and xml. Then while this appears to be stable, we can remove completely RasterizeTask and only use SVG2AndroidTask.

Limitation:

If you think it's useful, either:

dlew commented 8 years ago

This is awesome. I think we'd want to add an option to convert to PNG vs. Android drawable, just so people can have a safe upgrade path.

One other question - why is gradle-svg2android tied to Gradle vs. being a standalone Java process?

romainpiel commented 8 years ago

Awesome, I have a 7 hours flight tomorrow, I'll take this time to tidy up the PR. I made my repo tied to gradle because I wanted to expose a gradle task. But you're right, it would be cleaner to expose just a standalone java library and to move the gradle task here. I'll work on that :+1:

romainpiel commented 8 years ago

I think it's much more clean now if you want to have a look:

Travis is not passing because the job doesn't do a clean.

romainpiel commented 8 years ago

I've merged the tasks and removed the usage of generateVectorDrawables in the sample. I'm still not sure what to do with https://github.com/trello/victor/pull/43#discussion_r60452265

romainpiel commented 8 years ago

regarding https://github.com/trello/victor/pull/43#discussion_r60452328, this is a bug in the Android Studio source code. I've just reported it, so I'll merge it in svg2android as soon as it gets fixed: http://b.android.com/208216

dlew commented 8 years ago

This looks good to me. Let's see what happens with it!