Example usage for android.content Intent ACTION_SEARCH

List of usage examples for android.content Intent ACTION_SEARCH

Introduction

In this page you can find the example usage for android.content Intent ACTION_SEARCH.

Prototype

String ACTION_SEARCH

To view the source code for android.content Intent ACTION_SEARCH.

Click Source Link

Document

Activity Action: Perform a search.

Usage

From source file:org.freespanish.diccionario.main.MainActivity.java

@Override
public void handleIntent(Intent intent) {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        String query = intent.getStringExtra(SearchManager.QUERY);
        searchFragment.onWordSearched(query);
    }/*from  w  w w.  j  a va2 s  .c o m*/
}

From source file:io.github.tjg1.nori.SearchActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    // Restore state from savedInstanceState.
    super.onCreate(savedInstanceState);

    // Get shared preferences.
    sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

    // Inflate views.
    setContentView(R.layout.activity_search);
    searchProgressBar = (ProgressBar) findViewById(R.id.progressBar);

    // Get search result grid fragment from fragment manager.
    searchResultGridFragment = (SearchResultGridFragment) getSupportFragmentManager()
            .findFragmentById(R.id.fragment_searchResultGrid);

    SearchClient.Settings searchClientSettings;
    // Try restoring the SearchClient from savedInstanceState
    if (savedInstanceState != null) {
        if (this.searchClient == null && savedInstanceState.containsKey(BUNDLE_ID_SEARCH_CLIENT_SETTINGS)) {
            searchClientSettings = savedInstanceState.getParcelable(BUNDLE_ID_SEARCH_CLIENT_SETTINGS);
            if (searchClientSettings != null) {
                searchClient = searchClientSettings.createSearchClient(this);
            }/*from www.j a  v  a  2 s  . c  o  m*/
        }
    } else {
        Intent intent = getIntent();
        // If the activity was started from a Search intent, create the SearchClient object and submit search.
        if (intent != null && intent.getAction().equals(Intent.ACTION_SEARCH)
                && searchResultGridFragment.getSearchResult() == null) {
            searchClientSettings = intent.getParcelableExtra(BUNDLE_ID_SEARCH_CLIENT_SETTINGS);
            searchClient = searchClientSettings.createSearchClient(this);
            doSearch(intent.getStringExtra(BUNDLE_ID_SEARCH_QUERY));
        }
        showDonationDialog();
    }

    // Set up the dropdown API server picker.
    setUpActionBar();
}

From source file:fr.matthiasbosc.translucentmap.MainActivity.java

private void handleIntent(Intent intent) {
    if (intent.getAction().equals(Intent.ACTION_SEARCH)) {
        doSearch(intent.getStringExtra(SearchManager.QUERY));
    } else if (intent.getAction().equals(Intent.ACTION_VIEW)) {
        getPlace(intent.getStringExtra(SearchManager.EXTRA_DATA_KEY));
    }//from w  w  w  .j  a  v  a2s . c om
}

From source file:com.jaspersoft.android.jaspermobile.test.acceptance.SearchableActivityTest.java

private void configureSearchIntent() {
    Intent launchIntent = new Intent();
    launchIntent.setAction(Intent.ACTION_SEARCH);
    Bundle extras = new Bundle();
    extras.putString(SearchableActivity_.QUERY_EXTRA, SEARCH_QUERY);
    launchIntent.putExtras(extras);// w w  w  .  j a va  2s.  com
    setActivityIntent(launchIntent);
}

From source file:com.smedic.tubtub.Pane.java

/**
 * Handle search intent and queries YouTube for videos
 *
 * @param intent//from w w  w.  ja va  2  s  .c o m
 */
private void handleIntent(Intent intent) {
    final String action = intent.getAction();

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

        viewPager.setCurrentItem(Pane.SEARCH.ordinal(), true); //switch to search fragment

        if (searchFragment != null)
            searchFragment.searchQuery(query);
        if (playlistsFragment != null)
            playlistsFragment.searchQuery(query);

    } else if (action.equals(Intent.ACTION_SEND)) {
        final String url = intent.getStringExtra(Intent.EXTRA_TEXT);
        Log.d(TAG, "Intent received: " + url);

        final String id = Utils.extractId(url);
        if (id == null)
            return;

        if (url.contains("playlist")) {
            viewPager.setCurrentItem(Pane.PLAYLIST.ordinal(), true);
            playlistsFragment.searchId(id);

        } else if (searchFragment != null) {
            viewPager.setCurrentItem(Pane.SEARCH.ordinal(), true);
            searchFragment.searchId(id);
        }
    }
}

From source file:org.mixare.MixListView.java

private void handleIntent(Intent intent) {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        String query = intent.getStringExtra(SearchManager.QUERY);
        getRouteSuggestions(query);/*from  w w w  . j a va 2 s  .  c o m*/
    }
}

From source file:ch.citux.td.ui.TDActivity.java

@Override
protected void onNewIntent(Intent intent) {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        String query = intent.getStringExtra(SearchManager.QUERY);

        if (searchFragment == null) {
            searchFragment = new SearchFragment();
        }/*from  ww w . j av  a2  s.  c  o  m*/
        searchFragment.setQuery(query);
        searchFragment.loadData();

        replaceFragment(searchFragment);
        Log.d(this, query);
    }
}

From source file:com.veniosg.dir.android.fragment.SearchListFragment.java

private void handleIntent() {
    Intent intent = getActivity().getIntent();
    if (Intent.ACTION_SEARCH.equals(intent.getAction()) && intent.getData() != null) {
        // Get the current path
        String path = intent.getData().getPath();
        File root = new File(path);

        // Init search
        viewModel.init(root);/*from   w ww. j a va 2  s.c o  m*/
        viewModel.getLiveResults().observe(this, resultObserver);

        hintText = getResources().getString(R.string.search_hint, root.getName());
    } else {
        getActivity().finish();
    }
}

From source file:com.andrada.sitracker.ui.fragment.RemoteAuthorsFragment.java

public void requestQueryUpdate(String query, int searchType) {
    //Test query for URL
    if (query.matches(Constants.SIMPLE_URL_REGEX) && query.startsWith(Constants.HTTP_PROTOCOL)) {
        //This looks like an url
        loading.setVisibility(View.VISIBLE);
        new AddAuthorTask(getActivity()).execute(query);
    } else {/*from  w  ww.j a  va  2  s . c o m*/
        reloadFromArguments(BaseActivity.intentToFragmentArguments(
                new Intent(Intent.ACTION_SEARCH, AppUriContract.buildSamlibSearchUri(query, searchType))));
    }
}

From source file:net.eledge.android.europeana.gui.activity.HomeActivity.java

private void performSearch(String query) {
    final Intent intent = new Intent(this, SearchActivity.class);
    intent.setAction(Intent.ACTION_SEARCH);
    intent.putExtra(SearchManager.QUERY, query);
    SearchProfile selected = (SearchProfile) mSpinnerProfiles.getSelectedItem();
    if ((selected != null) && (selected.facets != null)) {
        intent.putExtra(SearchManager.USER_QUERY, selected.facets);
    }//from   www. ja va 2s. com
    this.startActivity(intent);
}