1139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta#!/bin/sh
2139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta
3139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta# copies the navigation bar icons from system ui code to layoutlib.
4139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta# to run, simply execute the script. (if not using bash, cd to the dir
5139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta# containing this script and then run by ./update_nav_icons.sh)
6139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta
7139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta# Try to get the location of this script.
8139d6ff12d395a888624113fdd2521861b47d761Deepanshu Guptaif [ -n $BASH ]; then
9139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta  # see http://stackoverflow.com/a/246128/1546000
10139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta  MY_LOCATION=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
11139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta  cd $MY_LOCATION
12139d6ff12d395a888624113fdd2521861b47d761Deepanshu Guptaelse
13139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta  # Let's assume script was run from the same dir.
14139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta  MY_LOCATION=$(pwd)
15139d6ff12d395a888624113fdd2521861b47d761Deepanshu Guptafi
16139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta
17139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta# Check mac or linux to get sed argument to enable extended regex.
18139d6ff12d395a888624113fdd2521861b47d761Deepanshu Guptacase $(uname -s) in
19139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta  Darwin)
20139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta    EXT_REGEX="-E"
21139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta    ;;
22139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta  *)
23139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta    EXT_REGEX="-r"
24139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta    ;;
25139d6ff12d395a888624113fdd2521861b47d761Deepanshu Guptaesac
26139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta
27139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta
28139d6ff12d395a888624113fdd2521861b47d761Deepanshu GuptaFB="frameworks/base"
29139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta# frameworks/base relative to current location
30139d6ff12d395a888624113fdd2521861b47d761Deepanshu GuptaFB=$(echo $MY_LOCATION | sed $EXT_REGEX -e "s,.*$FB[^/]*/,," -e "s,[^/]+,..,g")
31139d6ff12d395a888624113fdd2521861b47d761Deepanshu GuptaCURRENT_API=21  # update only if icons change from this api version.
32139d6ff12d395a888624113fdd2521861b47d761Deepanshu GuptaDENSITIES="ldpi mdpi hdpi xhdpi xxhdpi"
33139d6ff12d395a888624113fdd2521861b47d761Deepanshu GuptaICONS="ic_sysbar_back.png ic_sysbar_home.png ic_sysbar_recent.png"
34139d6ff12d395a888624113fdd2521861b47d761Deepanshu GuptaBARS="./resources/bars/"
35139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta
36139d6ff12d395a888624113fdd2521861b47d761Deepanshu Guptafor icon in $ICONS
37139d6ff12d395a888624113fdd2521861b47d761Deepanshu Guptado
38139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta  for density in $DENSITIES
39139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta  do
40139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta    destination="$BARS/v$CURRENT_API/$density/"
41139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta    mkdir -p "$destination"  # create if not present.
42139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta    cp -v "$FB/packages/SystemUI/res/drawable-$density/$icon" "$destination"
43139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta  done
44139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta
45139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta  for density in $DENSITIES
46139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta  do
47139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta    destination="$BARS/v$CURRENT_API/ldrtl-$density/"
48139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta    mkdir -p "$destination"
49139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta    cp -v "$FB/packages/SystemUI/res/drawable-ldrtl-$density/$icon" "$destination"
50139d6ff12d395a888624113fdd2521861b47d761Deepanshu Gupta    done
51139d6ff12d395a888624113fdd2521861b47d761Deepanshu Guptadone
52