use of androidx.appcompat.widget.SearchView 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 in project MaxLock by Maxr1998.
the class AppListFragment method onCreateOptionsMenu.
@Override
public void onCreateOptionsMenu(final Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.applist_menu, menu);
super.onCreateOptionsMenu(menu, inflater);
menu.setGroupVisible(R.id.menu_group_default, false);
final SearchView searchView = (SearchView) menu.findItem(R.id.toolbar_search).getActionView();
searchView.setOnSearchClickListener(v -> menu.setGroupVisible(R.id.menu_group_hide_on_search, false));
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
Util.hideKeyboardFromWindow(getActivity(), searchView);
return true;
}
@Override
public boolean onQueryTextChange(String s) {
appListModel.getAdapter().getFilter().filter(s);
return true;
}
});
searchView.setOnCloseListener(() -> {
menu.setGroupVisible(R.id.menu_group_hide_on_search, true);
return false;
});
filterIcon(menu.findItem(R.id.toolbar_filter_activated));
menu.findItem(R.id.toolbar_load_all).setTitle(appListModel.getLoadAll() ? R.string.menu_only_openable : R.string.menu_all_apps);
}
use of androidx.appcompat.widget.SearchView in project RxBinding by JakeWharton.
the class RxSearchViewTestActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
searchView = new SearchView(this);
setContentView(searchView);
}
use of androidx.appcompat.widget.SearchView in project Signal-Android by WhisperSystems.
the class SubmitDebugLogActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.submit_debug_log_normal, menu);
this.editMenuItem = menu.findItem(R.id.menu_edit_log);
this.doneMenuItem = menu.findItem(R.id.menu_done_editing_log);
this.searchMenuItem = menu.findItem(R.id.menu_search);
SearchView searchView = (SearchView) searchMenuItem.getActionView();
SearchView.OnQueryTextListener queryListener = new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
viewModel.onQueryUpdated(query);
return true;
}
@Override
public boolean onQueryTextChange(String query) {
viewModel.onQueryUpdated(query);
return true;
}
};
searchMenuItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
@Override
public boolean onMenuItemActionExpand(MenuItem item) {
searchView.setOnQueryTextListener(queryListener);
return true;
}
@Override
public boolean onMenuItemActionCollapse(MenuItem item) {
searchView.setOnQueryTextListener(null);
viewModel.onSearchClosed();
return true;
}
});
return true;
}
use of androidx.appcompat.widget.SearchView in project AntennaPod by AntennaPod.
the class OnlineSearchFragment method setupToolbar.
private void setupToolbar(Toolbar toolbar) {
toolbar.inflateMenu(R.menu.online_search);
toolbar.setNavigationOnClickListener(v -> getParentFragmentManager().popBackStack());
MenuItem searchItem = toolbar.getMenu().findItem(R.id.action_search);
final SearchView sv = (SearchView) searchItem.getActionView();
sv.setQueryHint(getString(R.string.search_podcast_hint));
sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
sv.clearFocus();
search(s);
return true;
}
@Override
public boolean onQueryTextChange(String s) {
return false;
}
});
sv.setOnQueryTextFocusChangeListener((view, hasFocus) -> {
if (hasFocus) {
showInputMethod(view.findFocus());
}
});
searchItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
@Override
public boolean onMenuItemActionExpand(MenuItem item) {
return true;
}
@Override
public boolean onMenuItemActionCollapse(MenuItem item) {
getActivity().getSupportFragmentManager().popBackStack();
return true;
}
});
searchItem.expandActionView();
if (getArguments().getString(ARG_QUERY, null) != null) {
sv.setQuery(getArguments().getString(ARG_QUERY, null), true);
}
}
Aggregations