List of usage examples for android.provider MediaStore EXTRA_MEDIA_ALBUM
String EXTRA_MEDIA_ALBUM
To view the source code for android.provider MediaStore EXTRA_MEDIA_ALBUM.
Click Source Link
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 . j a va 2 s . 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:org.yammp.app.TrackFragment.java
private void doSearch() { CharSequence title = null;//from w w w . j a va 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:github.popeen.dsub.activity.SubsonicFragmentActivity.java
@Override public void onNewIntent(Intent intent) { super.onNewIntent(intent); if (currentFragment != null && intent.getStringExtra(Constants.INTENT_EXTRA_NAME_QUERY) != null) { if (slideUpPanel.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) { closeNowPlaying();// ww w . j av a 2s . c om } if (currentFragment instanceof SearchFragment) { String query = intent.getStringExtra(Constants.INTENT_EXTRA_NAME_QUERY); boolean autoplay = intent.getBooleanExtra(Constants.INTENT_EXTRA_NAME_AUTOPLAY, false); String artist = intent.getStringExtra(MediaStore.EXTRA_MEDIA_ARTIST); String album = intent.getStringExtra(MediaStore.EXTRA_MEDIA_ALBUM); String title = intent.getStringExtra(MediaStore.EXTRA_MEDIA_TITLE); if (query != null) { ((SearchFragment) currentFragment).search(query, autoplay, artist, album, title); } getIntent().removeExtra(Constants.INTENT_EXTRA_NAME_QUERY); } else { setIntent(intent); SearchFragment fragment = new SearchFragment(); replaceFragment(fragment, fragment.getSupportTag()); } } else if (intent.getBooleanExtra(Constants.INTENT_EXTRA_NAME_DOWNLOAD, false)) { if (slideUpPanel.getPanelState() != SlidingUpPanelLayout.PanelState.EXPANDED) { openNowPlaying(); } } else { if (slideUpPanel.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) { closeNowPlaying(); } setIntent(intent); } if (drawer != null) { drawer.closeDrawers(); } }
From source file:com.android.app.MediaPlaybackActivity.java
public boolean onLongClick(View view) { CharSequence title = null;//www . ja v a2 s . c om 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. ja v a 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)); }