Example usage for android.content Context SEARCH_SERVICE

List of usage examples for android.content Context SEARCH_SERVICE

Introduction

In this page you can find the example usage for android.content Context SEARCH_SERVICE.

Prototype

String SEARCH_SERVICE

To view the source code for android.content Context SEARCH_SERVICE.

Click Source Link

Document

Use with #getSystemService(String) to retrieve a android.app.SearchManager for handling searches.

Usage

From source file:Main.java

public static boolean searchActivityExists(Context context) {
    SearchManager searchManager = (SearchManager) context.getSystemService(Context.SEARCH_SERVICE);
    ComponentName activityName = searchManager.getGlobalSearchActivity();

    return activityName != null;
}

From source file:MainActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu_options, menu);
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.menu_search));
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    return true;/* w  w  w. j av  a2  s .  co m*/
}

From source file:android.support.test.testapp.ActionBarSearchActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    inflater.inflate(R.menu.actionbar_search_actions, 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.setIconifiedByDefault(false);
    return super.onCreateOptionsMenu(menu);
}

From source file:com.github.mobile.ui.issue.IssueSearchActivity.java

@Override
public boolean onCreateOptionsMenu(Menu options) {
    getMenuInflater().inflate(R.menu.search, options);

    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    MenuItem searchItem = options.findItem(R.id.m_search);
    SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));

    Bundle args = new Bundle();
    args.putSerializable(EXTRA_REPOSITORY, repository);
    searchView.setAppSearchData(args);/*from w  w w  .  j  a  v  a  2s. com*/
    return true;
}

From source file:se.chalmers.watchme.activity.TagMovieListActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_main, menu);

    /*//from  w ww .  j a  v a2 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: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;//from  w  ww.  j  a v  a 2 s  . c o m
}

From source file:com.github.pockethub.ui.issue.IssueSearchActivity.java

@Override
public boolean onCreateOptionsMenu(Menu options) {
    getMenuInflater().inflate(R.menu.search, options);

    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    MenuItem searchItem = options.findItem(R.id.m_search);
    SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));

    Bundle args = new Bundle();
    args.putParcelable(EXTRA_REPOSITORY, repository);
    searchView.setAppSearchData(args);//  w  w  w  .  jav  a2  s .co  m
    return true;
}

From source file:com.jbirdvegas.mgerrit.AOKPChangelog.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    this.setTheme(Prefs.getCurrentThemeID(this));
    super.onCreate(savedInstanceState);

    setContentView(R.layout.aokp_changelog);

    // Action bar Up affordance
    getActionBar().setDisplayHomeAsUpEnabled(true);

    Prefs.setGerritInstanceByName(this, "AOKP");

    ChangelogFragment frag;/*from   w w  w. j a  v a  2  s. com*/
    frag = (ChangelogFragment) getSupportFragmentManager().findFragmentById(R.id.changelog_fragment);
    frag.setQuery(mQuery);

    // Get the SearchView and set the searchable configuration
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    mSearchView = (GerritSearchView) findViewById(R.id.search);
    mSearchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
}

From source file:fr.outadev.skinswitch.GalleryActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.skin_library, menu);

    //set up search view
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.action_search));
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    searchView.setIconifiedByDefault(true);

    return true;//from www  .j  a v a 2 s. c  o  m
}

From source file:com.github.pockethub.android.ui.issue.IssueSearchActivity.java

@Override
public boolean onCreateOptionsMenu(Menu options) {
    getMenuInflater().inflate(R.menu.activity_search, options);

    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    MenuItem searchItem = options.findItem(R.id.m_search);
    searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));

    Bundle args = new Bundle();
    args.putParcelable(EXTRA_REPOSITORY, repository);
    searchView.setAppSearchData(args);//from   w  w w.j a  v  a 2  s . com
    return true;
}