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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user