Skip to content

Instantly share code, notes, and snippets.

@markusfisch
Last active June 29, 2019 00:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save markusfisch/6395d486ce7344c8fcf251dacee0963d to your computer and use it in GitHub Desktop.
Save markusfisch/6395d486ce7344c8fcf251dacee0963d to your computer and use it in GitHub Desktop.
Put a badge on the launcher icons for another Android build
#!/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