From 5298582717494098fcdf115d832c8e871340d0b5 Mon Sep 17 00:00:00 2001
From: Daniel Sandler <dsandler@android.com>
Date: Fri, 29 Jul 2011 08:42:15 -0400
Subject: Bring the shiny navigation button animations to phones.

Also fix the accessibility descriptions (bad merge?).

Bug: 4541219
Change-Id: I8a8e2a14e5557c45af0b9e74b0bd654ff804aab9
---
 .../res/drawable-hdpi/ic_sysbar_highlight_land.png | Bin 0 -> 2635 bytes
 .../res/drawable-mdpi/ic_sysbar_highlight_land.png | Bin 0 -> 2065 bytes
 .../drawable-xhdpi/ic_sysbar_highlight_land.png    | Bin 0 -> 3879 bytes
 packages/SystemUI/res/layout/navigation_bar.xml    |  33 +++++++++++++++++----
 packages/SystemUI/res/values/strings.xml           |   2 ++
 .../systemui/statusbar/policy/KeyButtonView.java   |  11 +++----
 6 files changed, 35 insertions(+), 11 deletions(-)
 create mode 100644 packages/SystemUI/res/drawable-hdpi/ic_sysbar_highlight_land.png
 create mode 100644 packages/SystemUI/res/drawable-mdpi/ic_sysbar_highlight_land.png
 create mode 100644 packages/SystemUI/res/drawable-xhdpi/ic_sysbar_highlight_land.png

(limited to 'packages')

diff --git a/packages/SystemUI/res/drawable-hdpi/ic_sysbar_highlight_land.png b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_highlight_land.png
new file mode 100644
index 0000000..d050b1c
Binary files /dev/null and b/packages/SystemUI/res/drawable-hdpi/ic_sysbar_highlight_land.png differ
diff --git a/packages/SystemUI/res/drawable-mdpi/ic_sysbar_highlight_land.png b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_highlight_land.png
new file mode 100644
index 0000000..6f3f5fa
Binary files /dev/null and b/packages/SystemUI/res/drawable-mdpi/ic_sysbar_highlight_land.png differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_highlight_land.png b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_highlight_land.png
new file mode 100644
index 0000000..97a07fa
Binary files /dev/null and b/packages/SystemUI/res/drawable-xhdpi/ic_sysbar_highlight_land.png differ
diff --git a/packages/SystemUI/res/layout/navigation_bar.xml b/packages/SystemUI/res/layout/navigation_bar.xml
index 37d390a..6732fee 100644
--- a/packages/SystemUI/res/layout/navigation_bar.xml
+++ b/packages/SystemUI/res/layout/navigation_bar.xml
@@ -35,6 +35,8 @@
             android:layout_height="match_parent"
             android:layout_width="match_parent"
             android:orientation="horizontal"
+            android:clipChildren="false"
+            android:clipToPadding="false"
             >
 
             <!-- navigation controls -->
@@ -42,6 +44,7 @@
                 android:layout_width="40dp"
                 android:layout_height="match_parent"
                 android:layout_weight="0"
+                android:visibility="invisible"
                 />
             <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back"
                 android:layout_width="80dp"
@@ -49,12 +52,14 @@
                 android:src="@drawable/ic_sysbar_back"
                 systemui:keyCode="4"
                 android:layout_weight="0"
+                systemui:glowBackground="@drawable/ic_sysbar_highlight"
+                android:contentDescription="@string/accessibility_back"
                 />
             <View 
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
                 android:layout_weight="1"
-                android:contentDescription="@string/accessibility_back"
+                android:visibility="invisible"
                 />
             <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home"
                 android:layout_width="80dp"
@@ -62,18 +67,22 @@
                 android:src="@drawable/ic_sysbar_home"
                 systemui:keyCode="3"
                 android:layout_weight="0"
+                systemui:glowBackground="@drawable/ic_sysbar_highlight"
+                android:contentDescription="@string/accessibility_home"
                 />
             <View 
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
                 android:layout_weight="1"
-                android:contentDescription="@string/accessibility_home"
+                android:visibility="invisible"
                 />
             <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/recent_apps"
                 android:layout_width="80dp"
                 android:layout_height="match_parent"
                 android:src="@drawable/ic_sysbar_recent"
                 android:layout_weight="0"
