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:com.github.rutvijkumar.twittfuse.activities.BaseFragmentActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.tweets_menus, menu);

    MenuItem searchItem = menu.findItem(R.id.action_search);
    searchView = (SearchView) searchItem.getActionView();
    Util.setupSearchView(this, searchView);
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    composeActionMenu = menu.findItem(R.id.action_compose);
    composeActionVisibility(false);/*  www  . ja v a  2  s.  c  om*/
    return true;
}

From source file:igor70334.mymovies.ui.activity.BaseActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {

    getMenuInflater().inflate(R.menu.menu_main, menu);

    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView;/*from w  w  w.  j ava  2  s  .com*/
    MenuItem item = menu.findItem(R.id.search);

    searchView = (SearchView) item.getActionView();

    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    searchView.setQueryHint(getResources().getString(R.string.search_hint));

    return true;
}

From source file:com.github.pockethub.ui.search.SearchActivity.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()));

    return true;//w w  w  . j  a v a2  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);/*from   w w  w .  j a  v a 2s  . 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.thelastcrusade.soundstream.SearchActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the options menu from XML
    getMenuInflater().inflate(R.menu.search_menu, menu);

    // Get the SearchView and set the searchable configuration
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    MenuItem searchItem = menu.findItem(R.id.search);
    SearchView searchView = (SearchView) searchItem.getActionView();

    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    searchView.setIconifiedByDefault(true);

    return true;/* w  ww . jav a2 s  .  c  om*/
}

From source file:org.openmrs.client.activities.FindActiveVisitsActivity.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override/*from w w  w  .j a  v a 2  s  .  c  o  m*/
public boolean onCreateOptionsMenu(Menu menu) {
    this.getSupportActionBar()
            .setSubtitle(getString(R.string.dashboard_logged_as, OpenMRS.getInstance().getUsername()));
    getMenuInflater().inflate(R.menu.find_patients_menu, menu);

    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);

    SearchView findVisitView;

    mFindVisitItem = menu.findItem(R.id.actionSearch);
    if (OpenMRS.getInstance().isRunningHoneycombVersionOrHigher()) {
        findVisitView = (SearchView) mFindVisitItem.getActionView();
    } else {
        findVisitView = (SearchView) MenuItemCompat.getActionView(mFindVisitItem);
    }

    SearchableInfo info = searchManager.getSearchableInfo(getComponentName());
    findVisitView.setSearchableInfo(info);
    return true;
}

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  w  w  .  j a  va2 s  .  c  om*/
}

From source file:org.openmrs.mobile.activities.FindActiveVisitsActivity.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override//  w ww .  j ava  2 s  .  c  o m
public boolean onCreateOptionsMenu(Menu menu) {
    this.getSupportActionBar()
            .setSubtitle(getString(R.string.dashboard_logged_as, OpenMRS.getInstance().getUsername()));
    getMenuInflater().inflate(R.menu.find_patients_menu, menu);

    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);

    SearchView findVisitView;

    mFindVisitItem = menu.findItem(R.id.actionSearch);
    mFindVisitItem.getIcon().setAlpha(ApplicationConstants.ENABLED_ICON_ALPHA);
    if (OpenMRS.getInstance().isRunningHoneycombVersionOrHigher()) {
        findVisitView = (SearchView) mFindVisitItem.getActionView();
    } else {
        findVisitView = (SearchView) MenuItemCompat.getActionView(mFindVisitItem);
    }

    SearchableInfo info = searchManager.getSearchableInfo(getComponentName());
    findVisitView.setSearchableInfo(info);
    return true;
}

From source file:com.github.pockethub.android.ui.search.SearchActivity.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()));

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

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   w ww . j av a 2  s . co m*/
}