Adding QSB

- Also changing AppsCustomize bg to black.

Change-Id: Iadd1a34dda56b02191e00502714296a1a3c8ee88
diff --git a/res/drawable-large-hdpi/divider_launcher_holo.9.png b/res/drawable-hdpi/divider_launcher_holo.9.png
similarity index 100%
rename from res/drawable-large-hdpi/divider_launcher_holo.9.png
rename to res/drawable-hdpi/divider_launcher_holo.9.png
Binary files differ
diff --git a/res/drawable-large-hdpi/ic_generic_search.png b/res/drawable-hdpi/ic_generic_search.png
similarity index 100%
rename from res/drawable-large-hdpi/ic_generic_search.png
rename to res/drawable-hdpi/ic_generic_search.png
Binary files differ
diff --git a/res/drawable-large-hdpi/ic_voice_search.png b/res/drawable-hdpi/ic_voice_search.png
similarity index 100%
rename from res/drawable-large-hdpi/ic_voice_search.png
rename to res/drawable-hdpi/ic_voice_search.png
Binary files differ
diff --git a/res/drawable-land-hdpi/divider_launcher_holo.9.png b/res/drawable-land-hdpi/divider_launcher_holo.9.png
new file mode 100644
index 0000000..f07f6c4
--- /dev/null
+++ b/res/drawable-land-hdpi/divider_launcher_holo.9.png
Binary files differ
diff --git a/res/drawable-land-mdpi/divider_launcher_holo.9.png b/res/drawable-land-mdpi/divider_launcher_holo.9.png
new file mode 100644
index 0000000..ae77340
--- /dev/null
+++ b/res/drawable-land-mdpi/divider_launcher_holo.9.png
Binary files differ
diff --git a/res/drawable-large-mdpi/divider_launcher_holo.9.png b/res/drawable-mdpi/divider_launcher_holo.9.png
similarity index 100%
rename from res/drawable-large-mdpi/divider_launcher_holo.9.png
rename to res/drawable-mdpi/divider_launcher_holo.9.png
Binary files differ
diff --git a/res/drawable-large-mdpi/ic_generic_search.png b/res/drawable-mdpi/ic_generic_search.png
similarity index 100%
rename from res/drawable-large-mdpi/ic_generic_search.png
rename to res/drawable-mdpi/ic_generic_search.png
Binary files differ
diff --git a/res/drawable-large-mdpi/ic_voice_search.png b/res/drawable-mdpi/ic_voice_search.png
similarity index 100%
rename from res/drawable-large-mdpi/ic_voice_search.png
rename to res/drawable-mdpi/ic_voice_search.png
Binary files differ
diff --git a/res/layout-land/launcher.xml b/res/layout-land/launcher.xml
index b2b2c9f..c8a82e6 100644
--- a/res/layout-land/launcher.xml
+++ b/res/layout-land/launcher.xml
@@ -41,6 +41,12 @@
 
     </com.android.launcher2.Workspace>
 
+    <include layout="@layout/qsb_bar"
+        android:id="@+id/qsb_bar"
+        android:layout_width="@dimen/qsb_bar_height"
+        android:layout_height="match_parent"
+        android:layout_gravity="left" />
+
     <include layout="@layout/apps_customize_pane"
         android:id="@+id/apps_customize_pane"
         android:layout_width="match_parent"
diff --git a/res/layout-land/workspace_screen.xml b/res/layout-land/workspace_screen.xml
index f2bac59..a9faf89 100644
--- a/res/layout-land/workspace_screen.xml
+++ b/res/layout-land/workspace_screen.xml
@@ -24,7 +24,7 @@
 
     launcher:cellWidth="@dimen/workspace_cell_width"
     launcher:cellHeight="@dimen/workspace_cell_height"
-    launcher:xAxisStartPadding="48dip"
+    launcher:xAxisStartPadding="@dimen/qsb_bar_height"
     launcher:xAxisEndPadding="0dip"
     launcher:yAxisStartPadding="0dip"
     launcher:yAxisEndPadding="0dip"/>
