2020-05-27 18:24:00 +03:00
|
|
|
#!/bin/bash
|
2022-12-03 10:57:57 +03:00
|
|
|
# note: this requires inkscape to be on the path, for svg -> png conversions
|
2020-05-27 18:24:00 +03:00
|
|
|
|
|
|
|
mydir="$(dirname "$(realpath "$0")")"
|
|
|
|
|
2020-05-28 12:11:28 +03:00
|
|
|
export_files() {
|
|
|
|
newfile="$(basename "$file" .svg).png"
|
|
|
|
mkdir -p $base_folder-mdpi
|
|
|
|
mkdir -p $base_folder-hdpi
|
|
|
|
mkdir -p $base_folder-xhdpi
|
|
|
|
mkdir -p $base_folder-xxhdpi
|
|
|
|
mkdir -p $base_folder-xxxhdpi
|
|
|
|
inkscape "$file" --export-filename="$base_folder-mdpi/$newfile" -C --export-dpi=$dpi
|
|
|
|
inkscape "$file" --export-filename="$base_folder-hdpi/$newfile" -C --export-dpi=$(($dpi*3/2))
|
|
|
|
inkscape "$file" --export-filename="$base_folder-xhdpi/$newfile" -C --export-dpi=$(($dpi*2))
|
|
|
|
inkscape "$file" --export-filename="$base_folder-xxhdpi/$newfile" -C --export-dpi=$(($dpi*3))
|
|
|
|
inkscape "$file" --export-filename="$base_folder-xxxhdpi/$newfile" -C --export-dpi=$(($dpi*4))
|
|
|
|
}
|
|
|
|
|
2020-05-30 17:06:52 +03:00
|
|
|
dpi=96
|
|
|
|
|
|
|
|
|
|
|
|
base_folder="$mydir/../vector/src/main/res/drawable"
|
|
|
|
|
2020-07-18 16:03:15 +03:00
|
|
|
cp "$mydir/ic_launcher_sc.svg" "$mydir/riot_splash_sc.svg"
|
|
|
|
file="$mydir/riot_splash_sc.svg"
|
2020-05-30 17:06:52 +03:00
|
|
|
export_files
|
2020-07-18 16:03:15 +03:00
|
|
|
rm "$mydir/riot_splash_sc.svg"
|
2020-05-30 17:06:52 +03:00
|
|
|
|
2020-07-19 16:10:58 +03:00
|
|
|
file="$mydir/materialdesignicons/ic_status_bar_sc.svg"
|
|
|
|
export_files
|
|
|
|
|
2020-07-18 16:03:15 +03:00
|
|
|
dpi=48
|
|
|
|
cp "$mydir/ic_launcher_sc.svg" "$mydir/element_logo_sc.svg"
|
|
|
|
file="$mydir/element_logo_sc.svg"
|
2020-05-30 17:06:52 +03:00
|
|
|
export_files
|
2020-07-18 16:03:15 +03:00
|
|
|
rm "$mydir/element_logo_sc.svg"
|
2020-05-30 17:06:52 +03:00
|
|
|
|
2020-05-28 12:11:28 +03:00
|
|
|
|
2022-09-11 13:42:25 +03:00
|
|
|
base_folder="$mydir/../vector-app/src/main/res/mipmap"
|
2020-05-28 12:11:28 +03:00
|
|
|
dpi=24 # 96/4
|
|
|
|
|
2020-07-18 16:03:15 +03:00
|
|
|
file="$mydir/ic_launcher_sc.svg"
|
2020-05-28 12:11:28 +03:00
|
|
|
export_files
|
|
|
|
|
2020-07-18 16:03:15 +03:00
|
|
|
|
2022-12-03 10:57:57 +03:00
|
|
|
|
2020-07-18 16:03:15 +03:00
|
|
|
dpi=48 # 96/2
|
|
|
|
file="$mydir/ic_launcher_foreground_sc.svg"
|
2020-05-28 12:11:28 +03:00
|
|
|
export_files
|
2020-07-24 11:04:54 +03:00
|
|
|
|
|
|
|
|
2022-12-03 12:40:05 +03:00
|
|
|
## As this is just for API > 33, we don't need to export to png mipmaps, we can just directly use the drawable
|
|
|
|
# note that the monochrome svgs are also in this directory and could be directly converted to png mipmaps in the same
|
|
|
|
# way as ic_launcher_foreground_sc.svg above, but we're sticking with manually imported svg -> xml drawables
|
|
|
|
# for now to ensure high fidelity and sidestep issues with reproducibility of icon generation
|
2022-12-03 10:57:57 +03:00
|
|
|
monochrome_file_name="ic_launcher_monochrome_sc.xml"
|
|
|
|
monochrome_input_file="$mydir/$monochrome_file_name"
|
|
|
|
monochrome_output_dir="$mydir/../vector-app/src/main/res/drawable-anydpi-v26"
|
|
|
|
cp "$monochrome_input_file" "$monochrome_output_dir/$monochrome_file_name"
|
|
|
|
|
2020-07-24 11:04:54 +03:00
|
|
|
inkscape "$mydir/feature_image.svg" --export-filename="$mydir/../fastlane/metadata/android/en-US/images/featureGraphic.png" -C --export-dpi=96
|
|
|
|
inkscape "$mydir/store_icon.svg" --export-filename="$mydir/../fastlane/metadata/android/en-US/images/icon.png" -C --export-dpi=96
|