use of androidx.appcompat.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 androidx.appcompat.widget.SearchView.OnQueryTextListener in project MiMangaNu by raulhaag.
the class ServerFilteredNavigationFragment method onCreateOptionsMenu.
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.manga_server_visual, menu);
MenuItem search = menu.findItem(R.id.action_search);
if (!serverBase.hasList()) {
MenuItem item = menu.findItem(R.id.ver_como_lista);
item.setVisible(false);
}
if (serverBase.getServerFilters().length == 0) {
MenuItem item = menu.findItem(R.id.filter);
item.setVisible(false);
}
if (!serverBase.hasSearch()) {
MenuItem item = menu.findItem(R.id.action_search);
item.setVisible(false);
}
SearchView searchView = (SearchView) MenuItemCompat.getActionView(search);
searchView.setOnQueryTextListener(new OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String value) {
Bundle bundle = new Bundle();
bundle.putInt(MainFragment.SERVER_ID, serverBase.getServerID());
bundle.putString(SearchResultsFragment.TERM, value);
SearchResultsFragment searchResultsFragment = new SearchResultsFragment();
searchResultsFragment.setArguments(bundle);
((MainActivity) getActivity()).replaceFragment(searchResultsFragment, "SearchFragment");
return true;
}
@Override
public boolean onQueryTextChange(String s) {
return false;
}
});
}
Aggregations