diff --git a/res/layout-port/launcher.xml b/res/layout-port/launcher.xml
index c7bcbb0..f05f9b6 100644
--- a/res/layout-port/launcher.xml
+++ b/res/layout-port/launcher.xml
@@ -36,9 +36,14 @@
         <include android:id="@+id/cell3" layout="@layout/workspace_screen" />
         <include android:id="@+id/cell4" layout="@layout/workspace_screen" />
         <include android:id="@+id/cell5" layout="@layout/workspace_screen" />
-                
     </com.android.launcher2.Workspace>
 
+    <include layout="@layout/qsb_bar"
+        android:id="@+id/qsb_bar"
+        android:layout_width="fill_parent"
+        android:layout_height="@dimen/qsb_bar_height"
+        android:layout_gravity="top" />
+
     <include layout="@layout/apps_customize_pane"
         android:id="@+id/apps_customize_pane"
         android:layout_width="match_parent"
diff --git a/res/layout-port/workspace_screen.xml b/res/layout-port/workspace_screen.xml
index f400c40..7a6714f 100644
--- a/res/layout-port/workspace_screen.xml
+++ b/res/layout-port/workspace_screen.xml
@@ -24,7 +24,7 @@
 
     launcher:cellWidth="@dimen/workspace_cell_width"
     launcher:cellHeight="@dimen/workspace_cell_height"
-    launcher:yAxisStartPadding="8dip"
+    launcher:yAxisStartPadding="@dimen/qsb_bar_height"
     launcher:yAxisEndPadding="@dimen/button_bar_height"
     launcher:xAxisStartPadding="0dip"
     launcher:xAxisEndPadding="0dip" />
diff --git a/res/layout/apps_customize_pane.xml b/res/layout/apps_customize_pane.xml
index 05884ef..e22ba12 100644
--- a/res/layout/apps_customize_pane.xml
+++ b/res/layout/apps_customize_pane.xml
@@ -20,7 +20,7 @@
         android:orientation="vertical"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:background="@drawable/apps_customize_bg_gradient">
+        android:background="#FF000000">
         <!-- The layout_width of the tab bar gets overriden to align the content
              with the text in the tabs in AppsCustomizeTabHost. -->
         <FrameLayout
diff --git a/res/layout/qsb_bar.xml b/res/layout/qsb_bar.xml
new file mode 100644
index 0000000..5469224
--- /dev/null
+++ b/res/layout/qsb_bar.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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.
+-->
+<FrameLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher"
+    android:focusable="false">
+
+    <!-- Search buttons container -->
+    <LinearLayout
+        android:id="@+id/qsb_search_bar"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        style="@style/SearchBar">
+       <!-- Global search icon -->
+       <ImageView
+            style="@style/SearchButton"
+            android:id="@+id/search_button"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:src="@drawable/ic_generic_search"
+            android:background="@drawable/button_bg"
+            android:onClick="onClickSearchButton"
+            android:focusable="true"
+            android:clickable="true"
+            android:contentDescription="@string/accessibility_search_button" />
+
+        <ImageView
+            style="@style/SearchButtonDivider"
+            android:id="@+id/search_divider"
+            android:src="@drawable/divider_launcher_holo"
+            android:onClick="onClickSearchButton"
+            android:focusable="false"
+            android:clickable="true" />
+
+        <!-- Voice search icon -->
+        <ImageView
+            style="@style/SearchButton"
+            android:id="@+id/voice_button"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:src="@drawable/ic_voice_search"
+            android:background="@drawable/button_bg"
+            android:onClick="onClickVoiceButton"
+            android:focusable="true"
+            android:clickable="true"
+            android:contentDescription="@string/accessibility_voice_search_button" />
+    </LinearLayout>
+
+    <!-- Drag specific targets container -->
+    <LinearLayout
+        android:id="@+id/drag_target_bar"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="#FF00FF00"
+        android:visibility="gone">
+    </LinearLayout>
+</FrameLayout>
diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index b3d0b2e..13519e5 100644
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -15,7 +15,11 @@
 -->
 
 <resources>
