Add some missing getters for XML/Java API consistency.
Bug: 6103517
Change-Id: I46dca62d4d6465a4d0b0d2eafd9013ab4a90fb3c
diff --git a/api/current.txt b/api/current.txt
index d04025c..b372764 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -27977,7 +27977,11 @@
public class SearchView extends android.widget.LinearLayout implements android.view.CollapsibleActionView {
ctor public SearchView(android.content.Context);
ctor public SearchView(android.content.Context, android.util.AttributeSet);
+ method public int getImeOptions();
+ method public int getInputType();
+ method public int getMaxWidth();
method public java.lang.CharSequence getQuery();
+ method public java.lang.CharSequence getQueryHint();
method public android.widget.CursorAdapter getSuggestionsAdapter();
method public boolean isIconfiedByDefault();
method public boolean isIconified();
diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java
index 99cd0b8..561326e 100644
--- a/core/java/android/widget/SearchView.java
+++ b/core/java/android/widget/SearchView.java
@@ -381,6 +381,17 @@
}
/**
+ * Returns the IME options set on the query text field.
+ * @return the ime options
+ * @see TextView#setImeOptions(int)
+ *
+ * @attr ref android.R.styleable#SearchView_imeOptions
+ */
+ public int getImeOptions() {
+ return mQueryTextView.getImeOptions();
+ }
+
+ /**
* Sets the input type on the query text field.
*
* @see TextView#setInputType(int)
@@ -392,6 +403,16 @@
mQueryTextView.setInputType(inputType);
}
+ /**
+ * Returns the input type set on the query text field.
+ * @return the input type
+ *
+ * @attr ref android.R.styleable#SearchView_inputType
+ */
+ public int getInputType() {
+ return mQueryTextView.getInputType();
+ }
+
/** @hide */
@Override
public boolean requestFocus(int direction, Rect previouslyFocusedRect) {
@@ -514,6 +535,26 @@
}
/**
+ * Gets the hint text to display in the query text field.
+ * @return the query hint text, if specified, null otherwise.
+ *
+ * @attr ref android.R.styleable#SearchView_queryHint
+ */
+ public CharSequence getQueryHint() {
+ if (mQueryHint != null) {
+ return mQueryHint;
+ } else if (mSearchable != null) {
+ CharSequence hint = null;
+ int hintId = mSearchable.getHintId();
+ if (hintId != 0) {
+ hint = getContext().getString(hintId);
+ }
+ return hint;
+ }
+ return null;
+ }
+
+ /**
* Sets the default or resting state of the search field. If true, a single search icon is
* shown by default and expands to show the text field and other buttons when pressed. Also,
* if the default state is iconified, then it collapses to that state when the close button
@@ -651,6 +692,15 @@
requestLayout();
}
+ /**
+ * Gets the specified maximum width in pixels, if set. Returns zero if
+ * no maximum width was specified.
+ * @return the maximum width of the view
+ */
+ public int getMaxWidth() {
+ return mMaxWidth;
+ }
+
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// Let the standard measurements take effect in iconified state.