API change - bug 3370353 and bug 3370338
Change-Id: I9da53f3260ca17713e793b420e477686ad23c7d3
This commit is contained in:
@@ -22,7 +22,7 @@ import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.SearchView;
|
||||
import android.widget.SearchView.OnQueryChangeListener;
|
||||
import android.widget.SearchView.OnQueryTextListener;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
@@ -34,7 +34,7 @@ import com.example.android.apis.R;
|
||||
* menu data itself. If you'd like to see how these things work under the hood, see
|
||||
* ActionBarMechanics.
|
||||
*/
|
||||
public class ActionBarUsage extends Activity implements OnQueryChangeListener {
|
||||
public class ActionBarUsage extends Activity implements OnQueryTextListener {
|
||||
TextView mSearchText;
|
||||
int mSortMode = -1;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ActionBarUsage extends Activity implements OnQueryChangeListener {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.actions, menu);
|
||||
SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
|
||||
searchView.setOnQueryChangeListener(this);
|
||||
searchView.setOnQueryTextListener(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -80,13 +80,13 @@ public class ActionBarUsage extends Activity implements OnQueryChangeListener {
|
||||
|
||||
// The following callbacks are called for the SearchView.OnQueryChangeListener
|
||||
// For more about using SearchView, see src/.../view/SearchView1.java and SearchView2.java
|
||||
public boolean onQueryTextChanged(String newText) {
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
newText = newText.isEmpty() ? "" : "Query so far: " + newText;
|
||||
mSearchText.setText(newText);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean onSubmitQuery(String query) {
|
||||
public boolean onQueryTextSubmit(String query) {
|
||||
Toast.makeText(this, "Searching for: " + query + "...", Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ import android.view.View;
|
||||
import android.widget.ListView;
|
||||
import android.widget.SearchView;
|
||||
import android.widget.SimpleCursorAdapter;
|
||||
import android.widget.SearchView.OnQueryChangeListener;
|
||||
import android.widget.SearchView.OnQueryTextListener;
|
||||
|
||||
/**
|
||||
* Demonstration of more complex use if a ListFragment, including showing
|
||||
@@ -58,7 +58,7 @@ public class FragmentListCursorLoader extends Activity {
|
||||
|
||||
//BEGIN_INCLUDE(fragment_cursor)
|
||||
public static class CursorLoaderListFragment extends ListFragment
|
||||
implements OnQueryChangeListener, LoaderManager.LoaderCallbacks<Cursor> {
|
||||
implements OnQueryTextListener, LoaderManager.LoaderCallbacks<Cursor> {
|
||||
|
||||
// This is the Adapter being used to display the list's data.
|
||||
SimpleCursorAdapter mAdapter;
|
||||
@@ -94,11 +94,11 @@ public class FragmentListCursorLoader extends Activity {
|
||||
item.setIcon(android.R.drawable.ic_menu_search);
|
||||
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||
SearchView sv = new SearchView(getActivity());
|
||||
sv.setOnQueryChangeListener(this);
|
||||
sv.setOnQueryTextListener(this);
|
||||
item.setActionView(sv);
|
||||
}
|
||||
|
||||
public boolean onQueryTextChanged(String newText) {
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
// Called when the action bar search text has changed. Update
|
||||
// the search filter, and restart the loader to do a new query
|
||||
// with this filter.
|
||||
@@ -107,7 +107,7 @@ public class FragmentListCursorLoader extends Activity {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public boolean onSubmitQuery(String query) {
|
||||
@Override public boolean onQueryTextSubmit(String query) {
|
||||
// Don't care about this.
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ import java.util.List;
|
||||
* This demonstrates the usage of SearchView in an ActionBar as a menu item.
|
||||
* It sets a SearchableInfo on the SearchView for suggestions and submitting queries to.
|
||||
*/
|
||||
public class SearchViewActionBar extends Activity implements SearchView.OnQueryChangeListener,
|
||||
public class SearchViewActionBar extends Activity implements SearchView.OnQueryTextListener,
|
||||
SearchView.OnCloseListener, Button.OnClickListener {
|
||||
|
||||
private SearchView mSearchView;
|
||||
@@ -90,16 +90,16 @@ public class SearchViewActionBar extends Activity implements SearchView.OnQueryC
|
||||
mSearchView.setSearchableInfo(info);
|
||||
}
|
||||
|
||||
mSearchView.setOnQueryChangeListener(this);
|
||||
mSearchView.setOnQueryTextListener(this);
|
||||
mSearchView.setOnCloseListener(this);
|
||||
}
|
||||
|
||||
public boolean onQueryTextChanged(String newText) {
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
mStatusView.setText("Query = " + newText);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onSubmitQuery(String query) {
|
||||
public boolean onQueryTextSubmit(String query) {
|
||||
mStatusView.setText("Query = " + query + " : submitted");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import android.widget.SearchView;
|
||||
/**
|
||||
* Shows a list that can be filtered in-place with a SearchView in non-iconified mode.
|
||||
*/
|
||||
public class SearchViewFilterMode extends Activity implements SearchView.OnQueryChangeListener {
|
||||
public class SearchViewFilterMode extends Activity implements SearchView.OnQueryTextListener {
|
||||
|
||||
private static final String TAG = "SearchViewFilterMode";
|
||||
|
||||
@@ -58,12 +58,12 @@ public class SearchViewFilterMode extends Activity implements SearchView.OnQuery
|
||||
|
||||
private void setupSearchView() {
|
||||
mSearchView.setIconifiedByDefault(false);
|
||||
mSearchView.setOnQueryChangeListener(this);
|
||||
mSearchView.setOnQueryTextListener(this);
|
||||
mSearchView.setSubmitButtonEnabled(false);
|
||||
mSearchView.setQueryHint(getString(R.string.cheese_hunt_hint));
|
||||
}
|
||||
|
||||
public boolean onQueryTextChanged(String newText) {
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
if (TextUtils.isEmpty(newText)) {
|
||||
mListView.clearTextFilter();
|
||||
} else {
|
||||
@@ -72,7 +72,7 @@ public class SearchViewFilterMode extends Activity implements SearchView.OnQuery
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean onSubmitQuery(String query) {
|
||||
public boolean onQueryTextSubmit(String query) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user