Home | History | Annotate | Download | only in bridge
      1 #!/bin/sh
      2 
      3 # copies the navigation bar icons from system ui code to layoutlib.
      4 # to run, simply execute the script. (if not using bash, cd to the dir
      5 # containing this script and then run by ./update_nav_icons.sh)
      6 
      7 # Try to get the location of this script.
      8 if [ -n $BASH ]; then
      9   # see http://stackoverflow.com/a/246128/1546000
     10   MY_LOCATION=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
     11   cd $MY_LOCATION
     12 else
     13   # Let's assume script was run from the same dir.
     14   MY_LOCATION=$(pwd)
     15 fi
     16 
     17 # Check mac or linux to get sed argument to enable extended regex.
     18 case $(uname -s) in
     19   Darwin)
     20     EXT_REGEX="-E"
     21     ;;
     22   *)
     23     EXT_REGEX="-r"
     24     ;;
     25 esac
     26 
     27 
     28 FB="frameworks/base"
     29 # frameworks/base relative to current location
     30 FB=$(echo $MY_LOCATION | sed $EXT_REGEX -e "s,.*$FB[^/]*/,," -e "s,[^/]+,..,g")
     31 CURRENT_API=21  # update only if icons change from this api version.
     32 DENSITIES="ldpi mdpi hdpi xhdpi xxhdpi"
     33 ICONS="ic_sysbar_back.png ic_sysbar_home.png ic_sysbar_recent.png"
     34 BARS="./resources/bars/"
     35 
     36 for icon in $ICONS
     37 do
     38   for density in $DENSITIES
     39   do
     40     destination="$BARS/v$CURRENT_API/$density/"
     41     mkdir -p "$destination"  # create if not present.
     42     cp -v "$FB/packages/SystemUI/res/drawable-$density/$icon" "$destination"
     43   done
     44 
     45   for density in $DENSITIES
     46   do
     47     destination="$BARS/v$CURRENT_API/ldrtl-$density/"
     48     mkdir -p "$destination"
     49     cp -v "$FB/packages/SystemUI/res/drawable-ldrtl-$density/$icon" "$destination"
     50     done
     51 done
     52