summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDeepanshu Gupta <deepanshu@google.com>2015-05-13 16:56:42 -0700
committerDeepanshu Gupta <deepanshu@google.com>2015-05-13 20:48:58 -0700
commit139d6ff12d395a888624113fdd2521861b47d761 (patch)
tree30713a2d68194374935072e743e523bd45734f5a /tools
parenteca056926a5acacbd1fe6b144df2d2952dc4a86e (diff)
downloadframeworks_base-139d6ff12d395a888624113fdd2521861b47d761.zip
frameworks_base-139d6ff12d395a888624113fdd2521861b47d761.tar.gz
frameworks_base-139d6ff12d395a888624113fdd2521861b47d761.tar.bz2
Update nav bar icons.
- Add a script to copy the icons from the original source. - Update layout used for the navigation bar to be closer to the original layout. - Update test image with the latest rendering. - Add a nexus 5 landscape device config to help with testing. Change-Id: I0b6674955e0970a6a8cce148b1b7aa61e1752ccd
Diffstat (limited to 'tools')
-rw-r--r--tools/layoutlib/bridge/resources/bars/hdpi/stat_sys_battery_100.pngbin19810 -> 0 bytes
-rw-r--r--tools/layoutlib/bridge/resources/bars/mdpi/stat_sys_battery_100.pngbin19396 -> 0 bytes
-rw-r--r--tools/layoutlib/bridge/resources/bars/navigation_bar.xml27
-rw-r--r--tools/layoutlib/bridge/resources/bars/v21/hdpi/ic_sysbar_back.pngbin2980 -> 1524 bytes
-rw-r--r--tools/layoutlib/bridge/resources/bars/v21/hdpi/ic_sysbar_home.pngbin3653 -> 1895 bytes
-rw-r--r--tools/layoutlib/bridge/resources/bars/v21/hdpi/ic_sysbar_recent.pngbin1396 -> 611 bytes
-rw-r--r--tools/layoutlib/bridge/resources/bars/v21/ldrtl-hdpi/ic_sysbar_back.pngbin3026 -> 1535 bytes
-rw-r--r--tools/layoutlib/bridge/resources/bars/v21/ldrtl-mdpi/ic_sysbar_back.pngbin1803 -> 965 bytes
-rw-r--r--tools/layoutlib/bridge/resources/bars/v21/ldrtl-xhdpi/ic_sysbar_back.pngbin4375 -> 2084 bytes
-rw-r--r--tools/layoutlib/bridge/resources/bars/v21/ldrtl-xxhdpi/ic_sysbar_back.pngbin2062 -> 1358 bytes
-rw-r--r--tools/layoutlib/bridge/resources/bars/v21/mdpi/ic_sysbar_back.pngbin1845 -> 1010 bytes
-rw-r--r--tools/layoutlib/bridge/resources/bars/v21/mdpi/ic_sysbar_home.pngbin2372 -> 1066 bytes
-rw-r--r--tools/layoutlib/bridge/resources/bars/v21/mdpi/ic_sysbar_recent.pngbin1148 -> 562 bytes
-rw-r--r--tools/layoutlib/bridge/resources/bars/v21/xhdpi/ic_sysbar_back.pngbin4218 -> 2109 bytes
-rw-r--r--tools/layoutlib/bridge/resources/bars/v21/xhdpi/ic_sysbar_home.pngbin5365 -> 2617 bytes
-rw-r--r--tools/layoutlib/bridge/resources/bars/v21/xhdpi/ic_sysbar_recent.pngbin1754 -> 733 bytes
-rw-r--r--tools/layoutlib/bridge/resources/bars/v21/xxhdpi/ic_sysbar_back.pngbin7195 -> 1279 bytes
-rw-r--r--tools/layoutlib/bridge/resources/bars/v21/xxhdpi/ic_sysbar_home.pngbin8635 -> 2125 bytes
-rw-r--r--tools/layoutlib/bridge/resources/bars/v21/xxhdpi/ic_sysbar_recent.pngbin2369 -> 573 bytes
-rw-r--r--tools/layoutlib/bridge/resources/bars/xhdpi/stat_sys_battery_100.pngbin19839 -> 0 bytes
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/NavigationBar.java70
-rw-r--r--tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/allwidgets.pngbin10472 -> 10356 bytes
-rw-r--r--tools/layoutlib/bridge/tests/src/com/android/layoutlib/bridge/intensive/setup/ConfigGenerator.java15
-rwxr-xr-xtools/layoutlib/bridge/update_nav_icons.sh51
24 files changed, 149 insertions, 14 deletions
diff --git a/tools/layoutlib/bridge/resources/bars/hdpi/stat_sys_battery_100.png b/tools/layoutlib/bridge/resources/bars/hdpi/stat_sys_battery_100.png
deleted file mode 100644
index f17189a..0000000
--- a/tools/layoutlib/bridge/resources/bars/hdpi/stat_sys_battery_100.png
+++ /dev/null
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/mdpi/stat_sys_battery_100.png b/tools/layoutlib/bridge/resources/bars/mdpi/stat_sys_battery_100.png
deleted file mode 100644
index 2a9757d..0000000
--- a/tools/layoutlib/bridge/resources/bars/mdpi/stat_sys_battery_100.png
+++ /dev/null
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/navigation_bar.xml b/tools/layoutlib/bridge/resources/bars/navigation_bar.xml
index 599ca08..79920a1 100644
--- a/tools/layoutlib/bridge/resources/bars/navigation_bar.xml
+++ b/tools/layoutlib/bridge/resources/bars/navigation_bar.xml
@@ -1,20 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
- <TextView
+ <View
android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"/>
+ android:layout_height="wrap_content"/>
<ImageView
android:layout_height="wrap_content"
- android:layout_width="wrap_content"/>
- <ImageView
+ android:layout_width="wrap_content"
+ android:scaleType="centerInside"/>
+ <View
android:layout_height="wrap_content"
- android:layout_width="wrap_content"/>
+ android:layout_width="wrap_content"
+ android:layout_weight="1"/>
<ImageView
android:layout_height="wrap_content"
- android:layout_width="wrap_content"/>
- <TextView
android:layout_width="wrap_content"
+ android:scaleType="centerInside"/>
+ <View
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:layout_weight="1"/>
+ <ImageView
android:layout_height="wrap_content"
- android:layout_weight="1"/>
+ android:layout_width="wrap_content"
+ android:scaleType="centerInside"/>
+ <View
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
</merge>
diff --git a/tools/layoutlib/bridge/resources/bars/v21/hdpi/ic_sysbar_back.png b/tools/layoutlib/bridge/resources/bars/v21/hdpi/ic_sysbar_back.png
index b28624f..d2760bb 100644
--- a/tools/layoutlib/bridge/resources/bars/v21/hdpi/ic_sysbar_back.png
+++ b/tools/layoutlib/bridge/resources/bars/v21/hdpi/ic_sysbar_back.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/v21/hdpi/ic_sysbar_home.png b/tools/layoutlib/bridge/resources/bars/v21/hdpi/ic_sysbar_home.png
index 3f3e288..df43e21 100644
--- a/tools/layoutlib/bridge/resources/bars/v21/hdpi/ic_sysbar_home.png
+++ b/tools/layoutlib/bridge/resources/bars/v21/hdpi/ic_sysbar_home.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/v21/hdpi/ic_sysbar_recent.png b/tools/layoutlib/bridge/resources/bars/v21/hdpi/ic_sysbar_recent.png
index 06dcd20..6fab1d6 100644
--- a/tools/layoutlib/bridge/resources/bars/v21/hdpi/ic_sysbar_recent.png
+++ b/tools/layoutlib/bridge/resources/bars/v21/hdpi/ic_sysbar_recent.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/v21/ldrtl-hdpi/ic_sysbar_back.png b/tools/layoutlib/bridge/resources/bars/v21/ldrtl-hdpi/ic_sysbar_back.png
index e464347..2fcfdde 100644
--- a/tools/layoutlib/bridge/resources/bars/v21/ldrtl-hdpi/ic_sysbar_back.png
+++ b/tools/layoutlib/bridge/resources/bars/v21/ldrtl-hdpi/ic_sysbar_back.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/v21/ldrtl-mdpi/ic_sysbar_back.png b/tools/layoutlib/bridge/resources/bars/v21/ldrtl-mdpi/ic_sysbar_back.png
index 1b578a6..48708a5 100644
--- a/tools/layoutlib/bridge/resources/bars/v21/ldrtl-mdpi/ic_sysbar_back.png
+++ b/tools/layoutlib/bridge/resources/bars/v21/ldrtl-mdpi/ic_sysbar_back.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/v21/ldrtl-xhdpi/ic_sysbar_back.png b/tools/layoutlib/bridge/resources/bars/v21/ldrtl-xhdpi/ic_sysbar_back.png
index 373e84a..3d73184 100644
--- a/tools/layoutlib/bridge/resources/bars/v21/ldrtl-xhdpi/ic_sysbar_back.png
+++ b/tools/layoutlib/bridge/resources/bars/v21/ldrtl-xhdpi/ic_sysbar_back.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/v21/ldrtl-xxhdpi/ic_sysbar_back.png b/tools/layoutlib/bridge/resources/bars/v21/ldrtl-xxhdpi/ic_sysbar_back.png
index 6b19593..786935d 100644
--- a/tools/layoutlib/bridge/resources/bars/v21/ldrtl-xxhdpi/ic_sysbar_back.png
+++ b/tools/layoutlib/bridge/resources/bars/v21/ldrtl-xxhdpi/ic_sysbar_back.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/v21/mdpi/ic_sysbar_back.png b/tools/layoutlib/bridge/resources/bars/v21/mdpi/ic_sysbar_back.png
index f878093..1d8c3af 100644
--- a/tools/layoutlib/bridge/resources/bars/v21/mdpi/ic_sysbar_back.png
+++ b/tools/layoutlib/bridge/resources/bars/v21/mdpi/ic_sysbar_back.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/v21/mdpi/ic_sysbar_home.png b/tools/layoutlib/bridge/resources/bars/v21/mdpi/ic_sysbar_home.png
index 8e9583b..66de0ec 100644
--- a/tools/layoutlib/bridge/resources/bars/v21/mdpi/ic_sysbar_home.png
+++ b/tools/layoutlib/bridge/resources/bars/v21/mdpi/ic_sysbar_home.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/v21/mdpi/ic_sysbar_recent.png b/tools/layoutlib/bridge/resources/bars/v21/mdpi/ic_sysbar_recent.png
index e2a89c3..30c65f5 100644
--- a/tools/layoutlib/bridge/resources/bars/v21/mdpi/ic_sysbar_recent.png
+++ b/tools/layoutlib/bridge/resources/bars/v21/mdpi/ic_sysbar_recent.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/v21/xhdpi/ic_sysbar_back.png b/tools/layoutlib/bridge/resources/bars/v21/xhdpi/ic_sysbar_back.png
index ec2951d..a356285 100644
--- a/tools/layoutlib/bridge/resources/bars/v21/xhdpi/ic_sysbar_back.png
+++ b/tools/layoutlib/bridge/resources/bars/v21/xhdpi/ic_sysbar_back.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/v21/xhdpi/ic_sysbar_home.png b/tools/layoutlib/bridge/resources/bars/v21/xhdpi/ic_sysbar_home.png
index 254f757..ba2d0b2 100644
--- a/tools/layoutlib/bridge/resources/bars/v21/xhdpi/ic_sysbar_home.png
+++ b/tools/layoutlib/bridge/resources/bars/v21/xhdpi/ic_sysbar_home.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/v21/xhdpi/ic_sysbar_recent.png b/tools/layoutlib/bridge/resources/bars/v21/xhdpi/ic_sysbar_recent.png
index 8a8e941..94a74b1 100644
--- a/tools/layoutlib/bridge/resources/bars/v21/xhdpi/ic_sysbar_recent.png
+++ b/tools/layoutlib/bridge/resources/bars/v21/xhdpi/ic_sysbar_recent.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/v21/xxhdpi/ic_sysbar_back.png b/tools/layoutlib/bridge/resources/bars/v21/xxhdpi/ic_sysbar_back.png
index 77969b8..29da099 100644
--- a/tools/layoutlib/bridge/resources/bars/v21/xxhdpi/ic_sysbar_back.png
+++ b/tools/layoutlib/bridge/resources/bars/v21/xxhdpi/ic_sysbar_back.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/v21/xxhdpi/ic_sysbar_home.png b/tools/layoutlib/bridge/resources/bars/v21/xxhdpi/ic_sysbar_home.png
index d60229f..59b32f2 100644
--- a/tools/layoutlib/bridge/resources/bars/v21/xxhdpi/ic_sysbar_home.png
+++ b/tools/layoutlib/bridge/resources/bars/v21/xxhdpi/ic_sysbar_home.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/v21/xxhdpi/ic_sysbar_recent.png b/tools/layoutlib/bridge/resources/bars/v21/xxhdpi/ic_sysbar_recent.png
index a261f85..ba66d27 100644
--- a/tools/layoutlib/bridge/resources/bars/v21/xxhdpi/ic_sysbar_recent.png
+++ b/tools/layoutlib/bridge/resources/bars/v21/xxhdpi/ic_sysbar_recent.png
Binary files differ
diff --git a/tools/layoutlib/bridge/resources/bars/xhdpi/stat_sys_battery_100.png b/tools/layoutlib/bridge/resources/bars/xhdpi/stat_sys_battery_100.png
deleted file mode 100644
index 555bcd9..0000000
--- a/tools/layoutlib/bridge/resources/bars/xhdpi/stat_sys_battery_100.png
+++ /dev/null
Binary files differ
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/NavigationBar.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/NavigationBar.java
index 04aadff..16f477b 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/NavigationBar.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/NavigationBar.java
@@ -24,6 +24,7 @@ import org.xmlpull.v1.XmlPullParserException;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.util.AttributeSet;
+import android.util.DisplayMetrics;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -32,6 +33,14 @@ public class NavigationBar extends CustomBar {
/** Navigation bar background color attribute name. */
private static final String ATTR_COLOR = "navigationBarColor";
+ // These correspond to @dimen/navigation_side_padding in the system ui code.
+ private static final int PADDING_WIDTH_DEFAULT = 36;
+ private static final int PADDING_WIDTH_SW360 = 40;
+ private static final int PADDING_WIDTH_SW400 = 50;
+ // These corresponds to @dimen/navigation_key_width in the system ui code.
+ private static final int WIDTH_DEFAULT = 36;
+ private static final int WIDTH_SW360 = 40;
+ private static final int WIDTH_SW600 = 48;
/**
* Constructor to be used when creating the {@link NavigationBar} as a regular control.
@@ -45,7 +54,7 @@ public class NavigationBar extends CustomBar {
((BridgeContext) context).getConfiguration().getLayoutDirection() ==
View.LAYOUT_DIRECTION_RTL,
(context.getApplicationInfo().flags & ApplicationInfo.FLAG_SUPPORTS_RTL) != 0,
- context.getApplicationInfo().targetSdkVersion);
+ 0);
}
public NavigationBar(BridgeContext context, Density density, int orientation, boolean isRtl,
@@ -61,19 +70,70 @@ public class NavigationBar extends CustomBar {
// We do know the order though.
// 0 is a spacer.
int back = 1;
- int recent = 3;
+ int recent = 5;
if (orientation == LinearLayout.VERTICAL || (isRtl && !rtlEnabled)) {
// If RTL is enabled, then layoutlib mirrors the layout for us.
- back = 3;
+ back = 5;
recent = 1;
}
//noinspection SpellCheckingInspection
- loadIcon(back, "ic_sysbar_back.png", density, isRtl);
+ loadIcon(back, "ic_sysbar_back.png", density, isRtl);
//noinspection SpellCheckingInspection
- loadIcon(2, "ic_sysbar_home.png", density, isRtl);
+ loadIcon(3, "ic_sysbar_home.png", density, isRtl);
//noinspection SpellCheckingInspection
loadIcon(recent, "ic_sysbar_recent.png", density, isRtl);
+ setupNavBar(context, orientation);
+ }
+
+ private void setupNavBar(BridgeContext context, int orientation) {
+ View leftPadding = getChildAt(0);
+ View rightPadding = getChildAt(6);
+ setSize(context, leftPadding, orientation, getSidePadding(context));
+ setSize(context, rightPadding, orientation, getSidePadding(context));
+ for (int i = 1; i < 6; i += 2) {
+ View navButton = getChildAt(i);
+ setSize(context, navButton, orientation, getWidth(context));
+ }
+ }
+
+ private static void setSize(BridgeContext context, View view, int orientation, int size) {
+ size *= context.getMetrics().density;
+ LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
+ if (orientation == HORIZONTAL) {
+ layoutParams.width = size;
+ } else {
+ layoutParams.height = size;
+ }
+ view.setLayoutParams(layoutParams);
+ }
+
+ private static int getSidePadding(BridgeContext context) {
+ DisplayMetrics metrics = context.getMetrics();
+ float sw = metrics.widthPixels > metrics.heightPixels
+ ? metrics.heightPixels : metrics.widthPixels;
+ sw /= metrics.density;
+ if (sw >= 400) {
+ return PADDING_WIDTH_SW400;
+ }
+ if (sw >= 360) {
+ return PADDING_WIDTH_SW360;
+ }
+ return PADDING_WIDTH_DEFAULT;
+ }
+
+ private static int getWidth(BridgeContext context) {
+ DisplayMetrics metrics = context.getMetrics();
+ float sw = metrics.widthPixels > metrics.heightPixels
+ ? metrics.heightPixels : metrics.widthPixels;
+ sw /= metrics.density;
+ if (sw >= 600) {
+ return WIDTH_SW600;
+ }
+ if (sw >= 360) {
+ return WIDTH_SW360;
+ }
+ return WIDTH_DEFAULT;
}
@Override
diff --git a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/allwidgets.png b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/allwidgets.png
index cb72550..2b86bfb 100644
--- a/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/allwidgets.png
+++ b/tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/allwidgets.png
Binary files differ
diff --git a/tools/layoutlib/bridge/tests/src/com/android/layoutlib/bridge/intensive/setup/ConfigGenerator.java b/tools/layoutlib/bridge/tests/src/com/android/layoutlib/bridge/intensive/setup/ConfigGenerator.java
index 1191df6..8964c45 100644
--- a/tools/layoutlib/bridge/tests/src/com/android/layoutlib/bridge/intensive/setup/ConfigGenerator.java
+++ b/tools/layoutlib/bridge/tests/src/com/android/layoutlib/bridge/intensive/setup/ConfigGenerator.java
@@ -111,6 +111,21 @@ public class ConfigGenerator {
.setSoftButtons(true)
.setNavigation(Navigation.NONAV);
+ public static final ConfigGenerator NEXUS_5_LAND = new ConfigGenerator()
+ .setScreenHeight(1080)
+ .setScreenWidth(1920)
+ .setXdpi(445)
+ .setYdpi(445)
+ .setOrientation(ScreenOrientation.LANDSCAPE)
+ .setDensity(Density.XXHIGH)
+ .setRatio(ScreenRatio.NOTLONG)
+ .setSize(ScreenSize.NORMAL)
+ .setKeyboard(Keyboard.NOKEY)
+ .setTouchScreen(TouchScreen.FINGER)
+ .setKeyboardState(KeyboardState.SOFT)
+ .setSoftButtons(true)
+ .setNavigation(Navigation.NONAV);
+
private static final String TAG_ATTR = "attr";
private static final String TAG_ENUM = "enum";
private static final String TAG_FLAG = "flag";
diff --git a/tools/layoutlib/bridge/update_nav_icons.sh b/tools/layoutlib/bridge/update_nav_icons.sh
new file mode 100755
index 0000000..7030d19
--- /dev/null
+++ b/tools/layoutlib/bridge/update_nav_icons.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+# copies the navigation bar icons from system ui code to layoutlib.
+# to run, simply execute the script. (if not using bash, cd to the dir
+# containing this script and then run by ./update_nav_icons.sh)
+
+# Try to get the location of this script.
+if [ -n $BASH ]; then
+ # see http://stackoverflow.com/a/246128/1546000
+ MY_LOCATION=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+ cd $MY_LOCATION
+else
+ # Let's assume script was run from the same dir.
+ MY_LOCATION=$(pwd)
+fi
+
+# Check mac or linux to get sed argument to enable extended regex.
+case $(uname -s) in
+ Darwin)
+ EXT_REGEX="-E"
+ ;;
+ *)
+ EXT_REGEX="-r"
+ ;;
+esac
+
+
+FB="frameworks/base"
+# frameworks/base relative to current location
+FB=$(echo $MY_LOCATION | sed $EXT_REGEX -e "s,.*$FB[^/]*/,," -e "s,[^/]+,..,g")
+CURRENT_API=21 # update only if icons change from this api version.
+DENSITIES="ldpi mdpi hdpi xhdpi xxhdpi"
+ICONS="ic_sysbar_back.png ic_sysbar_home.png ic_sysbar_recent.png"
+BARS="./resources/bars/"
+
+for icon in $ICONS
+do
+ for density in $DENSITIES
+ do
+ destination="$BARS/v$CURRENT_API/$density/"
+ mkdir -p "$destination" # create if not present.
+ cp -v "$FB/packages/SystemUI/res/drawable-$density/$icon" "$destination"
+ done
+
+ for density in $DENSITIES
+ do
+ destination="$BARS/v$CURRENT_API/ldrtl-$density/"
+ mkdir -p "$destination"
+ cp -v "$FB/packages/SystemUI/res/drawable-ldrtl-$density/$icon" "$destination"
+ done
+done