use of android.widget.SearchView in project Xposed-Tinted-Status-Bar by MohammadAG.
the class PackageListActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
mSearchItem = menu.findItem(R.id.action_search);
final SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
searchView.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
mSearchItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
@Override
public boolean onMenuItemActionExpand(MenuItem menuItem) {
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
mNameFilter = query;
mAppListAdaptor.getFilter().filter(mNameFilter);
findViewById(R.id.action_search).clearFocus();
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
mNameFilter = newText;
mAppListAdaptor.getFilter().filter(mNameFilter);
return false;
}
});
return true;
}
@Override
public boolean onMenuItemActionCollapse(MenuItem menuItem) {
mAppListAdaptor.getFilter().filter("");
return true;
}
});
return true;
}
use of android.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 android.widget.SearchView in project Klyph by jonathangerbaud.
the class Groups method onCreateOptionsMenu.
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
if (getAdapter() != null && getAdapter().getCount() > 0) {
// Create the search view
SearchView searchView = new SearchView(((FragmentActivity) getActivity()).getActionBar().getThemedContext());
searchView.setQueryHint("Search for groups");
searchView.setOnQueryTextListener(this);
menu.add("Search").setIcon(AttrUtil.getResourceId(getActivity(), R.attr.searchIcon)).setActionView(searchView).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
}
super.onCreateOptionsMenu(menu, inflater);
}
use of android.widget.SearchView in project k-9 by k9mail.
the class FolderList method configureFolderSearchView.
private void configureFolderSearchView(Menu menu) {
final MenuItem folderMenuItem = menu.findItem(R.id.filter_folders);
final SearchView folderSearchView = (SearchView) folderMenuItem.getActionView();
folderSearchView.setQueryHint(getString(R.string.folder_list_filter_hint));
folderSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
folderMenuItem.collapseActionView();
mActionBarTitle.setText(getString(R.string.filter_folders_action));
return true;
}
@Override
public boolean onQueryTextChange(String newText) {
mAdapter.getFilter().filter(newText);
return true;
}
});
folderSearchView.setOnCloseListener(new SearchView.OnCloseListener() {
@Override
public boolean onClose() {
mActionBarTitle.setText(getString(R.string.folders_title));
return false;
}
});
}
use of android.widget.SearchView in project android_frameworks_base by AOSPA.
the class SelectPrinterActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.select_printer_activity, menu);
MenuItem searchItem = menu.findItem(R.id.action_search);
SearchView searchView = (SearchView) searchItem.getActionView();
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return true;
}
@Override
public boolean onQueryTextChange(String searchString) {
((DestinationAdapter) mListView.getAdapter()).getFilter().filter(searchString);
return true;
}
});
searchView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
@Override
public void onViewAttachedToWindow(View view) {
if (AccessibilityManager.getInstance(SelectPrinterActivity.this).isEnabled()) {
view.announceForAccessibility(getString(R.string.print_search_box_shown_utterance));
}
}
@Override
public void onViewDetachedFromWindow(View view) {
if (!isFinishing() && AccessibilityManager.getInstance(SelectPrinterActivity.this).isEnabled()) {
view.announceForAccessibility(getString(R.string.print_search_box_hidden_utterance));
}
}
});
return true;
}
Aggregations