use of android.widget.SearchView in project Klyph by jonathangerbaud.
the class Friends 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 friends");
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 Klyph by jonathangerbaud.
the class FollowedPeople 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 people");
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 robolectric by robolectric.
the class ShadowActivityTest method canGetOptionsMenuWithActionMenu.
@Test
public void canGetOptionsMenuWithActionMenu() throws Exception {
ActionMenuActivity activity = buildActivity(ActionMenuActivity.class).create().visible().get();
SearchView searchView = activity.mSearchView;
// This blows up when ShadowPopupMenu existed.
searchView.setIconifiedByDefault(false);
}
use of android.widget.SearchView in project ETSMobile-Android2 by ApplETS.
the class MapActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the options menu from XML
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_map, menu);
// Get the SearchView and set the searchable configuration
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
SearchView searchView = (SearchView) menu.findItem(R.id.menu_map_search).getActionView();
// Assumes current activity is the searchable activity
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
// Do not iconify the widget;
searchView.setIconifiedByDefault(false);
return true;
}
use of android.widget.SearchView in project android_packages_apps_Settings by SudaMod.
the class PrintServiceSettingsFragment method onCreateOptionsMenu.
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.print_service_settings, menu);
MenuItem addPrinters = menu.findItem(R.id.print_menu_item_add_printer);
if (mServiceEnabled && mAddPrintersIntent != null) {
addPrinters.setIntent(mAddPrintersIntent);
} else {
menu.removeItem(R.id.print_menu_item_add_printer);
}
MenuItem settings = menu.findItem(R.id.print_menu_item_settings);
if (mServiceEnabled && mSettingsIntent != null) {
settings.setIntent(mSettingsIntent);
} else {
menu.removeItem(R.id.print_menu_item_settings);
}
MenuItem searchItem = menu.findItem(R.id.print_menu_item_search);
if (mServiceEnabled && mPrintersAdapter.getUnfilteredCount() > 0) {
mSearchView = (SearchView) searchItem.getActionView();
mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return true;
}
@Override
public boolean onQueryTextChange(String searchString) {
mPrintersAdapter.getFilter().filter(searchString);
return true;
}
});
mSearchView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
@Override
public void onViewAttachedToWindow(View view) {
if (AccessibilityManager.getInstance(getActivity()).isEnabled()) {
view.announceForAccessibility(getString(R.string.print_search_box_shown_utterance));
}
}
@Override
public void onViewDetachedFromWindow(View view) {
Activity activity = getActivity();
if (activity != null && !activity.isFinishing() && AccessibilityManager.getInstance(activity).isEnabled()) {
view.announceForAccessibility(getString(R.string.print_search_box_hidden_utterance));
}
}
});
} else {
menu.removeItem(R.id.print_menu_item_search);
}
}
Aggregations