Fix bug 3242262 - Add queryHint attribute for SearchView
Change-Id: I211b65139622c2a2cba03bd1323e2543b09bb111
diff --git a/api/current.xml b/api/current.xml
index 0c33b8c..7fe7017 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -7616,6 +7616,17 @@
visibility="public"
>
</field>
+<field name="queryHint"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843610"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="quickContactBadgeStyleSmallWindowLarge"
type="int"
transient="false"
@@ -167165,7 +167176,7 @@
</parameter>
<parameter name="type" type="android.renderscript.Type">
</parameter>
-<parameter name="mc" type="android.renderscript.Allocation.MipmapControl">
+<parameter name="mips" type="android.renderscript.Allocation.MipmapControl">
</parameter>
<parameter name="usage" type="int">
</parameter>
@@ -260215,7 +260226,7 @@
deprecated="not deprecated"
visibility="public"
>
-<parameter name="t" type="T">
+<parameter name="arg0" type="T">
</parameter>
</method>
</interface>
diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java
index 3bf5af3..2c96056 100644
--- a/core/java/android/widget/SearchView.java
+++ b/core/java/android/widget/SearchView.java
@@ -217,6 +217,10 @@
if (maxWidth != -1) {
setMaxWidth(maxWidth);
}
+ CharSequence queryHint = a.getText(R.styleable.SearchView_queryHint);
+ if (!TextUtils.isEmpty(queryHint)) {
+ setQueryHint(queryHint);
+ }
a.recycle();
// Save voice intent for later queries/launching
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 3a3ca36..a29f417 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -4664,6 +4664,8 @@
<attr name="iconifiedByDefault" format="boolean"/>
<!-- An optional maximum width of the SearchView. -->
<attr name="maxWidth" />
+ <!-- An optional query hint string to be displayed in the empty query field. -->
+ <attr name="queryHint" format="string" />
</declare-styleable>
<declare-styleable name="ActionBar_LayoutParams">
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 6d79569..a4834b2 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1424,6 +1424,7 @@
<public type="attr" name="alertDialogIcon" />
<public type="attr" name="windowMinWidthMajor" />
<public type="attr" name="windowMinWidthMinor" />
+ <public type="attr" name="queryHint" />
<!-- A simple fade-in animation. -->
<public type="animator" name="fade_in" id="0x010b0000" />