am 9a161b09
: Merge "SearchView API Review - bug 3370353 and bug 3370338" into honeycomb
* commit '9a161b0981ad41169d006186979b7648a2acfd56': SearchView API Review - bug 3370353 and bug 3370338
This commit is contained in:
42
api/11.xml
42
api/11.xml
@ -253670,19 +253670,6 @@
|
||||
<parameter name="listener" type="android.widget.SearchView.OnCloseListener">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="setOnQueryChangeListener"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="listener" type="android.widget.SearchView.OnQueryChangeListener">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="setOnQueryTextFocusChangeListener"
|
||||
return="void"
|
||||
abstract="false"
|
||||
@ -253696,6 +253683,19 @@
|
||||
<parameter name="listener" type="android.view.View.OnFocusChangeListener">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="setOnQueryTextListener"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="listener" type="android.widget.SearchView.OnQueryTextListener">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="setOnSearchClickListener"
|
||||
return="void"
|
||||
abstract="false"
|
||||
@ -253709,7 +253709,7 @@
|
||||
<parameter name="listener" type="android.view.View.OnClickListener">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="setOnSuggestionSelectionListener"
|
||||
<method name="setOnSuggestionListener"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
@ -253719,7 +253719,7 @@
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="listener" type="android.widget.SearchView.OnSuggestionSelectionListener">
|
||||
<parameter name="listener" type="android.widget.SearchView.OnSuggestionListener">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="setQuery"
|
||||
@ -253822,14 +253822,14 @@
|
||||
>
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="SearchView.OnQueryChangeListener"
|
||||
<interface name="SearchView.OnQueryTextListener"
|
||||
abstract="true"
|
||||
static="true"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<method name="onQueryTextChanged"
|
||||
<method name="onQueryTextChange"
|
||||
return="boolean"
|
||||
abstract="true"
|
||||
native="false"
|
||||
@ -253842,7 +253842,7 @@
|
||||
<parameter name="newText" type="java.lang.String">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="onSubmitQuery"
|
||||
<method name="onQueryTextSubmit"
|
||||
return="boolean"
|
||||
abstract="true"
|
||||
native="false"
|
||||
@ -253856,14 +253856,14 @@
|
||||
</parameter>
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="SearchView.OnSuggestionSelectionListener"
|
||||
<interface name="SearchView.OnSuggestionListener"
|
||||
abstract="true"
|
||||
static="true"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<method name="onSuggestionClicked"
|
||||
<method name="onSuggestionClick"
|
||||
return="boolean"
|
||||
abstract="true"
|
||||
native="false"
|
||||
@ -253876,7 +253876,7 @@
|
||||
<parameter name="position" type="int">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="onSuggestionSelected"
|
||||
<method name="onSuggestionSelect"
|
||||
return="boolean"
|
||||
abstract="true"
|
||||
native="false"
|
||||
|
@ -255133,19 +255133,6 @@
|
||||
<parameter name="listener" type="android.widget.SearchView.OnCloseListener">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="setOnQueryChangeListener"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="listener" type="android.widget.SearchView.OnQueryChangeListener">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="setOnQueryTextFocusChangeListener"
|
||||
return="void"
|
||||
abstract="false"
|
||||
@ -255159,6 +255146,19 @@
|
||||
<parameter name="listener" type="android.view.View.OnFocusChangeListener">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="setOnQueryTextListener"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="listener" type="android.widget.SearchView.OnQueryTextListener">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="setOnSearchClickListener"
|
||||
return="void"
|
||||
abstract="false"
|
||||
@ -255172,7 +255172,7 @@
|
||||
<parameter name="listener" type="android.view.View.OnClickListener">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="setOnSuggestionSelectionListener"
|
||||
<method name="setOnSuggestionListener"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
@ -255182,7 +255182,7 @@
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="listener" type="android.widget.SearchView.OnSuggestionSelectionListener">
|
||||
<parameter name="listener" type="android.widget.SearchView.OnSuggestionListener">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="setQuery"
|
||||
@ -255285,14 +255285,14 @@
|
||||
>
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="SearchView.OnQueryChangeListener"
|
||||
<interface name="SearchView.OnQueryTextListener"
|
||||
abstract="true"
|
||||
static="true"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<method name="onQueryTextChanged"
|
||||
<method name="onQueryTextChange"
|
||||
return="boolean"
|
||||
abstract="true"
|
||||
native="false"
|
||||
@ -255305,7 +255305,7 @@
|
||||
<parameter name="newText" type="java.lang.String">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="onSubmitQuery"
|
||||
<method name="onQueryTextSubmit"
|
||||
return="boolean"
|
||||
abstract="true"
|
||||
native="false"
|
||||
@ -255319,14 +255319,14 @@
|
||||
</parameter>
|
||||
</method>
|
||||
</interface>
|
||||
<interface name="SearchView.OnSuggestionSelectionListener"
|
||||
<interface name="SearchView.OnSuggestionListener"
|
||||
abstract="true"
|
||||
static="true"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<method name="onSuggestionClicked"
|
||||
<method name="onSuggestionClick"
|
||||
return="boolean"
|
||||
abstract="true"
|
||||
native="false"
|
||||
@ -255339,7 +255339,7 @@
|
||||
<parameter name="position" type="int">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="onSuggestionSelected"
|
||||
<method name="onSuggestionSelect"
|
||||
return="boolean"
|
||||
abstract="true"
|
||||
native="false"
|
||||
|
@ -164,8 +164,8 @@ public class SearchDialog extends Dialog {
|
||||
mSearchView = (SearchView) findViewById(com.android.internal.R.id.search_view);
|
||||
mSearchView.setSubmitButtonEnabled(true);
|
||||
mSearchView.setOnCloseListener(mOnCloseListener);
|
||||
mSearchView.setOnQueryChangeListener(mOnQueryChangeListener);
|
||||
mSearchView.setOnSuggestionSelectionListener(mOnSuggestionSelectionListener);
|
||||
mSearchView.setOnQueryTextListener(mOnQueryChangeListener);
|
||||
mSearchView.setOnSuggestionListener(mOnSuggestionSelectionListener);
|
||||
|
||||
// TODO: Move the badge logic to SearchView or move the badge to search_bar.xml
|
||||
mBadgeLabel = (TextView) mSearchView.findViewById(com.android.internal.R.id.search_badge);
|
||||
@ -678,27 +678,27 @@ public class SearchDialog extends Dialog {
|
||||
}
|
||||
};
|
||||
|
||||
private final SearchView.OnQueryChangeListener mOnQueryChangeListener =
|
||||
new SearchView.OnQueryChangeListener() {
|
||||
private final SearchView.OnQueryTextListener mOnQueryChangeListener =
|
||||
new SearchView.OnQueryTextListener() {
|
||||
|
||||
public boolean onSubmitQuery(String query) {
|
||||
public boolean onQueryTextSubmit(String query) {
|
||||
dismiss();
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onQueryTextChanged(String newText) {
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
private final SearchView.OnSuggestionSelectionListener mOnSuggestionSelectionListener =
|
||||
new SearchView.OnSuggestionSelectionListener() {
|
||||
private final SearchView.OnSuggestionListener mOnSuggestionSelectionListener =
|
||||
new SearchView.OnSuggestionListener() {
|
||||
|
||||
public boolean onSuggestionSelected(int position) {
|
||||
public boolean onSuggestionSelect(int position) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onSuggestionClicked(int position) {
|
||||
public boolean onSuggestionClick(int position) {
|
||||
dismiss();
|
||||
return false;
|
||||
}
|
||||
|
@ -72,10 +72,10 @@ public class SearchView extends LinearLayout {
|
||||
private static final boolean DBG = false;
|
||||
private static final String LOG_TAG = "SearchView";
|
||||
|
||||
private OnQueryChangeListener mOnQueryChangeListener;
|
||||
private OnQueryTextListener mOnQueryChangeListener;
|
||||
private OnCloseListener mOnCloseListener;
|
||||
private OnFocusChangeListener mOnQueryTextFocusChangeListener;
|
||||
private OnSuggestionSelectionListener mOnSuggestionListener;
|
||||
private OnSuggestionListener mOnSuggestionListener;
|
||||
private OnClickListener mOnSearchClickListener;
|
||||
|
||||
private boolean mIconifiedByDefault;
|
||||
@ -109,7 +109,7 @@ public class SearchView extends LinearLayout {
|
||||
/**
|
||||
* Callbacks for changes to the query text.
|
||||
*/
|
||||
public interface OnQueryChangeListener {
|
||||
public interface OnQueryTextListener {
|
||||
|
||||
/**
|
||||
* Called when the user submits the query. This could be due to a key press on the
|
||||
@ -123,7 +123,7 @@ public class SearchView extends LinearLayout {
|
||||
* @return true if the query has been handled by the listener, false to let the
|
||||
* SearchView perform the default action.
|
||||
*/
|
||||
boolean onSubmitQuery(String query);
|
||||
boolean onQueryTextSubmit(String query);
|
||||
|
||||
/**
|
||||
* Called when the query text is changed by the user.
|
||||
@ -133,7 +133,7 @@ public class SearchView extends LinearLayout {
|
||||
* @return false if the SearchView should perform the default action of showing any
|
||||
* suggestions if available, true if the action was handled by the listener.
|
||||
*/
|
||||
boolean onQueryTextChanged(String newText);
|
||||
boolean onQueryTextChange(String newText);
|
||||
}
|
||||
|
||||
public interface OnCloseListener {
|
||||
@ -151,7 +151,7 @@ public class SearchView extends LinearLayout {
|
||||
* Callback interface for selection events on suggestions. These callbacks
|
||||
* are only relevant when a SearchableInfo has been specified by {@link #setSearchableInfo}.
|
||||
*/
|
||||
public interface OnSuggestionSelectionListener {
|
||||
public interface OnSuggestionListener {
|
||||
|
||||
/**
|
||||
* Called when a suggestion was selected by navigating to it.
|
||||
@ -160,7 +160,7 @@ public class SearchView extends LinearLayout {
|
||||
* @return true if the listener handles the event and wants to override the default
|
||||
* behavior of possibly rewriting the query based on the selected item, false otherwise.
|
||||
*/
|
||||
boolean onSuggestionSelected(int position);
|
||||
boolean onSuggestionSelect(int position);
|
||||
|
||||
/**
|
||||
* Called when a suggestion was clicked.
|
||||
@ -170,7 +170,7 @@ public class SearchView extends LinearLayout {
|
||||
* behavior of launching any intent or submitting a search query specified on that item.
|
||||
* Return false otherwise.
|
||||
*/
|
||||
boolean onSuggestionClicked(int position);
|
||||
boolean onSuggestionClick(int position);
|
||||
}
|
||||
|
||||
public SearchView(Context context) {
|
||||
@ -282,7 +282,7 @@ public class SearchView extends LinearLayout {
|
||||
* @param listener the listener object that receives callbacks when the user performs
|
||||
* actions in the SearchView such as clicking on buttons or typing a query.
|
||||
*/
|
||||
public void setOnQueryChangeListener(OnQueryChangeListener listener) {
|
||||
public void setOnQueryTextListener(OnQueryTextListener listener) {
|
||||
mOnQueryChangeListener = listener;
|
||||
}
|
||||
|
||||
@ -309,7 +309,7 @@ public class SearchView extends LinearLayout {
|
||||
*
|
||||
* @param listener the listener to inform of suggestion selection events.
|
||||
*/
|
||||
public void setOnSuggestionSelectionListener(OnSuggestionSelectionListener listener) {
|
||||
public void setOnSuggestionListener(OnSuggestionListener listener) {
|
||||
mOnSuggestionListener = listener;
|
||||
}
|
||||
|
||||
@ -865,7 +865,7 @@ public class SearchView extends LinearLayout {
|
||||
updateCloseButton();
|
||||
updateSubmitArea();
|
||||
if (mOnQueryChangeListener != null) {
|
||||
mOnQueryChangeListener.onQueryTextChanged(newText.toString());
|
||||
mOnQueryChangeListener.onQueryTextChange(newText.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -873,7 +873,7 @@ public class SearchView extends LinearLayout {
|
||||
CharSequence query = mQueryTextView.getText();
|
||||
if (!TextUtils.isEmpty(query)) {
|
||||
if (mOnQueryChangeListener == null
|
||||
|| !mOnQueryChangeListener.onSubmitQuery(query.toString())) {
|
||||
|| !mOnQueryChangeListener.onQueryTextSubmit(query.toString())) {
|
||||
if (mSearchable != null) {
|
||||
launchQuerySearch(KeyEvent.KEYCODE_UNKNOWN, null, query.toString());
|
||||
setImeVisibility(false);
|
||||
@ -940,7 +940,7 @@ public class SearchView extends LinearLayout {
|
||||
|
||||
private boolean onItemClicked(int position, int actionKey, String actionMsg) {
|
||||
if (mOnSuggestionListener == null
|
||||
|| !mOnSuggestionListener.onSuggestionClicked(position)) {
|
||||
|| !mOnSuggestionListener.onSuggestionClick(position)) {
|
||||
launchSuggestion(position, KeyEvent.KEYCODE_UNKNOWN, null);
|
||||
setImeVisibility(false);
|
||||
dismissSuggestions();
|
||||
@ -951,7 +951,7 @@ public class SearchView extends LinearLayout {
|
||||
|
||||
private boolean onItemSelected(int position) {
|
||||
if (mOnSuggestionListener == null
|
||||
|| !mOnSuggestionListener.onSuggestionSelected(position)) {
|
||||
|| !mOnSuggestionListener.onSuggestionSelect(position)) {
|
||||
rewriteQueryFromSuggestion(position);
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user