List of usage examples for android.content Context SEARCH_SERVICE
String SEARCH_SERVICE
To view the source code for android.content Context SEARCH_SERVICE.
Click Source Link
From source file:net.vivekiyer.GAL.CorporateContactRecord.java
/** * @param menu/*from w w w.j a va 2 s. co m*/ * @param v * @param menuInfo * * Create a context menu for the list view Depending upon the * item selected, shows the user different options */ /* * (non-Javadoc) * * @see android.app.Activity#onCreateOptionsMenu(android.view.Menu) * * Displays the menu when the user clicks the Options button In our case the * menu contains only one button - save */ @TargetApi(11) @Override public boolean onCreateOptionsMenu(Menu menu) { final MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.contacts_menu, menu); // Get the SearchView and set the searchable configuration for Honeycomb // and above if (!Utility.isPreHoneycomb()) { final SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); final ComponentName component = getComponentName(); final SearchableInfo searchableInfo = searchManager.getSearchableInfo(component); searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView(); searchView.setSearchableInfo(searchableInfo); } 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 w w w. j a v a 2 s .c o 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:ca.rmen.android.poetassistant.main.dictionaries.search.Search.java
public void setSearchView(SearchView searchView) { SearchManager searchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE); ComponentName searchableActivityComponentName = new ComponentName(mContext, mContext.getClass()); searchView.setSearchableInfo(searchManager.getSearchableInfo(searchableActivityComponentName)); }
From source file:de.fhb.mi.paperfly.user.FriendListFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { if (menu != null) { inflater.inflate(R.menu.user_friends, menu); }/* www .j ava2 s .c o m*/ SearchManager searchManager = (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.action_search_user).getActionView(); // Get the menu item from the action bar MenuItem menuItem = menu.findItem(R.id.action_search_user); menuItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() { @Override public boolean onMenuItemActionCollapse(MenuItem item) { Log.d(TAG, "Search deactivated. Unlocking drawers."); drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); return true; } @Override public boolean onMenuItemActionExpand(MenuItem item) { Log.d(TAG, "Search activated. Locking drawers."); drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); return true; } }); // Assumes current activity is the searchable activity searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName())); }
From source file:org.mythtv.android.player.app.videos.VideosActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the options menu from XML MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main, menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.search_action).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(false); return super.onCreateOptionsMenu(menu); }
From source file:im.vector.activity.LanguagePickerActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_languages_picker, menu); CommonActivityUtils.tintMenuIcons(menu, ThemeUtils.getColor(this, R.attr.icon_tint_on_dark_action_bar_color)); final MenuItem searchItem = menu.findItem(R.id.action_search); if (searchItem != null) { SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); mSearchView = (SearchView) MenuItemCompat.getActionView(searchItem); mSearchView.setMaxWidth(Integer.MAX_VALUE); mSearchView.setSubmitButtonEnabled(false); mSearchView.setQueryHint(getString(R.string.search_hint)); mSearchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); mSearchView.setOnQueryTextListener(this); SearchView.SearchAutoComplete searchAutoComplete = mSearchView .findViewById(android.support.v7.appcompat.R.id.search_src_text); searchAutoComplete.setHintTextColor(ThemeUtils.getColor(this, R.attr.default_text_hint_color)); }//from w w w . ja v a 2 s . com return true; }
From source file:org.yuzhiqiang.itsmine.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { if (!mNavigationDrawerFragment.isDrawerOpen()) { // Only show items in the action bar relevant to this screen // if the drawer is not showing. Otherwise, let the drawer // decide what to show in the action bar. getMenuInflater().inflate(R.menu.main, menu); restoreActionBar();/*from w w w. j a v a2 s .com*/ // Get the SearchView and set the searchable configuration SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.action_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 return true; } return super.onCreateOptionsMenu(menu); }
From source file:com.pindroid.activity.FragmentBaseActivity.java
public void setupSearch(Menu menu) { SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); MenuItem searchItem = menu.findItem(R.id.menu_search); SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setSubmitButtonEnabled(false); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { public boolean onQueryTextSubmit(String query) { startSearch(query);/* ww w . j a v a2s .com*/ return true; } public boolean onQueryTextChange(final String s) { return false; } }); }
From source file:uk.org.crimetalk.SearchActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_search, menu); // Modify some aspects of the SearchView final SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); final MenuItem searchItem = menu.findItem(R.id.action_search); final SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setQuery(mQuery, false);/*from www .j av a 2s . co m*/ searchView.setIconified(false); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String s) { return false; } @Override public boolean onQueryTextChange(String query) { SearchActivity.this.mQuery = query; return false; } }); final SearchView.SearchAutoComplete searchAutoComplete = (SearchView.SearchAutoComplete) searchView .findViewById(R.id.search_src_text); searchAutoComplete.setTextColor(getResources().getColor(R.color.white)); // Recovering from orientation change, try not to have focus if (mQuery != null && !mQuery.isEmpty()) { searchView.clearFocus(); } return true; }
From source file:com.tinbytes.simplesearchapp.SimpleListViewActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_simple_list_view, menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.action_search_animal)); if (searchView != null) { searchView.setOnQueryTextListener(this); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(true); }/*from ww w.ja v a2 s . c o m*/ return true; }