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:com.rowland.movies.ui.activities.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); // Acquire the search manager SearchManager SManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); // Acquire the relevant search menu item MenuItem searchMenuItem = menu.findItem(R.id.action_search); // Acquire the search view SearchView mSearchView = (SearchView) MenuItemCompat.getActionView(searchMenuItem); // Set the Search activity class mSearchView.setSearchableInfo(/*from w w w .j av a2 s . c o m*/ SManager.getSearchableInfo(new ComponentName(getApplicationContext(), SearchActivity.class))); // Set if should use an icon mSearchView.setIconifiedByDefault(true); // return whether menu was succesfully created return super.onCreateOptionsMenu(menu); }
From source file:org.epstudios.epcoding.ProcedureListActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.shortmenu, menu); // Get the SearchView and set the searchable configuration SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView(); // Assumes current activity is the searchable activity searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); Log.d("EPCODING", getComponentName().toString()); searchView.setIconifiedByDefault(false); // Do not iconify the widget; // expand it by default return super.onCreateOptionsMenu(menu); }
From source file:com.ronnyml.sweetplayer.ui.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main, menu); MenuItem searchItem = menu.findItem(R.id.action_search); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); return true;//from w w w.ja va2 s. co m }
From source file:com.kaszubski.kamil.emmhelper.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. if (fragmentManager.findFragmentById(R.id.container) != null) { switch (fragmentManager.findFragmentById(R.id.container).getTag()) { case Constants.FRAGMENT_SEARCH: longTextTitleMode(false);// www . j av a 2 s . c om setTitle(getString(R.string.application_list)); getMenuInflater().inflate(R.menu.fragment_search, menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.action_search)); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setQueryHint(getString(R.string.query_hint)); progressDialog = new ProgressDialog(this, ProgressDialog.STYLE_SPINNER); progressDialog.setMessage(getString(R.string.loading_packages)); progressDialog.setIndeterminate(true); progressDialog.setCancelable(false); progressDialog.show(); new LoadPackages().execute(); break; case Constants.FRAGMENT_IP_FIND: longTextTitleMode(false); setTitle(getString(R.string.hostname_ips)); getMenuInflater().inflate(R.menu.fragment_ip_finder, menu); break; case Constants.FRAGMENT_EXPORT: longTextTitleMode(true); break; case Constants.FRAGMENT_LICENSE_CHECK: longTextTitleMode(false); setTitle(getString(R.string.check_elm_key)); break; } } return true; }
From source file:com.lucassaka.botonerags.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); MenuItem searchItem = menu.findItem(R.id.search); SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem); // Get the SearchView and set the searchable configuration SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); // Assumes current activity is the searchable activity searchView.setSearchableInfo(//from w w w . j a va2s.co m searchManager.getSearchableInfo(new ComponentName(this, SearchableActivity.class))); searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default return true; }
From source file:com.zotfeed2.ListContentFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.menu_newu, menu); // MenuItem item = menu.findItem(R.id.action_search); SearchManager searchManager = (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE); MenuItem searchItem = menu.findItem(R.id.action_search); SearchView sv = (SearchView) MenuItemCompat.getActionView(searchItem); if (sv != null) { sv.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName())); sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override// w w w . j av a 2s .co m public boolean onQueryTextSubmit(String query) { System.out.print("QUERY:" + query); results = new ArrayList<Article>(); if (!feeds.isEmpty() || feeds != null) { for (Article article : feeds) { //System.out.println("Title: " + article.getTitle()); if (article.getTitle().toLowerCase().contains(query.toLowerCase())) { results.add(article); System.out.println("Results: " + article.getTitle()); } } System.out.println("Size: " + results.size()); search = true; recyclerView.setAdapter(new ContentAdapter(results)); recyclerView.setHasFixedSize(true); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); return true; } else { return false; } } @Override public boolean onQueryTextChange(String newText) { if (newText.isEmpty() || newText.equals(" ")) { if (feeds != null) { recyclerView.setAdapter(new ContentAdapter(feeds)); recyclerView.setHasFixedSize(true); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); } } return false; } }); } super.onCreateOptionsMenu(menu, inflater); }
From source file:com.msted.lensrocket.activities.FriendsListActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.friends_list, menu); // Associate searchable configuration with the SearchView SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); mSearchView = (SearchView) menu.findItem(R.id.menuSearch).getActionView(); mSearchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); mSearchView.setOnQueryTextListener(new OnQueryTextListener() { @Override/* w ww. ja va2 s.c o m*/ public boolean onQueryTextSubmit(String query) { return true; } @Override public boolean onQueryTextChange(final String newText) { LensRocketLogger.i(TAG, "Text: " + newText); mCurrentName = newText; mBtnAddFriend.setEnabled(true); mBtnAddFriend.setVisibility(View.VISIBLE); mAdapter.getFilter().filter(newText, new FilterListener() { @Override public void onFilterComplete(int count) { if (mAdapter.getCount() > 0) mLvFriends.setVisibility(View.VISIBLE); else mLvFriends.setVisibility(View.GONE); if (!mCurrentName.equals("")) { mLayoutAddFriend.setVisibility(View.VISIBLE); } else { mLayoutAddFriend.setVisibility(View.GONE); } if (mLensRocketService.getLocalFriendNames().contains(newText)) mLayoutAddFriend.setVisibility(View.GONE); } }); mLblNewFriendName.setText(mCurrentName); return true; } }); return true; }
From source file:com.yanzhenjie.searchview.sample.SearchActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main, menu); mSearchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.menu_action_user_search)); Utils.setSearchViewCursorColor(mSearchView, R.drawable.text_cursor_white); mSearchView.setSubmitButtonEnabled(true); mSearchView.setQueryHint(getText(R.string.title_search_user_hint)); mSearchView.setOnQueryTextListener(mOnQueryTextListener); // Can not exit to icon. // mSearchView.setOnCloseListener(() -> TextUtils.isEmpty(mSearchView.getQuery())); // Automatic expansion. // mSearchView.setIconified(false); // mSearchView.setIconifiedByDefault(true); mSearchView.setOnSuggestionListener(mSuggestionListener); SearchableInfo searchableInfo = ((SearchManager) getSystemService(Context.SEARCH_SERVICE)) .getSearchableInfo(getComponentName()); mSearchView.setSearchableInfo(searchableInfo); mCursorAdapter = new SimpleCursorAdapter(this, R.layout.item_text_list_popup, null, new String[] { UserSearchProvider.ProviderInfo.USER_NAME, UserSearchProvider.ProviderInfo.USER_DES }, new int[] { R.id.tv_item_list, R.id.tv_item_list_des }, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER); mSearchView.setSuggestionsAdapter(mCursorAdapter); getSupportLoaderManager().initLoader(CURSOR_LOADER_ID, null, mLoaderCallbacks); return true;//from ww w . j a v a 2 s. c o m }
From source file:net.seedboxer.seedroid.activities.fragments.DownloadsFragment.java
/** * Get the SearchView and set the searchable configuration * @param menu/* w w w. j a va 2 s. co m*/ */ private void createFilteredMenu(Menu menu) { SearchManager searchManager = (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName())); searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default searchView.setOnQueryTextListener(new OnQueryTextListener() { public boolean onQueryTextSubmit(String query) { adapter.getFilter().filter(query); return true; } public boolean onQueryTextChange(String newText) { adapter.getFilter().filter(newText); return true; } }); }
From source file:de.lebenshilfe_muenster.uk_gebaerden_muensterland.sign_browser.search.SignSearchActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { Log.d(TAG, "onCreateOptionsMenu()" + this.hashCode()); super.onCreateOptionsMenu(menu); final MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.options_sign_browser_search, menu); 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())); return true;//w ww. ja va 2 s .co m }