updated code

This commit is contained in:
Mariotaku Lee 2015-12-22 14:43:55 +08:00
parent 74cb6d7f64
commit 6d7ffe5134
3 changed files with 28 additions and 20 deletions

View File

@ -20,7 +20,16 @@ import fr.avianey.androidsvgdrawable.gradle.SvgDrawableTask
*/
apply plugin: 'com.android.application'
apply plugin: 'androidsvgdrawable'
apply plugin: 'com.github.forsety.adr'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.forsety:adr:0.1'
}
}
android {
compileSdkVersion 23
@ -49,21 +58,3 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
task emojiSvgToMipmap(type: SvgDrawableTask) {
// specify where to pick SVG from
from = files('src/main/svg/drawable')
// specify the android res folder
to = file('src/main/res-svg2png')
// override files only if necessary
overwriteMode = 'ifModified'
// let generate PNG for the following densities only
targetedDensities = ['hdpi', 'mdpi', 'xhdpi', 'xxhdpi', 'xxxhdpi']
// relative path of the file specifying nine patch specs
ninePatchConfig = file('src/main/svg/drawable/9patch.json')
// output format of the generated resources
outputFormat = 'PNG'
outputType = 'mipmap'
}

View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
if [ -z $1 ] || [ -z $2 ] || [ -z $3 ] || [ -z $4 ]; then
echo "Usage: $0 in_dir out_dir type suffix"
exit
fi
for f in $1/*.png; do
png_name=`basename ${f}`
svg_name=${png_name%.png}$4.svg
svg_file=$2/${svg_name}
if [ ! -e ${svg_file} ]; then
echo "Convert ${png_name} to ${svg_name}"
convert ${f} ${svg_file}
fi
done

View File

@ -1 +1,2 @@
/build
# Those files generated on compile, so there's no need to include them in VCSw
res-svg2png/