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:com.cuddlesoft.nori.fragment.TagListDialogFragment.java

@Override
public void onItemClick(AdapterView<?> adapterView, View clickedView, int position, long itemId) {
    // Start SearchActivity with search for the given tag.
    final Intent intent = new Intent(getActivity(), SearchActivity.class);
    intent.setAction(Intent.ACTION_SEARCH);
    intent.putExtra(SearchActivity.INTENT_EXTRA_SEARCH_CLIENT_SETTINGS, settings);
    intent.putExtra(SearchActivity.INTENT_EXTRA_SEARCH_QUERY, image.tags[position].getName());
    startActivity(intent);/*from   w  w  w  .j av  a2s . co  m*/

    // Dismiss the dialog after the activity is started.
    dismiss();
}

From source file:com.cerema.cloud2.ui.activity.ShareActivity.java

@Override
protected void onNewIntent(Intent intent) {
    // Verify the action and get the query
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        String query = intent.getStringExtra(SearchManager.QUERY);
        Log_OC.w(TAG, "Ignored Intent requesting to query for " + query);

    } else if (UsersAndGroupsSearchProvider.ACTION_SHARE_WITH.equals(intent.getAction())) {
        Uri data = intent.getData();//from  w  ww .  j  av a2s  .c  o  m
        String dataString = intent.getDataString();
        String shareWith = dataString.substring(dataString.lastIndexOf('/') + 1);
        doShareWith(shareWith, data.getAuthority());

    } else {
        Log_OC.wtf(TAG, "Unexpected intent " + intent.toString());
    }
}

From source file:com.radar.niyo.contacts.ContactsListActivity.java

private void showContacts() {
    Log.d(LOG_TAG, "showContacts started");
    // Check if two pane bool is set based on resource directories
    isTwoPaneLayout = getResources().getBoolean(R.bool.has_two_panes);

    // Check if this activity instance has been triggered as a result of a search query. This
    // will only happen on pre-HC OS versions as from HC onward search is carried out using
    // an ActionBar SearchView which carries out the search in-line without loading a new
    // Activity.//from  w ww.  j a  v  a  2 s.co  m
    if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) {

        // Fetch query from intent and notify the fragment that it should display search
        // results instead of all contacts.
        String searchQuery = getIntent().getStringExtra(SearchManager.QUERY);
        ContactsListFragment mContactsListFragment = (ContactsListFragment) getSupportFragmentManager()
                .findFragmentById(R.id.contact_list);

        // This flag notes that the Activity is doing a search, and so the result will be
        // search results rather than all contacts. This prevents the Activity and Fragment
        // from trying to a search on search results.
        isSearchResultView = true;
        mContactsListFragment.setSearchQuery(searchQuery);

        // Set special title for search results
        String title = getString(R.string.contacts_list_search_results_title, searchQuery);
        setTitle(title);
    }

    if (isTwoPaneLayout) {
        // If two pane layout, locate the contact detail fragment
        mContactDetailFragment = (ContactDetailFragment) getSupportFragmentManager()
                .findFragmentById(R.id.contact_detail);
    }
}

From source file:com.rowland.movies.ui.activities.SearchActivity.java

private String getSearchQuery() {
    // The search query
    String searchQuery = "";
    // Filter the relevant Intent
    if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) {
        // Acquire the search query
        searchQuery = getIntent().getStringExtra(SearchManager.QUERY);
    }//from   w w  w . j ava  2 s  .com
    // Return the search string
    return searchQuery;
}

From source file:io.github.tjg1.nori.fragment.TagListDialogFragment.java

@Override
public void onClick(DialogInterface dialog, int position) {
    // Start SearchActivity with search for the given tag.
    final Intent intent = new Intent(getContext(), SearchActivity.class);
    intent.setAction(Intent.ACTION_SEARCH);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.putExtra(SearchActivity.INTENT_EXTRA_SEARCH_CLIENT_SETTINGS, settings);
    intent.putExtra(SearchActivity.INTENT_EXTRA_SEARCH_QUERY, image.tags[position].getName());
    startActivity(intent);//from  w w w . ja v a2s  . c  o m

    // Dismiss the dialog after the activity is started.
    dialog.dismiss();
}

From source file:com.kyakujin.android.tagnotepad.ui.NoteActivity.java

/**
 * ?//from  w w  w.ja v  a  2 s.c o  m
 *
 * @param intent the intent
 */
private void handleIntent(Intent intent) {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        String query = intent.getStringExtra(SearchManager.QUERY);
        String tagname = null;
        final Bundle bundle = intent.getBundleExtra(SearchManager.APP_DATA);
        if (bundle != null) {
            // ????????????????
            // ??"Tag_A"????????????
            // ???????
            // "Tag_A"?where????
            tagname = bundle.getString(Config.SELECTED_TAGNAME);
        }

        doSearch(query, tagname);
    }
}

From source file:au.com.cybersearch2.classyfy.TitleSearchResultsActivity.java

/**
 * Parse intent - ACTION_SEARCH or ACTION_VIEW
 * @param intent Intent object//  w  ww  . j a v  a2  s. com
 */
