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.akop.bach.fragment.xboxlive.AchievementsFragment.java

@Override
public boolean onContextItemSelected(MenuItem menuItem) {
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuItem.getMenuInfo();

    if (mGameTitle != null && info.targetView.getTag() instanceof ViewHolder) {
        ViewHolder vh = (ViewHolder) info.targetView.getTag();

        switch (menuItem.getItemId()) {
        case R.id.google_achievement:
            Intent searchIntent = new Intent(Intent.ACTION_WEB_SEARCH);
            searchIntent.putExtra(SearchManager.QUERY,
                    getString(R.string.google_achievement_f, mGameTitle, vh.title.getText()));
            startActivity(searchIntent);
            return true;
        }/*w  ww  . j  a v a2s.  co m*/
    }

    return super.onContextItemSelected(menuItem);
}

From source file:com.android.music.AlbumBrowserActivity.java

void doSearch() {
    CharSequence title = null;/*from  ww w .  java2s  .  c om*/
    String query = "";

    Intent i = new Intent();
    i.setAction(MediaStore.INTENT_ACTION_MEDIA_SEARCH);
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

    title = "";
    if (!mIsUnknownAlbum) {
        query = mCurrentAlbumName;
        i.putExtra(MediaStore.EXTRA_MEDIA_ALBUM, mCurrentAlbumName);
        title = mCurrentAlbumName;
    }
    if (!mIsUnknownArtist) {
        query = query + " " + mCurrentArtistNameForAlbum;
        i.putExtra(MediaStore.EXTRA_MEDIA_ARTIST, mCurrentArtistNameForAlbum);
        title = title + " " + mCurrentArtistNameForAlbum;
    }
    // Since we hide the 'search' menu item when both album and artist are
    // unknown, the query and title strings will have at least one of those.
    i.putExtra(MediaStore.EXTRA_MEDIA_FOCUS, MediaStore.Audio.Albums.ENTRY_CONTENT_TYPE);
    title = getString(R.string.mediasearch, title);
    i.putExtra(SearchManager.QUERY, query);

    startActivity(Intent.createChooser(i, title));
}

From source file:org.mariotaku.harmony.activity.MusicPlaybackActivity.java

public boolean onLongClick(final View v) {

    // TODO search media info

    String track = getTitle().toString();
    String artist = "";// mArtistNameView.getText().toString();
    String album = "";// mAlbumNameView.getText().toString();

    CharSequence title = getString(R.string.mediasearch, track);
    Intent i = new Intent();
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    i.setAction(MediaStore.INTENT_ACTION_MEDIA_SEARCH);
    i.putExtra(MediaStore.EXTRA_MEDIA_TITLE, track);

    String query = track;//from w w  w .ja va2 s  .c  o m
    if (!getString(R.string.unknown_artist).equals(artist)
            && !getString(R.string.unknown_album).equals(album)) {
        query = artist + " " + track;
        i.putExtra(MediaStore.EXTRA_MEDIA_ALBUM, album);
        i.putExtra(MediaStore.EXTRA_MEDIA_ARTIST, artist);
    } else if (getString(R.string.unknown_artist).equals(artist)
            && !getString(R.string.unknown_album).equals(album)) {
        query = album + " " + track;
        i.putExtra(MediaStore.EXTRA_MEDIA_ALBUM, album);
    } else if (!getString(R.string.unknown_artist).equals(artist)
            && getString(R.string.unknown_album).equals(album)) {
        query = artist + " " + track;
        i.putExtra(MediaStore.EXTRA_MEDIA_ARTIST, artist);
    }
    i.putExtra(SearchManager.QUERY, query);
    i.putExtra(MediaStore.EXTRA_MEDIA_FOCUS, "audio/*");
    startActivity(Intent.createChooser(i, title));
    return true;
}

From source file:info.guardianproject.otr.app.im.app.ContactListActivity.java

@Override
protected void onNewIntent(Intent intent) {

    // The user has probably entered a URL into "Go"

    String action = intent.getAction();
    if (Intent.ACTION_SEARCH.equals(action)) {

        if (mIsFiltering) {
            String filterText = intent.getStringExtra(SearchManager.QUERY);

            mFilterView.doFilter(filterText);
        }//from  ww w  . jav  a 2  s .  co  m
    }
}

From source file:com.klinker.android.twitter.activities.search.SearchPager.java

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    overridePendingTransition(0, 0);//from  w w  w.  java  2s  .com
    finish();
    Intent restart = new Intent(context, SearchPager.class);
    restart.putExtra(SearchManager.QUERY, searchQuery);
    restart.setAction(Intent.ACTION_SEARCH);
    restart.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    overridePendingTransition(0, 0);
    startActivity(restart);
}

