Merge "Updating layout of search buttons" into honeycomb
diff --git a/res/drawable-xlarge-hdpi/search_button_normal.png b/res/drawable-xlarge-hdpi/search_button_normal.png
deleted file mode 100644
index b1df556..0000000
--- a/res/drawable-xlarge-hdpi/search_button_normal.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xlarge-hdpi/search_button_pressed.png b/res/drawable-xlarge-hdpi/search_button_pressed.png
deleted file mode 100644
index 1013383..0000000
--- a/res/drawable-xlarge-hdpi/search_button_pressed.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xlarge-hdpi/textfield_home_end.9.png b/res/drawable-xlarge-hdpi/textfield_home_end.9.png
deleted file mode 100644
index 4e79920..0000000
--- a/res/drawable-xlarge-hdpi/textfield_home_end.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xlarge-hdpi/textfield_home_start.9.png b/res/drawable-xlarge-hdpi/textfield_home_start.9.png
deleted file mode 100644
index a338c69..0000000
--- a/res/drawable-xlarge-hdpi/textfield_home_start.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xlarge-mdpi/ic_generic_search.png b/res/drawable-xlarge-mdpi/ic_generic_search.png
new file mode 100644
index 0000000..d92071b
--- /dev/null
+++ b/res/drawable-xlarge-mdpi/ic_generic_search.png
Binary files differ
diff --git a/res/drawable-xlarge-mdpi/search_button_normal.png b/res/drawable-xlarge-mdpi/search_button_normal.png
deleted file mode 100644
index b172074..0000000
--- a/res/drawable-xlarge-mdpi/search_button_normal.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xlarge-mdpi/search_button_pressed.png b/res/drawable-xlarge-mdpi/search_button_pressed.png
deleted file mode 100644
index c2926c8..0000000
--- a/res/drawable-xlarge-mdpi/search_button_pressed.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xlarge-mdpi/textfield_home_end.9.png b/res/drawable-xlarge-mdpi/textfield_home_end.9.png
deleted file mode 100644
index 753514f..0000000
--- a/res/drawable-xlarge-mdpi/textfield_home_end.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xlarge-mdpi/textfield_home_start.9.png b/res/drawable-xlarge-mdpi/textfield_home_start.9.png
deleted file mode 100644
index 11ee7ca..0000000
--- a/res/drawable-xlarge-mdpi/textfield_home_start.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xlarge/search_button_generic.xml b/res/drawable-xlarge/search_button_generic.xml
deleted file mode 100644
index 8f18e67..0000000
--- a/res/drawable-xlarge/search_button_generic.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:state_pressed="true" android:drawable="@drawable/search_button_pressed" />
-    <item android:drawable="@drawable/search_button_normal" />
-</selector>
diff --git a/res/layout-xlarge-land/launcher.xml b/res/layout-xlarge-land/launcher.xml
index 93d19dc..c76516e 100644
--- a/res/layout-xlarge-land/launcher.xml
+++ b/res/layout-xlarge-land/launcher.xml
@@ -54,54 +54,51 @@
         android:layout_height="?android:attr/actionBarSize"
         android:layout_gravity="top">
 
-        <LinearLayout android:id="@+id/search_button_cluster"
+       <!-- Global search icon -->
+       <ImageView
+           android:id="@+id/search_button"
+           android:layout_width="wrap_content"
+           android:layout_height="wrap_content"
+           android:layout_alignParentTop="true"
+           android:layout_alignParentLeft="true"
+           android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
+           android:paddingRight="@dimen/toolbar_button_horizontal_padding"
+           android:paddingTop="@dimen/toolbar_button_vertical_padding"
+           android:paddingBottom="@dimen/toolbar_button_vertical_padding"
+           android:src="@drawable/ic_generic_search"
+           android:background="@drawable/button_bg"
+           android:onClick="onClickSearchButton"
+           android:focusable="true"
+           android:clickable="true" />
+           
+        <ImageView
+            android:id="@+id/search_divider"
+            android:src="@drawable/divider_launcher_holo"
             android:layout_width="wrap_content"