-    <dimen name="workspace_cell_width">96dip</dimen>
+<!-- QSB -->
+    <dimen name="toolbar_button_vertical_padding">12dip</dimen>
+    <dimen name="toolbar_button_horizontal_padding">12dip</dimen>
+
+    <dimen name="workspace_cell_width">106dip</dimen>
     <dimen name="workspace_cell_height">74dip</dimen>
     <dimen name="folder_cell_width">100dip</dimen>
     <dimen name="folder_cell_height">74dip</dimen>
diff --git a/res/values-land/styles.xml b/res/values-land/styles.xml
index 251c717..50aba09 100644
--- a/res/values-land/styles.xml
+++ b/res/values-land/styles.xml
@@ -18,6 +18,23 @@
 -->
 
 <resources>
+<!-- Search Bar -->
+    <style name="SearchBar">
+        <item name="android:orientation">vertical</item>
+    </style>
+    <style name="SearchButton">
+        <item name="android:layout_gravity">center_horizontal</item>
+        <item name="android:paddingTop">@dimen/toolbar_button_vertical_padding</item>
+        <item name="android:paddingBottom">@dimen/toolbar_button_vertical_padding</item>
+        <item name="android:paddingLeft">@dimen/toolbar_button_horizontal_padding</item>
+        <item name="android:paddingRight">@dimen/toolbar_button_horizontal_padding</item>
+    </style>
+    <style name="SearchButtonDivider">
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">wrap_content</item>
+        <item name="android:layout_gravity">center_horizontal</item>
+    </style>
+
     <style name="HotseatButton">
         <item name="android:paddingTop">12dip</item>
         <item name="android:paddingBottom">12dip</item>
diff --git a/res/values-large/dimens.xml b/res/values-large/dimens.xml
index 10836b9..fa660e5 100644
--- a/res/values-large/dimens.xml
+++ b/res/values-large/dimens.xml
@@ -62,9 +62,6 @@
     <integer name="land_all_apps_view_cellCountX">7</integer>
     <integer name="land_all_apps_view_cellCountY">5</integer>
 
-    <dimen name="toolbar_button_vertical_padding">12dip</dimen>
-    <dimen name="toolbar_button_horizontal_padding">16dip</dimen>
-
     <!-- height & width of the drop rectangle for the trash icon -->
     <dimen name="delete_zone_vertical_drag_padding">20dip</dimen>
     <dimen name="delete_zone_horizontal_drag_padding">20dip</dimen>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 99b1240..9d159f9 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -15,6 +15,13 @@
 -->
 
 <resources>
+<!-- Workspace -->
+    <dimen name="qsb_bar_height">56dp</dimen>
+
+<!-- QSB -->
+    <dimen name="toolbar_button_vertical_padding">12dip</dimen>
+    <dimen name="toolbar_button_horizontal_padding">16dip</dimen>
+
 <!-- AllApps/Customize/AppsCustomize -->
     <!-- Size of icons in Workspace/AppsCustomize -->
     <dimen name="app_icon_size">50dp</dimen>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index abe6ac4..c3e6ce9 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -68,6 +68,23 @@
         <item name="android:layout_marginRight">10dip</item>
     </style>
 
+    <style name="SearchBar">
+        <item name="android:orientation">horizontal</item>
+    </style>
+    <style name="SearchButton">
+        <item name="android:layout_gravity">center_vertical</item>
+        <item name="android:paddingTop">@dimen/toolbar_button_vertical_padding</item>
+        <item name="android:paddingBottom">@dimen/toolbar_button_vertical_padding</item>
+        <item name="android:paddingLeft">@dimen/toolbar_button_horizontal_padding</item>
+        <item name="android:paddingRight">@dimen/toolbar_button_horizontal_padding</item>
+    </style>
+    <style name="SearchButtonDivider">
+        <item name="android:layout_width">wrap_content</item>
+        <item name="android:layout_height">match_parent</item>
+        <item name="android:layout_gravity">center_vertical</item>
+    </style>
+
+
     <style name="TabIndicator">
         <item name="android:layout_width">wrap_content</item>
         <item name="android:layout_height">match_parent</item>
@@ -85,13 +102,6 @@
         <item name="android:shadowRadius">1.0</item>
     </style>
 