From source file:com.untappedkegg.rally.home.ActivityMain.java

@Override
public void showEventDetail(String fragment, String eventName, int id) {
    //        CommonIntents.startNewContainer(this, fragment, args, EventActivity.class, eventName);
    //        Log.e("SELECT showEventDetail", "args = " + args + " id = " + id);
    Intent intent = new Intent(AppState.getApplication(), EventActivity.class);
    intent.putExtra(AppState.KEY_URI, fragment);
    intent.putExtra(SearchManager.QUERY, eventName);
    intent.putExtra(AppState.KEY_ID, id);

    startActivity(intent);/*  w  w  w .  j a va2  s . c  om*/

}

From source file:com.geecko.QuickLyric.MainActivity.java

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    String action = intent.getAction();
    String extra = intent.getStringExtra(Intent.EXTRA_TEXT);
    if (action != null) {
        switch (action) {
        case NfcAdapter.ACTION_NDEF_DISCOVERED:
            Lyrics receivedLyrics = getBeamedLyrics(intent);
            if (receivedLyrics != null)
                updateLyricsFragment(0, 0, false, receivedLyrics);
            break;
        case "android.intent.action.SEARCH":
            search(intent.getStringExtra(SearchManager.QUERY));
            break;
        case "android.intent.action.SEND":
            LyricsViewFragment lyricsViewFragment = (LyricsViewFragment) getFragmentManager()
                    .findFragmentByTag(LYRICS_FRAGMENT_TAG);
            new IdDecoder(this, lyricsViewFragment).execute(getIdUrl(extra));
            selectItem(0);/*from ww w .  ja  va  2 s .  com*/
            break;
        case "android.intent.action.VIEW":
            if (intent.getDataString().contains("spotify"))
                Spotify.onCallback(intent, this);
            break;
        case "com.geecko.QuickLyric.getLyrics":
            String[] metadata = intent.getStringArrayExtra("TAGS");
            if (metadata != null) {
                String artist = metadata[0];
                String track = metadata[1];
                LyricsViewFragment lyricsFragment = (LyricsViewFragment) getFragmentManager()
                        .findFragmentByTag(LYRICS_FRAGMENT_TAG);
                lyricsFragment.fetchLyrics(artist, track);
                selectItem(0);
            }
            break;
        case "com.geecko.QuickLyric.updateDBList":
            updateDBList();
            break;
        }
    }
}

From source file:org.peterbaldwin.vlcremote.app.PlaybackActivity.java

@Override
protected void onNewIntent(Intent intent) {
    String host = intent.getStringExtra(Intents.EXTRA_REMOTE_HOST);
    if (host != null) {
        int port = intent.getIntExtra(Intents.EXTRA_REMOTE_PORT, 8080);
        String authority = host + ":" + port;
        changeServer(authority);//from ww  w .ja va 2s .  c om
    }

    String action = intent.getAction();
    if (Intent.ACTION_VIEW.equals(action) || Intents.ACTION_REMOTE_VIEW.equals(action)
            || Intents.ACTION_VIEW.equals(action)) {
        Uri data = intent.getData();
        if (data != null) {
            changeInput(data.toString());
        }
    } else if (Intent.ACTION_SEARCH.equals(action)) {
        String input = intent.getStringExtra(SearchManager.QUERY);
        changeInput(input);
    }
}

From source file:aarddict.android.ArticleViewActivity.java

@Override
public boolean onSearchRequested() {
    Intent intent = getIntent();//from  w  ww .  ja va  2  s. co m
    String action = intent == null ? null : intent.getAction();
    if (action != null) {
        String word = null;
        if (action.equals(Intent.ACTION_SEARCH)) {
            word = intent.getStringExtra("query");
        } else if (action.equals(Intent.ACTION_SEND)) {
            word = intent.getStringExtra(Intent.EXTRA_TEXT);
        }
        if (word != null) {
            Intent next = new Intent();
            next.setClass(this, LookupActivity.class);
            next.setAction(Intent.ACTION_SEARCH);
            next.putExtra(SearchManager.QUERY, word);
            startActivity(next);
        }
    }
    finish();
    return true;
}

From source file:com.untappedkegg.rally.home.ActivityMain.java

public void showEventDetail(String fragment, String link, String eventName, int id) {
    //        CommonIntents.startNewContainer(this, fragment, args, EventActivity.class, eventName);
    Intent intent = new Intent(AppState.getApplication(), EventActivity.class);
    intent.putExtra(AppState.KEY_ARGS, link);
    intent.putExtra(AppState.KEY_URI, fragment);
    intent.putExtra(SearchManager.QUERY, eventName);
    intent.putExtra(AppState.KEY_ID, id);

    startActivity(intent);/*from  w  w  w .j  ava 2s  .  com*/

}