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