-            android:layout_height="48dp"
-            android:gravity="bottom"
-            >
-            <LinearLayout
-                android:layout_width="wrap_content"
-                android:layout_height="match_parent"
-                android:layout_marginLeft="16dp"
-                android:background="@drawable/textfield_home_start"
-                android:orientation="horizontal">
-                <!-- Global search icon -->
-                <ImageView
-                    android:id="@+id/search_button"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_gravity="bottom"
-                    android:paddingLeft="8dp"
-                    android:paddingRight="32dp"
-                    android:paddingTop="12dp"
-                    android:src="@drawable/search_button_generic"
-                    android:background="@drawable/button_bg"
-                    android:onClick="onClickSearchButton"
-                    android:focusable="true"
-                    android:clickable="true"/>
-            </LinearLayout>
+            android:layout_height="@dimen/toolbar_divider_height"
+            android:layout_toRightOf="@id/search_button"
+            android:paddingTop="@dimen/toolbar_button_vertical_padding"
+            android:paddingBottom="@dimen/toolbar_button_vertical_padding"
 
-            <LinearLayout
-                android:layout_width="wrap_content"
-                android:layout_height="match_parent"
-                android:background="@drawable/textfield_home_end"
-                android:orientation="horizontal">
-                <!-- Voice search icon -->
-                <ImageView
-                    android:id="@+id/voice_button"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_gravity="bottom"
-                    android:paddingLeft="24dp"
-                    android:paddingRight="24dp"
-                    android:paddingTop="12dp"
-                    android:src="@drawable/ic_voice_search"
-                    android:background="@drawable/button_bg"
-                    android:onClick="onClickVoiceButton"
-                    android:focusable="true"
-                    android:clickable="true"/>
-            </LinearLayout>
-        </LinearLayout>
+            android:onClick="onClickAllAppsButton"
+            android:focusable="true"
+            android:clickable="true" />
+
+        <!-- Voice search icon -->
+        <ImageView
+            android:id="@+id/voice_button"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_toRightOf="@id/search_divider"
+            android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
+            android:paddingRight="@dimen/toolbar_button_horizontal_padding"
+            android:paddingTop="@dimen/toolbar_button_vertical_padding"
+            android:paddingBottom="@dimen/toolbar_button_vertical_padding"
+            android:src="@drawable/ic_voice_search"
+            android:background="@drawable/button_bg"
+            android:onClick="onClickVoiceButton"
+            android:focusable="true"
+            android:clickable="true"/>
 
         <ImageView
             android:id="@+id/configure_button"
diff --git a/res/layout-xlarge-port/launcher.xml b/res/layout-xlarge-port/launcher.xml
index 6ad5d9c..3b499d9 100644
--- a/res/layout-xlarge-port/launcher.xml
+++ b/res/layout-xlarge-port/launcher.xml
@@ -54,54 +54,51 @@
         android:layout_height="?android:attr/actionBarSize"
         android:layout_gravity="top">
 
-        <LinearLayout android:id="@+id/search_button_cluster"
+       <!-- Global search icon -->
+       <ImageView
+           android:id="@+id/search_button"
+           android:layout_width="wrap_content"
+           android:layout_height="wrap_content"
+           android:layout_alignParentTop="true"
+           android:layout_alignParentLeft="true"
+           android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
+           android:paddingRight="@dimen/toolbar_button_horizontal_padding"
+           android:paddingTop="@dimen/toolbar_button_vertical_padding"
+           android:paddingBottom="@dimen/toolbar_button_vertical_padding"
+           android:src="@drawable/ic_generic_search"
+           android:background="@drawable/button_bg"
+           android:onClick="onClickSearchButton"
+           android:focusable="true"
+           android:clickable="true" />
+           
+        <ImageView
+            android:id="@+id/search_divider"
+            android:src="@drawable/divider_launcher_holo"
             android:layout_width="wrap_content"
-            android:layout_height="48dp"
-            android:gravity="bottom"
-            >
-            <LinearLayout
-                android:layout_width="wrap_content"
-                android:layout_height="match_parent"
-                android:layout_marginLeft="16dp"
-                android:background="@drawable/textfield_home_start"
-                android:orientation="horizontal">
-                <!-- Global search icon -->
-                <ImageView
-                    android:id="@+id/search_button"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_gravity="bottom"
-                    android:paddingLeft="8dp"
-                    android:paddingRight="32dp"
-                    android:paddingTop="12dp"
-                    android:src="@drawable/search_button_generic"
-                    android:background="@drawable/button_bg"
-                    android:onClick="onClickSearchButton"
-                    android:focusable="true"
-                    android:clickable="true"/>
-            </LinearLayout>
+            android:layout_height="@dimen/toolbar_divider_height"
+            android:layout_toRightOf="@id/search_button"
+            android:paddingTop="@dimen/toolbar_button_vertical_padding"
+            android:paddingBottom="@dimen/toolbar_button_vertical_padding"
 