protected void parseIntent(Intent intent) {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        String searchQuery = intent.getStringExtra(SearchManager.QUERY);
        if (searchQuery != null)
            launchSearch(searchQuery, ticketManager.addIntent(intent));
    }
    if (Intent.ACTION_VIEW.equals(intent.getAction()) && (intent.getData() != null))
        viewUri(intent.getData(), ticketManager.addIntent(intent));

}

From source file:com.synox.android.ui.activity.ShareActivity.java

@Override
protected void onNewIntent(Intent intent) {
    // Verify the action and get the query
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        String query = intent.getStringExtra(SearchManager.QUERY);
        Log_OC.w(TAG, "Ignored Intent requesting to query for " + query);

    } else if (UsersAndGroupsSearchProvider.ACTION_SHARE_WITH.equals(intent.getAction())) {
        Uri data = intent.getData();//from   w  ww.  jav a  2 s  .c o m
        String dataString = intent.getDataString();
        String shareWith = dataString.substring(dataString.lastIndexOf('/') + 1);
        doShareWith(shareWith, UsersAndGroupsSearchProvider.DATA_GROUP.equals(data.getAuthority()));

    } else {
        Log_OC.wtf(TAG, "Unexpected intent " + intent.toString());
    }
}

From source file:com.miz.mizuu.ShowDetails.java

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

    if (!MizLib.isPortrait(this))
        if (isFullscreen())
            setTheme(R.style.Theme_Example_Transparent_NoBackGround_FullScreen);
        else//from  w w  w  .j  av a  2s.c o m
            setTheme(R.style.Theme_Example_Transparent_NoBackGround);
    else if (isFullscreen())
        setTheme(R.style.Theme_Example_Transparent_FullScreen);
    else
        setTheme(R.style.Theme_Example_Transparent);

    getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);

    setContentView(R.layout.viewpager);

    actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    if (spinnerAdapter == null)
        spinnerAdapter = new ActionBarSpinner(this, spinnerItems);

    setTitle(null);

    awesomePager = (ViewPager) findViewById(R.id.awesomepager);
    awesomePager.setOffscreenPageLimit(3); // Required in order to retain all fragments when swiping between them
    awesomePager.setAdapter(new ShowDetailsAdapter(getSupportFragmentManager()));
    awesomePager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            actionBar.setSelectedNavigationItem(position);
            invalidateOptionsMenu();
        }
    });

    ignorePrefixes = PreferenceManager.getDefaultSharedPreferences(this)
            .getBoolean("prefsIgnorePrefixesInTitles", false);

    // Create and open database
    dbHelper = MizuuApplication.getTvDbAdapter();

    String showId = "";
    // Fetch the database ID of the TV show to view
    if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) {
        showId = getIntent().getStringExtra(SearchManager.EXTRA_DATA_KEY);
    } else {
        showId = getIntent().getStringExtra("showId");
    }

    Cursor cursor = dbHelper.getShow(showId);
    try {
        while (cursor.moveToNext()) {
            thisShow = new TvShow(this, cursor.getString(cursor.getColumnIndex(DbAdapterTvShow.KEY_SHOW_ID)),
                    cursor.getString(cursor.getColumnIndex(DbAdapterTvShow.KEY_SHOW_TITLE)),
                    cursor.getString(cursor.getColumnIndex(DbAdapterTvShow.KEY_SHOW_PLOT)),
                    cursor.getString(cursor.getColumnIndex(DbAdapterTvShow.KEY_SHOW_RATING)),
                    cursor.getString(cursor.getColumnIndex(DbAdapterTvShow.KEY_SHOW_GENRES)),
                    cursor.getString(cursor.getColumnIndex(DbAdapterTvShow.KEY_SHOW_ACTORS)),
                    cursor.getString(cursor.getColumnIndex(DbAdapterTvShow.KEY_SHOW_CERTIFICATION)),
                    cursor.getString(cursor.getColumnIndex(DbAdapterTvShow.KEY_SHOW_FIRST_AIRDATE)),
                    cursor.getString(cursor.getColumnIndex(DbAdapterTvShow.KEY_SHOW_RUNTIME)), ignorePrefixes,
                    cursor.getString(cursor.getColumnIndex(DbAdapterTvShow.KEY_SHOW_EXTRA1)));
        }
    } catch (Exception e) {
        finish();
        return;
    } finally {
        cursor.close();
    }

    if (thisShow == null) {
        finish(); // Finish the activity if the movie doesn't load
        return;
    }

    setupSpinnerItems();

    if (savedInstanceState != null) {
        awesomePager.setCurrentItem(savedInstanceState.getInt("tab", 0));
    }

    // Set the current page item to 1 (episode page) if the TV show start page setting has been changed from TV show details
    if (!PreferenceManager.getDefaultSharedPreferences(this)
            .getString("prefsTvShowsStartPage", getString(R.string.showDetails))
            .equals(getString(R.string.showDetails)))
        awesomePager.setCurrentItem(1);
}

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