+                systemui:glowBackground="@drawable/ic_sysbar_highlight"
+                android:contentDescription="@string/accessibility_recent"
                 />
             <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
                 android:layout_width="40dp"
@@ -83,6 +92,7 @@
                 android:layout_weight="0"
                 android:visibility="invisible"
                 android:contentDescription="@string/accessibility_menu"
+                systemui:glowBackground="@drawable/ic_sysbar_highlight"
                 />
         </LinearLayout>
 
@@ -106,6 +116,8 @@
             android:layout_height="match_parent"
             android:layout_width="match_parent"
             android:orientation="vertical"
+            android:clipChildren="false"
+            android:clipToPadding="false"
             >
             
             <!-- navigation controls -->
@@ -117,17 +129,19 @@
                 android:layout_weight="0"
                 android:visibility="invisible"
                 />
-            <ImageView android:id="@+id/recent_apps"
+            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/recent_apps"
                 android:layout_height="80dp"
                 android:layout_width="match_parent"
                 android:src="@drawable/ic_sysbar_recent_land"
                 android:layout_weight="0"
+                android:contentDescription="@string/accessibility_recent"
+                systemui:glowBackground="@drawable/ic_sysbar_highlight_land"
                 />
             <View 
                 android:layout_height="match_parent"
                 android:layout_width="match_parent"
                 android:layout_weight="1"
-                android:contentDescription="@string/accessibility_menu"
+                android:visibility="invisible"
                 />
             <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home"
                 android:layout_height="80dp"
@@ -136,12 +150,13 @@
                 systemui:keyCode="3"
                 android:layout_weight="0"
                 android:contentDescription="@string/accessibility_home"
+                systemui:glowBackground="@drawable/ic_sysbar_highlight_land"
                 />
             <View 
                 android:layout_height="match_parent"
                 android:layout_width="match_parent"
                 android:layout_weight="1"
-                android:contentDescription="@string/accessibility_back"
+                android:visibility="invisible"
                 />
             <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back"
                 android:layout_height="80dp"
@@ -149,12 +164,18 @@
                 android:src="@drawable/ic_sysbar_back_land"
                 systemui:keyCode="4"
                 android:layout_weight="0"
+                android:contentDescription="@string/accessibility_back"
+                systemui:glowBackground="@drawable/ic_sysbar_highlight_land"
                 />
-            <View
+            <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/menu"
                 android:layout_height="40dp"
                 android:layout_width="match_parent"
+                android:src="@drawable/ic_sysbar_menu_land"
+                systemui:keyCode="82"
                 android:layout_weight="0"
+                android:visibility="invisible"
                 android:contentDescription="@string/accessibility_menu"
+                systemui:glowBackground="@drawable/ic_sysbar_highlight_land"
                 />
         </LinearLayout>
 
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 5ca77fc..2b3118d 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -185,6 +185,8 @@
     <string name="accessibility_home">Home</string>
     <!-- Content description of the menu button for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
     <string name="accessibility_menu">Menu</string>
+    <!-- Content description of the recents button for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
+    <string name="accessibility_recent">Recent applications</string>
 
     <!-- Content description of the switch input method button for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
     <string name="accessibility_ime_switch_button">Switch input method button.</string>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
index 87fbbb7..38a1029 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
@@ -159,13 +159,14 @@ public class KeyButtonView extends ImageView {
         if (x < 1.0f) {
             invalidate();
         } else {
-            x = (w * (x - 1.0f)) / 2.0f;
+            final float rx = (w * (x - 1.0f)) / 2.0f;
+            final float ry = (h * (x - 1.0f)) / 2.0f;
             com.android.systemui.SwipeHelper.invalidateGlobalRegion(
                     this,
-                    new RectF(getLeft() - x,
-                              getTop() - x,
-                              getRight() + x,
-                              getBottom() + x));
+                    new RectF(getLeft() - rx,
+                              getTop() - ry,
+                              getRight() + rx,
+                              getBottom() + ry));
         }
     }
 
-- 
cgit v1.1