-            <LinearLayout
-                android:layout_width="wrap_content"
-                android:layout_height="match_parent"
-                android:background="@drawable/textfield_home_end"
-                android:orientation="horizontal">
-                <!-- Voice search icon -->
-                <ImageView
-                    android:id="@+id/voice_button"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_gravity="bottom"
-                    android:paddingLeft="24dp"
-                    android:paddingRight="24dp"
-                    android:paddingTop="12dp"
-                    android:src="@drawable/ic_voice_search"
-                    android:background="@drawable/button_bg"
-                    android:onClick="onClickVoiceButton"
-                    android:focusable="true"
-                    android:clickable="true"/>
-            </LinearLayout>
-        </LinearLayout>
+            android:onClick="onClickAllAppsButton"
+            android:focusable="true"
+            android:clickable="true" />
+
+        <!-- Voice search icon -->
+        <ImageView
+            android:id="@+id/voice_button"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_toRightOf="@id/search_divider"
+            android:paddingLeft="@dimen/toolbar_button_horizontal_padding"
+            android:paddingRight="@dimen/toolbar_button_horizontal_padding"
+            android:paddingTop="@dimen/toolbar_button_vertical_padding"
+            android:paddingBottom="@dimen/toolbar_button_vertical_padding"
+            android:src="@drawable/ic_voice_search"
+            android:background="@drawable/button_bg"
+            android:onClick="onClickVoiceButton"
+            android:focusable="true"
+            android:clickable="true"/>
 
         <ImageView
             android:id="@+id/configure_button"
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 1a7067e..966f2e7 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -2598,7 +2598,9 @@
      * @param hideSeq AnimatorSet in which to put "hide" animations, or null.
      */
     private void hideAndShowToolbarButtons(State newState, AnimatorSet showSeq, AnimatorSet hideSeq) {
-        final View searchButton = findViewById(R.id.search_button_cluster);
+        final View searchButton = findViewById(R.id.search_button);
+        final View searchDivider = findViewById(R.id.search_divider);
+        final View voiceSearchButton = findViewById(R.id.voice_button);
         final View allAppsButton = findViewById(R.id.all_apps_button);
         final View divider = findViewById(R.id.divider);
         final View configureButton = findViewById(R.id.configure_button);
@@ -2606,6 +2608,8 @@
         switch (newState) {
         case WORKSPACE:
             hideOrShowToolbarButton(true, searchButton, showSeq);
+            hideOrShowToolbarButton(true, searchDivider, showSeq);
+            hideOrShowToolbarButton(true, voiceSearchButton, showSeq);
             hideOrShowToolbarButton(true, allAppsButton, showSeq);
             hideOrShowToolbarButton(true, divider, showSeq);
             hideOrShowToolbarButton(true, configureButton, showSeq);
@@ -2615,7 +2619,9 @@
             break;
         case ALL_APPS:
             hideOrShowToolbarButton(false, configureButton, hideSeq);
+            hideOrShowToolbarButton(false, searchDivider, hideSeq);
             hideOrShowToolbarButton(false, searchButton, hideSeq);
+            hideOrShowToolbarButton(false, voiceSearchButton, hideSeq);
             hideOrShowToolbarButton(false, divider, hideSeq);
             hideOrShowToolbarButton(false, allAppsButton, hideSeq);
             mDeleteZone.setDragAndDropEnabled(false);
@@ -2623,7 +2629,9 @@
             break;
         case CUSTOMIZE:
             hideOrShowToolbarButton(false, allAppsButton, hideSeq);
+            hideOrShowToolbarButton(false, searchDivider, hideSeq);
             hideOrShowToolbarButton(false, searchButton, hideSeq);
+            hideOrShowToolbarButton(false, voiceSearchButton, hideSeq);
             hideOrShowToolbarButton(false, divider, hideSeq);
             hideOrShowToolbarButton(false, configureButton, hideSeq);
             mDeleteZone.setDragAndDropEnabled(false);
@@ -3106,7 +3114,7 @@
             ComponentName activityName = searchManager.getGlobalSearchActivity();
             if (activityName != null) {
                 sGlobalSearchIcon = updateButtonWithIconFromExternalActivity(
-                        R.id.search_button, activityName, R.drawable.search_button_generic);
+                        R.id.search_button, activityName, R.drawable.ic_generic_search);
             } else {
                 findViewById(R.id.search_button).setVisibility(View.GONE);
             }