Example usage for android.app SearchManager QUERY

List of usage examples for android.app SearchManager QUERY

Introduction

In this page you can find the example usage for android.app SearchManager QUERY.

Prototype

String QUERY

To view the source code for android.app SearchManager QUERY.

Click Source Link

Document

Intent extra data key: Use this key with android.content.Intent#getStringExtra content.Intent.getStringExtra() to obtain the query string from Intent.ACTION_SEARCH.

Usage

From source file:com.google.android.apps.iosched.ui.SearchActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent intent = getIntent();//from   w w w .  j a  v a 2s .c  o  m
    mQuery = intent.getStringExtra(SearchManager.QUERY);

    setContentView(R.layout.activity_search);

    getActivityHelper().setupActionBar(getTitle(), 0);
    final CharSequence title = getString(R.string.title_search_query, mQuery);
    getActivityHelper().setActionBarTitle(title);

    mTabHost = (TabHost) findViewById(android.R.id.tabhost);
    mTabWidget = (TabWidget) findViewById(android.R.id.tabs);
    mTabHost.setup();

    setupSessionsTab();
    setupVendorsTab();
}

From source file:org.klnusbaum.udj.PlayerSelectorActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) {
        searchType = PlayerListFragment.SearchType.NAME_SEARCH;
    } else {//www.  j a va  2  s .co  m
        searchType = PlayerListFragment.SearchType.LOCATION_SEARCH;
    }

    setContentView(R.layout.player_selector);
    setSupportProgressBarIndeterminateVisibility(false);

    pagerAdapter = new PlayerListPagerAdapter(getSupportFragmentManager(), searchType);
    if (searchType == PlayerListFragment.SearchType.NAME_SEARCH) {
        pagerAdapter.setSearchQuery(getIntent().getStringExtra(SearchManager.QUERY));
    }
    pager = (ViewPager) findViewById(R.id.player_selector_pager);
    pager.setAdapter(pagerAdapter);

    TitlePageIndicator titleIndicator = (TitlePageIndicator) findViewById(R.id.titles);
    titleIndicator.setViewPager(pager);

}

From source file:com.bdenney.locl.activity.NearbyActivity.java

private String getSearchTerm() {
    String query = null;//from ww w. j  a v  a  2  s  . c  o  m
    Intent intent = getIntent();
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        query = intent.getStringExtra(SearchManager.QUERY);
    }
    return Strings.nullToEmpty(query);
}

From source file:com.google.android.apps.iosched2.ui.SearchActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    SetupHelper.loadCurrentSetup(this);

    Intent intent = getIntent();/*from   w  w w  .  ja  v  a2  s . c  o  m*/
    mQuery = intent.getStringExtra(SearchManager.QUERY);
    doEasterEgg(mQuery);

    setContentView(R.layout.activity_search);

    getActivityHelper().setupActionBar(getTitle(), 0);
    final CharSequence title = getString(R.string.title_search_query, mQuery);
    getActivityHelper().setActionBarTitle(title);

    mTabHost = (TabHost) findViewById(android.R.id.tabhost);
    mTabWidget = (TabWidget) findViewById(android.R.id.tabs);
    mTabHost.setup();

    setupSessionsTab();

    /*
     * removed vendors
     */
    if (Setup.FEATURE_VENDORS_ON) {
        setupVendorsTab();
    }
}

From source file:org.maikelwever.droidpile.SearchActivity.java

private void handleIntent(Intent intent) {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        this.searchQuery = intent.getStringExtra(SearchManager.QUERY);
        doSearch();/*from  w  ww  .j  a  va2s .  c o m*/
    } else if (!this.searchQuery.isEmpty()) {
        doSearch();
    }
}

From source file:com.vagabond.dealhunting.ui.SearchActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.search);/* w ww .j a  va 2  s  . co m*/

    mSearchView = (SearchView) findViewById(R.id.search_view);
    setupSearchView();
    mSearchResults = (ListView) findViewById(R.id.search_results);
    mResultsAdapter = new SearchAdapter(this, null, 0);
    mSearchResults.setAdapter(mResultsAdapter);
    mSearchResults.setOnItemClickListener(this);

    String query = getIntent().getStringExtra(SearchManager.QUERY);
    query = query == null ? "" : query;
    mQuery = query;

    if (mSearchView != null) {
        mSearchView.setQuery(query, false);
    }
}

From source file:com.pindroid.activity.FragmentBaseActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    app = (PindroidApplication) getApplicationContext();

    mAccountManager = AccountManager.get(this);

    if (getSupportActionBar() != null) {
        getSupportActionBar().setHomeButtonEnabled(true);
    }/* ww  w .j a  va 2 s  .com*/

    Intent intent = getIntent();

    if (Intent.ACTION_SEARCH.equals(intent.getAction()) && !intent.hasExtra("MainSearchResults")) {
        if (intent.hasExtra("username"))
            app.setUsername(intent.getStringExtra("username"));

        if (intent.hasExtra(SearchManager.QUERY)) {
            //Intent i = new Intent(this, MainSearchResults.class);
            //i.putExtras(intent.getExtras());
            //startActivity(i);
            //finish();
        } else {
            onSearchRequested();
        }
    }

    //init();
}

From source file:io.github.hidroh.materialistic.FavoriteActivity.java

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    if (!intent.hasExtra(SearchManager.QUERY)) {
        return;/*from  ww  w .  j  a  va2  s .c o m*/
    }
    onItemSelected(null);
    mFilter = intent.getStringExtra(SearchManager.QUERY);
    if (TextUtils.equals(mFilter, EMPTY_QUERY)) {
        mFilter = null;
    }
    getSupportActionBar().setSubtitle(mFilter);
    FavoriteFragment fragment = (FavoriteFragment) getSupportFragmentManager()
            .findFragmentByTag(LIST_FRAGMENT_TAG);
    if (fragment != null) {
        fragment.filter(mFilter);
    }
}

From source file:com.yeldi.yeldibazaar.SearchResults.java

@Override
public void onCreate(Bundle savedInstanceState) {

    if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("lightTheme", false))
        setTheme(R.style.AppThemeLight);

    super.onCreate(savedInstanceState);
    ActionBarCompat.create(this).setDisplayHomeAsUpEnabled(true);
    applist = new AvailableAppListAdapter(this);
    setContentView(R.layout.searchresults);

    // Start a search by just typing
    setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);

    Intent intent = getIntent();//from w w w .j a  v  a2 s .c om

    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        mQuery = intent.getStringExtra(SearchManager.QUERY);
    }

    updateView();
}

From source file:org.onebusaway.android.ui.SearchActivity.java

private void handleIntent(Intent intent) {
    if (Intent.ACTION_VIEW.equals(intent.getAction())) {
        // handles a click on a search suggestion; launches activity to show word
        /*// w  w  w . j a  v a2  s  .  c o m
        Intent wordIntent = new Intent(this, WordActivity.class);
        wordIntent.setData(intent.getData());
        startActivity(wordIntent);
        finish();
        */
    } else if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        // handles a search query
        String query = intent.getStringExtra(SearchManager.QUERY);
        //Analytics
        ObaAnalytics.reportEventWithCategory(ObaAnalytics.ObaEventCategory.UI_ACTION.toString(),
                getString(R.string.analytics_action_button_press),
                getString(R.string.analytics_label_button_press_search_button));
        doSearch(query);
    }
}