Last active
June 29, 2019 00:48
-
-
Save markusfisch/6395d486ce7344c8fcf251dacee0963d to your computer and use it in GitHub Desktop.
Put a badge on the launcher icons for another Android build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Put given badge on launcher icons for another build | |
# | |
# @param 1 - badge overlay | |
# @param 2 - build name (and local directory) | |
badge() | |
{ | |
local BADGE=$1 | |
local BUILD=$2 | |
local F | |
for F in main/res/mipmap-*/ic_launcher.png | |
do | |
local D="${F//main/$BUILD}" | |
D=${D%/*} | |
[ -d "$D" ] || mkdir -p "$D" || return $? | |
convert "$F" \ | |
"$BADGE"\ | |
-geometry $(identify -format '%wx%h' "$F") \ | |
-composite \ | |
"${F//main/$BUILD}" | |
done | |
} | |
if [ "$0" == "${BASH_SOURCE[0]}" ] | |
then | |
if (( $# < 2 )) | |
then | |
echo "usage: ${0##*/} BADGE BUILD" | |
else | |
badge "$@" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment