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.example.domiter.fileexplorer.fragment.SearchListFragment.java

private void handleIntent() {
    Intent intent = getActivity().getIntent();
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        // Get the query.
        mQuery = intent.getStringExtra(SearchManager.QUERY);
        getActivity().getActionBar().setTitle(mQuery);

        // Get the current path
        String path = intent.getBundleExtra(SearchManager.APP_DATA)
                .getString(IntentConstants.EXTRA_SEARCH_INIT_PATH);
        mRoot = new File(path);
        getActivity().getActionBar().setSubtitle(path);

        // Start the actual search
        getLoaderManager().initLoader(LOADER_ID, null, this);
        getActivity().setProgressBarIndeterminateVisibility(true);
    }/*  w ww  . j  ava  2 s.  co  m*/
    // We're here because of a clicked suggestion
    else if (Intent.ACTION_VIEW.equals(intent.getAction())) {
        browse(intent.getData());

        getActivity().finish();
    } else {
        // Intent contents error.
        getActivity().setTitle(R.string.query_error);
        setLoading(false);
    }
}

From source file:com.nma.util.sdcardtrac.SearchableActivity.java

private void handleIntent(Intent intent) {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        query = intent.getStringExtra(SearchManager.QUERY);
        // Replace spaces with wildcard
        //query = query.replace(' ', '%');
        if (SettingsActivity.ENABLE_DEBUG)
            Log.d(getClass().getName(), "Starting search: " + query);
        // Load data
        getSupportLoaderManager().restartLoader(0, null, this);
    }/*from   w w  w  .  j  a v a2 s.com*/
}

From source file:com.classiqo.nativeandroid_32bitz.ui.MusicPlayerActivity.java

protected void initializeFromParams(Bundle savedInstanceState, Intent intent) {
    String mediaId = null;/*ww w.ja  v  a 2  s .  c o  m*/

    if (intent.getAction() != null
            && intent.getAction().equals(MediaStore.INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH)) {
        mVoiceSearchParams = intent.getExtras();
        LogHelper.d(TAG, "Starting from voice search query = ",
                mVoiceSearchParams.getString(SearchManager.QUERY));
    } else {
        if (savedInstanceState != null) {
            mediaId = savedInstanceState.getString(SAVED_MEDIA_ID);
        }
    }
    navigateToBrowser(mediaId);
}

From source file:com.app_software.chromisstock.ProductListActivity.java

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

    setContentView(R.layout.activity_product_list);

    // Restore state
    if (savedInstanceState != null) {
        m_ListFragment = (ProductListFragment) getSupportFragmentManager().getFragment(savedInstanceState,
                "m_ListFragment");
    } else {//from w ww  .j  a va 2 s. c o m

        // If our layout has a container for the image selector fragment,
        // create and add it
        ViewGroup layout = (ViewGroup) findViewById(R.id.product_list);
        if (layout != null) {
            Bundle args = new Bundle();

            Intent i = getIntent();
            if (i != null) {
                if (Intent.ACTION_SEARCH.equals(i.getAction())) {
                    String search = i.getStringExtra(SearchManager.QUERY);
                    args.putString(ProductListFragment.ARG_SEARCH, search);
                }
            }

            // Add image selector fragment to the activity's container layout
            m_ListFragment = new ProductListFragment();
            m_ListFragment.setArguments(args);

            FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
            fragmentTransaction.replace(layout.getId(), m_ListFragment, ProductListFragment.class.getName());

            // Commit the transaction
            fragmentTransaction.commit();
        }
    }

    if (findViewById(R.id.product_detail_container) != null) {
        // The detail container view will be present only in the
        // large-screen layouts (res/values-large and
        // res/values-sw600dp). If this view is present, then the
        // activity should be in two-pane mode.
        mTwoPane = true;

        // In two-pane mode, list items should be given the
        // 'activated' state when touched.
        m_ListFragment.setActivateOnItemClick(true);
    }

}

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

private void handleIntent(Intent intent) {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        mQuery = intent.getStringExtra(SearchManager.QUERY);
        Intent searchIntent = new Intent(this, FindPatientsSearchActivity.class);
        searchIntent.putExtra(SearchManager.QUERY, mQuery);
        startActivityForResult(searchIntent, 1);
        intent.setAction(null);// w w  w  . java2 s  .c om
        if (mFindPatientMenuItem != null) {
            MenuItemCompat.collapseActionView(mFindPatientMenuItem);
        }
    }
}

From source file:com.google.samples.apps.sergio.ui.SearchActivity.java

@Override
protected void onNewIntent(Intent intent) {
    LOGD(TAG, "SearchActivity.onNewIntent: " + intent);
    setIntent(intent);/*  ww  w . j a v  a 2  s.  c o m*/
    String query = intent.getStringExtra(SearchManager.QUERY);
    Bundle args = intentToFragmentArguments(
            new Intent(Intent.ACTION_VIEW, ScheduleContract.Sessions.buildSearchUri(query)));
    LOGD(TAG, "onNewIntent() now reloading sessions fragment with args: " + args);
    mSessionsFragment.reloadFromArguments(args);
    /* [ANALYTICS:EVENT]
     * TRIGGER:   Start a search on the Search Activity
     * CATEGORY:  'Search'
     * ACTION:    'Search'
     * LABEL:     none (we DO NOT log the search query).
     * [/ANALYTICS]
     */
    AnalyticsManager.sendEvent(SCREEN_LABEL, "Search", "");
}

From source file:com.teocci.utubinbg.MainActivity.java

/**
 * Handle search intent and queries YouTube for videos
 *
 * @param intent//w w w .j a v a2 s .  com
 */
private void handleIntent(Intent intent) {

    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        String query = intent.getStringExtra(SearchManager.QUERY);

        viewPager.setCurrentItem(2, true); //switch to search fragment

        if (searchFragment != null) {
            searchFragment.searchQuery(query);
        }
    }
}

From source file:org.jsharkey.oilcan.BrowserActivity.java

public void onNewIntent(Intent intent) {
    // pull new url from query
    String url = intent.getStringExtra(SearchManager.QUERY);
    this.loadNewPage(url);
}

From source file:com.popofibo.weatherpop.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (drawToggle.onOptionsItemSelected(item)) {
        return true;
    }/*from   w  w w  . j  av a 2  s. c o m*/

    switch (item.getItemId()) {
    case R.id.action_websearch:
        Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
        intent.putExtra(SearchManager.QUERY, getActionBar().getTitle());

        if (intent.resolveActivity(getPackageManager()) != null) {
            startActivity(intent);
        } else {
            Toast.makeText(this, R.string.app_not_available, Toast.LENGTH_LONG).show();
        }
        return true;
    case R.id.action_refresh:
        intent = new Intent(this, WeatherPopDisplayActivity.class);

        intent.putExtra(WeatherPopConstants.EXTRA_MESSAGE, message);
        intent.putExtra(WeatherPopConstants.EXTRA_OPTION, option);
        startActivity(intent);
    default:
        return super.onOptionsItemSelected(item);
    }
}

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

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    Log.d(TAG, "In on list item clicked");
    final String artist = (String) artistsAdapter.getItem(position);
    Intent artistIntent = new Intent(Intent.ACTION_SEARCH);
    artistIntent.setClass(getActivity(), ArtistSearchActivity.class);
    artistIntent.putExtra(SearchManager.QUERY, artist);
    startActivityForResult(artistIntent, 0);
}