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.twinone.locker.ui.AppsFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.apps, menu); mMenu = menu;//from w w w . j a v a2 s . c o m updateMenuLayout(); // MenuItem mi = menu.findItem(R.id.apps_menu_search); // EditText test = (EditText) MenuItemCompat.getActionView(mi); SearchManager sm = (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE); MenuItem mi = (MenuItem) menu.findItem(R.id.apps_menu_search); SearchView sv = (SearchView) MenuItemCompat.getActionView(mi); sv.setSearchableInfo(sm.getSearchableInfo(getActivity().getComponentName())); }
From source file:io.github.vomitcuddle.SearchViewAllowEmpty.SuggestionsAdapter.java
public SuggestionsAdapter(Context context, SearchView searchView, SearchableInfo searchable, WeakHashMap<String, Drawable.ConstantState> outsideDrawablesCache) { super(context, R.layout.abc_search_dropdown_item_icons_2line, null, // no initial cursor true); // auto-requery mSearchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE); mSearchView = searchView;//from w ww.j ava 2 s .com mSearchable = searchable; // set up provider resources (gives us icons, etc.) mProviderContext = context; mOutsideDrawablesCache = outsideDrawablesCache; }
From source file:com.skubit.comics.activities.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setSubmitButtonEnabled(true); searchView/*w w w . j ava 2s .co m*/ .setSearchableInfo(searchManager.getSearchableInfo(new ComponentName(this, SearchActivity.class))); searchView.setQueryHint("Search Comics"); searchView.setOnSearchClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // } }); return true; }
From source file:com.rowland.hashtrace.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_mainactivity, menu); SearchManager SManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); MenuItem searchMenuItem = menu.findItem(R.id.action_search); /*SearchView mSearchView = (SearchView) MenuItemCompat.getActionView(searchMenuItem); mSearchView.setSearchableInfo(SManager.getSearchableInfo(new ComponentName(getApplicationContext(), SearchActivity.class))); mSearchView.setIconifiedByDefault(true);*/ return super.onCreateOptionsMenu(menu); }
From source file:com.whatsoft.contactbook.activity.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.search_menu, menu); // Get the SearchView and set the searchable configuration SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); 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 searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override//from w w w . j a v a2 s . c o m public boolean onQueryTextSubmit(String query) { Utils.hideSoftKeyboard(MainActivity.this); Fragment fragment = adapter.getItem(viewPager.getCurrentItem()); if (fragment instanceof ContactsListFragment) { ((ContactsListFragment) fragment).doSearch(query); } return true; } @Override public boolean onQueryTextChange(String newText) { //search with keyword length >= 3 // if (!TextUtils.isEmpty(newText) && newText.trim().length() < 3) { // return false; // } Fragment fragment = adapter.getItem(viewPager.getCurrentItem()); if (fragment instanceof ContactsListFragment) { ((ContactsListFragment) fragment).doSearch(newText); } return true; } }); return true; }
From source file:org.jitsi.android.gui.contactlist.ContactListFragment.java
/** * Invoked when the options menu is created. Creates our own options menu * from the corresponding xml.// ww w . j a v a 2s . com * * @param menu the options menu */ @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) @Override public void onCreateOptionsMenu(Menu menu, MenuInflater menuInflater) { super.onCreateOptionsMenu(menu, menuInflater); Activity activity = getActivity(); // Get the SearchView and set the searchable configuration SearchManager searchManager = (SearchManager) activity.getSystemService(Context.SEARCH_SERVICE); this.searchItem = menu.findItem(R.id.search); // OnActionExpandListener not supported prior API 14 if (AndroidUtils.hasAPI(14)) { searchItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() { @Override public boolean onMenuItemActionCollapse(MenuItem item) { filterContactList(""); return true; // Return true to collapse action view } public boolean onMenuItemActionExpand(MenuItem item) { return true; // Return true to expand action view } }); } if (AndroidUtils.hasAPI(11)) { SearchView searchView = (SearchView) searchItem.getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(activity.getComponentName())); int id = searchView.getContext().getResources().getIdentifier("android:id/search_src_text", null, null); TextView textView = (TextView) searchView.findViewById(id); textView.setTextColor(getResources().getColor(R.color.white)); textView.setHintTextColor(getResources().getColor(R.color.white)); bindSearchListener(); } }
From source file:robert843.o2.pl.player.ui.PlaceholderActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main, menu); MenuItem searchItem = menu.findItem(R.id.menu_search); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); setupNewSearchView(searchItem, searchManager); return true;//from w w w. j a va 2 s .co m }
From source file:android.support.v7.widget.SuggestionsAdapter.java
public SuggestionsAdapter(Context context, SearchView searchView, SearchableInfo searchable, WeakHashMap<String, Drawable.ConstantState> outsideDrawablesCache) { super(context, searchView.getSuggestionRowLayout(), null /* no initial cursor */, true /* auto-requery */); mSearchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE); mSearchView = searchView;//from w w w . j av a2 s . c om mSearchable = searchable; mCommitIconResId = searchView.getSuggestionCommitIconResId(); // set up provider resources (gives us icons, etc.) mProviderContext = context; mOutsideDrawablesCache = outsideDrawablesCache; }
From source file:cm.aptoide.com.actionbarsherlock.widget.SuggestionsAdapter.java
/** * The amount of time we delay in the filter when the user presses the delete key. *///w w w .j a v a 2s. c om //private static final long DELETE_KEY_POST_DELAY = 500L; public SuggestionsAdapter(Context context, SearchView searchView, SearchableInfo mSearchable, WeakHashMap<String, Drawable.ConstantState> outsideDrawablesCache) { super(context, R.layout.abs__search_dropdown_item_icons_2line, null, // no initial cursor true); // auto-requery mSearchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE); mProviderContext = mContext; mSearchView = searchView; mOutsideDrawablesCache = outsideDrawablesCache; // mStartSpinnerRunnable = new Runnable() { // public void run() { // // mSearchView.setWorking(true); // TODO: // } // }; // // mStopSpinnerRunnable = new Runnable() { // public void run() { // // mSearchView.setWorking(false); // TODO: // } // }; // delay 500ms when deleting // TODO getFilter().setDelayer(new Filter.Delayer() { // // private int mPreviousLength = 0; // // public long getPostingDelay(CharSequence constraint) { // if (constraint == null) return 0; // // long delay = constraint.length() < mPreviousLength ? DELETE_KEY_POST_DELAY : 0; // mPreviousLength = constraint.length(); // return delay; // } // }); }
From source file:com.cerema.cloud2.ui.fragment.SearchShareesFragment.java
/** * {@inheritDoc}/*from w ww . jav a 2 s .c om*/ */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.search_users_groups_layout, container, false); // Get the SearchView and set the searchable configuration SearchView searchView = (SearchView) view.findViewById(R.id.searchView); SearchManager searchManager = (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE); searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName()) // assumes parent activity is the searchable activity ); searchView.setIconifiedByDefault(false); // do not iconify the widget; expand it by default searchView.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI); // avoid fullscreen with softkeyboard searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { Log_OC.v(TAG, "onQueryTextSubmit intercepted, query: " + query); return true; // return true to prevent the query is processed to be queried; // a user / group will be picked only if selected in the list of suggestions } @Override public boolean onQueryTextChange(String newText) { return false; // let it for the parent listener in the hierarchy / default behaviour } }); return view; }