Merge "New opaque cab assets; search dialog tweaks." into honeycomb-mr2
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index db8d5e9..9cb57be 100644
--- a/core/java/android/app/SearchDialog.java
+++ b/core/java/android/app/SearchDialog.java
@@ -29,12 +29,13 @@
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.os.Bundle;
-import android.os.SystemClock;
 import android.speech.RecognizerIntent;
 import android.text.InputType;
 import android.text.TextUtils;
 import android.util.AttributeSet;
 import android.util.Log;
+import android.util.TypedValue;
+import android.view.ActionMode;
 import android.view.Gravity;
 import android.view.KeyEvent;
 import android.view.MotionEvent;
@@ -50,9 +51,6 @@
 import android.widget.SearchView;
 import android.widget.TextView;
 
-import java.util.WeakHashMap;
-import java.util.concurrent.atomic.AtomicLong;
-
 /**
  * Search dialog. This is controlled by the 
  * SearchManager and runs in the current foreground process.
@@ -110,13 +108,20 @@
         }
     };
 
+    static int resolveDialogTheme(Context context) {
+        TypedValue outValue = new TypedValue();
+        context.getTheme().resolveAttribute(com.android.internal.R.attr.searchDialogTheme,
+                outValue, true);
+        return outValue.resourceId;
+    }
+
     /**
      * Constructor - fires it up and makes it look like the search UI.
      * 
      * @param context Application Context we can use for system acess
      */
     public SearchDialog(Context context, SearchManager searchManager) {
-        super(context, com.android.internal.R.style.Theme_SearchBar);
+        super(context, resolveDialogTheme(context));
 
         // Save voice intent for later queries/launching
         mVoiceWebSearchIntent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
@@ -642,6 +647,14 @@
             }
             return super.dispatchKeyEventPreIme(event);
         }
