use of android.support.v7.widget.SearchView.OnQueryTextListener in project MiMangaNu by raulhaag.
the class ServerListFragment method onCreateOptionsMenu.
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.manga_server, menu);
MenuItem search;
search = menu.findItem(R.id.action_search);
SearchView searchView = (SearchView) MenuItemCompat.getActionView(search);
searchView.setOnQueryTextListener(new OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
return false;
}
@Override
public boolean onQueryTextChange(String s) {
if (adapter != null)
adapter.getFilter().filter(s);
return false;
}
});
}
use of android.support.v7.widget.SearchView.OnQueryTextListener in project SharedPreferenceInspector by PrashamTrivedi.
the class SharedPreferencesItem method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_testmode) {
getActivity().supportInvalidateOptionsMenu();
changeTestMode();
}
if (id == R.id.action_search) {
SearchView searchView = (SearchView) MenuItemCompat.getActionView(item);
if (searchView != null) {
searchView.setQueryHint(getString(R.string.searchHint));
searchView.setOnQueryTextListener(new OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
search(s);
return true;
}
@Override
public boolean onQueryTextChange(String s) {
search(s);
return true;
}
});
}
}
return super.onOptionsItemSelected(item);
}
use of android.support.v7.widget.SearchView.OnQueryTextListener in project frostwire by frostwire.
the class AudioPlayerActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
// Search view
MenuInflater menuInflater = getMenuInflater();
menuInflater.inflate(R.menu.player_search, menu);
final SearchView searchView = (SearchView) menu.findItem(R.id.menu_player_search).getActionView();
// Add voice search
final SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
if (searchManager != null) {
final SearchableInfo searchableInfo = searchManager.getSearchableInfo(getComponentName());
searchView.setSearchableInfo(searchableInfo);
// Perform the search
searchView.setOnQueryTextListener(new OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(final String query) {
// Open the search activity
NavUtils.openSearch(AudioPlayerActivity.this, query);
return true;
}
@Override
public boolean onQueryTextChange(final String newText) {
// Nothing to do
return false;
}
});
}
// Favorite action
menuInflater.inflate(R.menu.player_favorite, menu);
// Share, ringtone, and equalizer
menuInflater.inflate(R.menu.player_audio_player, menu);
// Shuffle all
menuInflater.inflate(R.menu.player_shuffle, menu);
return super.onCreateOptionsMenu(menu);
}
use of android.support.v7.widget.SearchView.OnQueryTextListener in project frostwire by frostwire.
the class BaseActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
// Search view
getMenuInflater().inflate(R.menu.player_search, menu);
final SearchView searchView = (SearchView) menu.findItem(R.id.menu_player_search).getActionView();
// Add voice search
final SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
final SearchableInfo searchableInfo = searchManager.getSearchableInfo(getComponentName());
if (searchView != null) {
// rare NPE can occur
searchView.setSearchableInfo(searchableInfo);
// Perform the search
searchView.setOnQueryTextListener(new OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(final String query) {
// Open the search activity
NavUtils.openSearch(BaseActivity.this, query);
return true;
}
@Override
public boolean onQueryTextChange(final String newText) {
// Nothing to do
return false;
}
});
}
return super.onCreateOptionsMenu(menu);
}
use of android.support.v7.widget.SearchView.OnQueryTextListener in project bitcoin-wallet by bitcoin-wallet.
the class ExchangeRatesFragment method onCreateOptionsMenu.
@Override
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
inflater.inflate(R.menu.exchange_rates_fragment_options, menu);
final MenuItem searchMenuItem = menu.findItem(R.id.exchange_rates_options_search);
if (Constants.ENABLE_EXCHANGE_RATES) {
final SearchView searchView = (SearchView) searchMenuItem.getActionView();
searchView.setOnQueryTextListener(new OnQueryTextListener() {
@Override
public boolean onQueryTextChange(final String newText) {
query = Strings.emptyToNull(newText.trim());
getLoaderManager().restartLoader(ID_RATE_LOADER, null, rateLoaderCallbacks);
return true;
}
@Override
public boolean onQueryTextSubmit(final String query) {
searchView.clearFocus();
return true;
}
});
// Workaround for not being able to style the SearchView
final int id = searchView.getContext().getResources().getIdentifier("android:id/search_src_text", null, null);
final View searchInput = searchView.findViewById(id);
if (searchInput instanceof EditText)
((EditText) searchInput).setTextColor(Color.WHITE);
} else {
searchMenuItem.setVisible(false);
}
super.onCreateOptionsMenu(menu, inflater);
}
Aggregations