List of usage examples for android.provider MediaStore INTENT_ACTION_MEDIA_SEARCH
String INTENT_ACTION_MEDIA_SEARCH
To view the source code for android.provider MediaStore INTENT_ACTION_MEDIA_SEARCH.
Click Source Link
From source file:org.musicmod.android.app.MusicPlaybackActivity.java
@Override public boolean onLongClick(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;// w w w. j ava 2s. co 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: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 ww .j ava 2s. c om*/ 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:com.android.music.AlbumBrowserActivity.java
void doSearch() { CharSequence title = null;//from w w w . java 2 s .c o m 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.yammp.app.TrackFragment.java
private void doSearch() { CharSequence title = null;/*from www. j av a 2 s . co m*/ String query = null; Intent i = new Intent(); i.setAction(MediaStore.INTENT_ACTION_MEDIA_SEARCH); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); title = mCurrentTrackName; if (MediaStore.UNKNOWN_STRING.equals(mCurrentArtistNameForAlbum)) { query = mCurrentTrackName; } else { query = mCurrentArtistNameForAlbum + " " + mCurrentTrackName; i.putExtra(MediaStore.EXTRA_MEDIA_ARTIST, mCurrentArtistNameForAlbum); } if (MediaStore.UNKNOWN_STRING.equals(mCurrentAlbumName)) { i.putExtra(MediaStore.EXTRA_MEDIA_ALBUM, mCurrentAlbumName); } i.putExtra(MediaStore.EXTRA_MEDIA_FOCUS, "audio/*"); title = getString(R.string.mediasearch, title); i.putExtra(SearchManager.QUERY, query); startActivity(Intent.createChooser(i, title)); }
From source file:com.android.app.MediaPlaybackActivity.java
public boolean onLongClick(View view) { CharSequence title = null;//w w w. java2s . c o m String mime = null; String query = null; String artist; String album; String song; long audioid; try { artist = mService.getArtistName(); album = mService.getAlbumName(); song = mService.getTrackName(); audioid = mService.getAudioId(); } catch (RemoteException ex) { return true; } catch (NullPointerException ex) { // we might not actually have the service yet return true; } if (MediaStore.UNKNOWN_STRING.equals(album) && MediaStore.UNKNOWN_STRING.equals(artist) && song != null && song.startsWith("recording")) { // not music return false; } if (audioid < 0) { return false; } Cursor c = MusicUtils.query(this, ContentUris.withAppendedId(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, audioid), new String[] { MediaStore.Audio.Media.IS_MUSIC }, null, null, null); boolean ismusic = true; if (c != null) { if (c.moveToFirst()) { ismusic = c.getInt(0) != 0; } c.close(); } if (!ismusic) { return false; } boolean knownartist = (artist != null) && !MediaStore.UNKNOWN_STRING.equals(artist); boolean knownalbum = (album != null) && !MediaStore.UNKNOWN_STRING.equals(album); if (knownartist && view.equals(mArtistName.getParent())) { title = artist; query = artist; mime = MediaStore.Audio.Artists.ENTRY_CONTENT_TYPE; } else if (knownalbum && view.equals(mAlbumName.getParent())) { title = album; if (knownartist) { query = artist + " " + album; } else { query = album; } mime = MediaStore.Audio.Albums.ENTRY_CONTENT_TYPE; } else if (view.equals(mTrackName.getParent()) || !knownartist || !knownalbum) { if ((song == null) || MediaStore.UNKNOWN_STRING.equals(song)) { // A popup of the form "Search for null/'' using ..." is pretty // unhelpful, plus, we won't find any way to buy it anyway. return true; } title = song; if (knownartist) { query = artist + " " + song; } else { query = song; } mime = "audio/*"; // the specific type doesn't matter, so don't bother retrieving it } else { throw new RuntimeException("shouldn't be here"); } title = getString(R.string.mediasearch, title); Intent i = new Intent(); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.setAction(MediaStore.INTENT_ACTION_MEDIA_SEARCH); i.putExtra(SearchManager.QUERY, query); if (knownartist) { i.putExtra(MediaStore.EXTRA_MEDIA_ARTIST, artist); } if (knownalbum) { i.putExtra(MediaStore.EXTRA_MEDIA_ALBUM, album); } i.putExtra(MediaStore.EXTRA_MEDIA_TITLE, song); i.putExtra(MediaStore.EXTRA_MEDIA_FOCUS, mime); startActivity(Intent.createChooser(i, title)); return true; }
From source file:com.android.music.TrackBrowserFragment.java
void doSearch() { CharSequence title = null;//from w w w .j a va 2 s. c o m String query = null; Intent i = new Intent(); i.setAction(MediaStore.INTENT_ACTION_MEDIA_SEARCH); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); title = mCurrentTrackName; if (MediaStore.UNKNOWN_STRING.equals(mCurrentArtistNameForAlbum)) { query = mCurrentTrackName; } else { query = mCurrentArtistNameForAlbum + " " + mCurrentTrackName; i.putExtra(MediaStore.EXTRA_MEDIA_ARTIST, mCurrentArtistNameForAlbum); } if (MediaStore.UNKNOWN_STRING.equals(mCurrentAlbumName)) { i.putExtra(MediaStore.EXTRA_MEDIA_ALBUM, mCurrentAlbumName); } i.putExtra(MediaStore.EXTRA_MEDIA_FOCUS, "audio/*"); title = getString(R.string.mediasearch, title); i.putExtra(SearchManager.QUERY, query); startActivity(Intent.createChooser(i, title)); }