List of usage examples for android.widget SearchView setSearchableInfo
public void setSearchableInfo(SearchableInfo searchable)
From source file:com.gnufabio.costituzione.SearchResultsActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.actionbar_mainscreen, menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(true); searchView.setOnQueryTextListener(this); return true;/* w ww . jav a2 s . com*/ }
From source file:ca.rmen.android.palidamuerte.app.category.list.CategoriesActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { Log.v(TAG, "onCreateOptionsMenu"); super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.menu_categories, menu); ActionBar.updateMusicMenuItem(this, menu.findItem(R.id.action_music)); // Associate searchable configuration with the SearchView SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); return true;//w ww . jav a 2 s . c o m }
From source file:se.chalmers.watchme.activity.TagMovieListActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); /*/*from w w w. j av a 2 s.co m*/ * It should not be possible to mail or sort in this activity */ MenuItem mailItem = menu.findItem(R.id.menu_send_email_button); mailItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); MenuItem sortItem = menu.findItem(R.id.menu_sort_button); sortItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); /* * Add necessary functionality for the search widget */ SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.menu_search_button).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(false); // Do not iconify the widget; // expand it by default return true; }
From source file:org.bwgz.quotation.activity.QuotationsActivity.java
public boolean onCreateOptionsMenu(final Menu menu) { Log.d(TAG, String.format("onCreateOptionsMenu - menu: %s", menu)); getMenuInflater().inflate(R.menu.options_menu, menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setQueryHint(getString(R.string.search_keyword)); final ListView drawerView = (ListView) findViewById(R.id.drawer_view); DrawerAdapter adapter = new DrawerAdapter(getResources().getStringArray(R.array.quotations_drawer), 1); drawerView.setAdapter(adapter);//from w ww .ja va 2 s . c o m drawerView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Log.d(TAG, String.format("drawer - onItemClick - parent: %s view: %s position: %d id: %d", parent, view, position, id)); if (id == 0) { drawerLayout.closeDrawer(drawerView); startActivity(new Intent(parent.getContext(), HomeActivity.class)); } } }); return true; }
From source file:com.fastbootmobile.encore.app.SearchActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.search, menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); return true;/*from ww w .j a v a 2 s . c om*/ }
From source file:org.bwgz.quotation.activity.SubjectsActivity.java
public boolean onCreateOptionsMenu(final Menu menu) { Log.d(TAG, String.format("onCreateOptionsMenu - menu: %s", menu)); getMenuInflater().inflate(R.menu.options_menu, menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setQueryHint(getString(R.string.search_subject)); final ListView drawerView = (ListView) findViewById(R.id.drawer_view); DrawerAdapter adapter = new DrawerAdapter(getResources().getStringArray(R.array.subjects_drawer), 1); drawerView.setAdapter(adapter);/*w w w . ja v a 2 s . c o m*/ drawerView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Log.d(TAG, String.format("drawer - onItemClick - parent: %s view: %s position: %d id: %d", parent, view, position, id)); if (id == 0) { drawerLayout.closeDrawer(drawerView); startActivity(new Intent(parent.getContext(), HomeActivity.class)); } } }); return true; }
From source file:se.chalmers.watchme.activity.SearchableActivity.java
public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); /*/*from ww w .java2s.co m*/ * It should not be possible to mail or sort in this activity */ MenuItem mailItem = menu.findItem(R.id.menu_send_email_button); mailItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); MenuItem sortItem = menu.findItem(R.id.menu_sort_button); sortItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); /* * Add necessary functionality for the search widget */ SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.menu_search_button).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(false); // Do not iconify the widget; // expand it by default return true; }
From source file:com.bdenney.locl.activity.NearbyActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the options menu from XML MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu, menu); // Get the SearchView and set the searchable configuration SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView(); // Assumes current activity is the searchable activity searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default if (!TextUtils.isEmpty(getSearchTerm())) { final MenuItem item = menu.findItem(R.id.menu_search); if (item != null) { item.setVisible(false);//ww w.j a va 2s . c o m } } return true; }
From source file:se.chalmers.watchme.activity.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); mailItem = menu.findItem(R.id.menu_send_email_button); sortItem = menu.findItem(R.id.menu_sort_button); searchItem = menu.findItem(R.id.menu_search_button); setButtonsState();/*from www . j ava 2 s. co m*/ /* * Add necessary functionality for the search widget */ SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.menu_search_button).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(false); // Do not iconify the widget; // expand it by default return true; }
From source file:com.conferenceengineer.android.iosched.ui.phone.SessionsActivity.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override/*from w w w. j ava2 s. c o m*/ public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.search, menu); MenuItem searchItem = menu.findItem(R.id.menu_search); if (searchItem != null && UIUtils.hasHoneycomb()) { SearchView searchView = (SearchView) searchItem.getActionView(); if (searchView != null) { SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setQueryRefinementEnabled(true); } } return true; }