+
+        /**
+         * Don't allow action modes in a SearchBar, it looks silly.
+         */
+        @Override
+        public ActionMode startActionModeForChild(View child, ActionMode.Callback callback) {
+            return null;
+        }
     }
 
     private boolean isEmpty(AutoCompleteTextView actv) {
diff --git a/core/res/res/drawable-hdpi/cab_background_dark.9.png b/core/res/res/drawable-hdpi/cab_background_dark.9.png
deleted file mode 100644
index bc5db49..0000000
--- a/core/res/res/drawable-hdpi/cab_background_dark.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/cab_background_light.9.png b/core/res/res/drawable-hdpi/cab_background_light.9.png
deleted file mode 100644
index 1f45bc9..0000000
--- a/core/res/res/drawable-hdpi/cab_background_light.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/cab_background_opaque_holo_dark.9.png b/core/res/res/drawable-hdpi/cab_background_opaque_holo_dark.9.png
new file mode 100644
index 0000000..0f4c3c3
--- /dev/null
+++ b/core/res/res/drawable-hdpi/cab_background_opaque_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/cab_background_opaque_holo_light.9.png b/core/res/res/drawable-hdpi/cab_background_opaque_holo_light.9.png
new file mode 100644
index 0000000..fb9b831
--- /dev/null
+++ b/core/res/res/drawable-hdpi/cab_background_opaque_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/cab_background_dark.9.png b/core/res/res/drawable-mdpi/cab_background_dark.9.png
deleted file mode 100644
index 253b12c..0000000
--- a/core/res/res/drawable-mdpi/cab_background_dark.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/cab_background_light.9.png b/core/res/res/drawable-mdpi/cab_background_light.9.png
deleted file mode 100644
index aaccdfb..0000000
--- a/core/res/res/drawable-mdpi/cab_background_light.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/cab_background_opaque_holo_dark.9.png b/core/res/res/drawable-mdpi/cab_background_opaque_holo_dark.9.png
new file mode 100644
index 0000000..013319c
--- /dev/null
+++ b/core/res/res/drawable-mdpi/cab_background_opaque_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/cab_background_opaque_holo_light.9.png b/core/res/res/drawable-mdpi/cab_background_opaque_holo_light.9.png
new file mode 100644
index 0000000..6d8861a
--- /dev/null
+++ b/core/res/res/drawable-mdpi/cab_background_opaque_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/cab_background_opaque_holo_dark.9.png b/core/res/res/drawable-xhdpi/cab_background_opaque_holo_dark.9.png
new file mode 100644
index 0000000..e2b604b
--- /dev/null
+++ b/core/res/res/drawable-xhdpi/cab_background_opaque_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/cab_background_opaque_holo_light.9.png b/core/res/res/drawable-xhdpi/cab_background_opaque_holo_light.9.png
new file mode 100644
index 0000000..0c1aeaa
--- /dev/null
+++ b/core/res/res/drawable-xhdpi/cab_background_opaque_holo_light.9.png
Binary files differ
diff --git a/core/res/res/layout/search_bar.xml b/core/res/res/layout/search_bar.xml
index 9cf08ea..7918a3f 100644
--- a/core/res/res/layout/search_bar.xml
+++ b/core/res/res/layout/search_bar.xml
@@ -25,7 +25,7 @@
     android:layout_height="wrap_content"
     android:orientation="horizontal"
     android:focusable="true"
-    android:background="@drawable/cab_background_light"
+    android:background="?android:attr/actionModeBackground"
     android:descendantFocusability="afterDescendants">
 
     <RelativeLayout
diff --git a/core/res/res/values/arrays.xml b/core/res/res/values/arrays.xml
index 9073531..810c3b2 100644
--- a/core/res/res/values/arrays.xml
+++ b/core/res/res/values/arrays.xml
@@ -233,7 +233,10 @@
        <item>@drawable/btn_cab_done_focused_holo</item>
        <item>@drawable/btn_cab_done_holo</item>
        <item>@drawable/btn_cab_done_pressed_holo</item>
-       <item>@drawable/cab_background_light</item>
+       <item>@drawable/cab_background_holo_dark</item>
+       <item>@drawable/cab_background_holo_light</item>
+       <item>@drawable/cab_background_opaque_holo_dark</item>
+       <item>@drawable/cab_background_opaque_holo_light</item>
        <item>@drawable/cab_ic_close_focused_holo</item>
        <item>@drawable/cab_ic_close_holo</item>
        <item>@drawable/cab_ic_close_normal_holo</item>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 004b755..0d9190f 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -734,6 +734,9 @@
         <!-- SearchView text field background for the right section -->
         <attr name="searchViewTextFieldRight" format="reference" />
 
+        <!-- Theme to use for Search Dialogs -->
+        <attr name="searchDialogTheme" format="reference" />
+
         <!-- Specifies a drawable to use for the 'home as up' indicator. -->
         <attr name="homeAsUpIndicator" format="reference" />
 
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index b127747..2f434ec 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -258,7 +258,7 @@
         <item name="actionDropDownStyle">@android:style/Widget.Spinner.DropDown</item>
         <item name="actionButtonStyle">@android:style/Widget.ActionButton</item>
         <item name="actionOverflowButtonStyle">@android:style/Widget.ActionButton.Overflow</item>
-        <item name="actionModeBackground">@android:drawable/cab_background_dark</item>
+        <item name="actionModeBackground">@android:drawable/cab_background_opaque_holo_dark</item>
         <item name="actionModeCloseDrawable">@android:drawable/ic_menu_close_clear_cancel</item>
         <item name="actionModeCutDrawable">@android:drawable/ic_menu_cut_holo_dark</item>
         <item name="actionModeCopyDrawable">@android:drawable/ic_menu_copy_holo_dark</item>
@@ -294,6 +294,8 @@
         <item name="searchViewEditQuery">@android:drawable/ic_commit</item>
         <item name="searchViewEditQueryBackground">?attr/selectableItemBackground</item>
 
+        <item name="searchDialogTheme">@style/Theme.SearchBar</item>
+
         <!-- PreferenceFrameLayout attributes -->
         <item name="preferenceFrameLayoutStyle">@android:style/Widget.PreferenceFrameLayout</item>
 
@@ -391,7 +393,7 @@
         <item name="actionModeShareDrawable">@android:drawable/ic_menu_share_holo_light</item>
         <item name="actionModeFindDrawable">@android:drawable/ic_menu_find_holo_light</item>
         <item name="actionModeWebSearchDrawable">@android:drawable/ic_menu_search_holo_light</item>
-        <item name="actionModeBackground">@android:drawable/cab_background_light</item>
+        <item name="actionModeBackground">@android:drawable/cab_background_opaque_holo_light</item>
 
         <!-- SearchView attributes -->
         <item name="searchDropdownBackground">@android:drawable/search_dropdown_light</item>
@@ -681,12 +683,24 @@
     <!-- Theme for the search input bar. -->
     <style name="Theme.SearchBar" parent="Theme.Holo.Light.Panel">
         <item name="windowContentOverlay">@null</item>        
+        <item name="actionModeBackground">@android:drawable/cab_background_opaque_holo_light</item>
     </style>
-    
+
+    <style name="Theme.Holo.SearchBar" parent="Theme.Holo.Panel">
+        <item name="windowContentOverlay">@null</item>
+        <item name="actionModeBackground">@android:drawable/cab_background_opaque_holo_dark</item>
+    </style>
+
+    <style name="Theme.Holo.Light.SearchBar" parent="Theme.Holo.Light.Panel">
+        <item name="windowContentOverlay">@null</item>
+        <item name="actionModeBackground">@android:drawable/cab_background_opaque_holo_light</item>
+    </style>
+
     <!-- Theme for the search input bar when doing global search. The only
          difference from non-global search is that we do not dim the background. -->
     <style name="Theme.GlobalSearchBar" parent="Theme.Panel">
         <item name="windowContentOverlay">@null</item>
+        <item name="actionModeBackground">@android:drawable/cab_background_opaque_holo_light</item>
     </style>
 
     <!-- Menu Themes -->
@@ -1020,6 +1034,8 @@
         <!-- SearchView attributes -->
         <item name="searchDropdownBackground">@android:drawable/search_dropdown_dark</item>
 
+        <item name="searchDialogTheme">@style/Theme.Holo.SearchBar</item>
+
         <!-- PreferenceFrameLayout attributes -->
         <item name="preferenceFrameLayoutStyle">@android:style/Widget.Holo.PreferenceFrameLayout</item>
 
@@ -1303,6 +1319,8 @@
         <!-- SearchView attributes -->
         <item name="searchDropdownBackground">@android:drawable/search_dropdown_light</item>
 
+        <item name="searchDialogTheme">@style/Theme.Holo.Light.SearchBar</item>
+
         <!-- NumberPicker attributes and styles-->
         <item name="numberPickerUpButtonStyle">@style/Widget.Holo.Light.ImageButton.NumberPickerUpButton</item>
         <item name="numberPickerDownButtonStyle">@style/Widget.Holo.Light.ImageButton.NumberPickerDownButton</item>