-    <style name="SearchButton" parent="@android:style/Widget.Button.Small">
-        <item name="android:paddingTop">7dip</item>
-        <item name="android:paddingBottom">9dip</item>
-        <item name="android:paddingLeft">10dip</item>
-        <item name="android:paddingRight">10dip</item>
-    </style>
-
     <style name="MarketButton">
         <item name="android:paddingRight">20dp</item>
         <item name="android:text">@string/market</item>
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 2a16e99..631042e 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -3157,22 +3157,34 @@
     }
 
     private void updateGlobalSearchIcon() {
-        if (LauncherApplication.isScreenLarge()) {
-            final View searchButton = findViewById(R.id.search_button);
-            final View searchDivider = findViewById(R.id.search_divider);
+        final ImageView searchButton = (ImageView) findViewById(R.id.search_button);
+        final View searchDivider = findViewById(R.id.search_divider);
 
-            final SearchManager searchManager =
-                    (SearchManager) getSystemService(Context.SEARCH_SERVICE);
-            ComponentName activityName = searchManager.getGlobalSearchActivity();
-            if (activityName != null) {
+        final SearchManager searchManager =
+                (SearchManager) getSystemService(Context.SEARCH_SERVICE);
+        ComponentName activityName = searchManager.getGlobalSearchActivity();
+        if (activityName != null) {
+            // In landscape mode on the Phone UI, we only have enough space to show the magnifying
+            // glass icon
+            boolean iconLoaded = false;
+            if (!LauncherApplication.isScreenLarge()) {
+                // TODO-APPS_CUSTOMIZE: Remove when the QSB fixes itself?
+                int orientation = getResources().getConfiguration().orientation;
+                if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
+                    searchButton.setImageResource(R.drawable.ic_generic_search);
+                    iconLoaded = true;
+                    sGlobalSearchIcon = null;
+                }
+            }
+            if (!iconLoaded) {
                 sGlobalSearchIcon = updateButtonWithIconFromExternalActivity(
                         R.id.search_button, activityName, R.drawable.ic_generic_search);
-                searchButton.setVisibility(View.VISIBLE);
-                searchDivider.setVisibility(View.VISIBLE);
-            } else {
-                searchButton.setVisibility(View.GONE);
-                searchDivider.setVisibility(View.GONE);
             }
+            searchButton.setVisibility(View.VISIBLE);
+            searchDivider.setVisibility(View.VISIBLE);
+        } else {
+            searchButton.setVisibility(View.GONE);
+            searchDivider.setVisibility(View.GONE);
         }
     }
 
@@ -3181,21 +3193,19 @@
     }
 
     private void updateVoiceSearchIcon() {
-        if (LauncherApplication.isScreenLarge()) {
-            final View searchDivider = findViewById(R.id.search_divider);
-            final View voiceButton = findViewById(R.id.voice_button);
+        final View searchDivider = findViewById(R.id.search_divider);
+        final View voiceButton = findViewById(R.id.voice_button);
 
-            Intent intent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
-            ComponentName activityName = intent.resolveActivity(getPackageManager());
-            if (activityName != null) {
-                sVoiceSearchIcon = updateButtonWithIconFromExternalActivity(
-                        R.id.voice_button, activityName, R.drawable.ic_voice_search);
-                searchDivider.setVisibility(View.VISIBLE);
-                voiceButton.setVisibility(View.VISIBLE);
-            } else {
-                searchDivider.setVisibility(View.GONE);
-                voiceButton.setVisibility(View.GONE);
-            }
+        Intent intent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
+        ComponentName activityName = intent.resolveActivity(getPackageManager());
+        if (activityName != null) {
+            sVoiceSearchIcon = updateButtonWithIconFromExternalActivity(
+                    R.id.voice_button, activityName, R.drawable.ic_voice_search);
+            searchDivider.setVisibility(View.VISIBLE);
+            voiceButton.setVisibility(View.VISIBLE);
+        } else {
+            searchDivider.setVisibility(View.GONE);
+            voiceButton.setVisibility(View.GONE);
         }
     }