List of usage examples for android.provider MediaStore UNKNOWN_STRING
String UNKNOWN_STRING
To view the source code for android.provider MediaStore UNKNOWN_STRING.
Click Source Link
From source file:org.yammp.app.AlbumFragment.java
private void doSearch() { CharSequence title = null;// w w w .ja v a 2 s . c om String query = null; Intent i = new Intent(); i.setAction(MediaStore.INTENT_ACTION_MEDIA_SEARCH); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); title = mCurrentAlbumName; if (MediaStore.UNKNOWN_STRING.equals(mCurrentArtistNameForAlbum)) { query = mCurrentAlbumName; } else { query = mCurrentArtistNameForAlbum + " " + mCurrentAlbumName; 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:org.yammp.fragment.ArtistFragment.java
@Override public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo info) { ExpandableListContextMenuInfo mi = (ExpandableListContextMenuInfo) info; int itemtype = ExpandableListView.getPackedPositionType(mi.packedPosition); mSelectedGroupPosition = ExpandableListView.getPackedPositionGroup(mi.packedPosition); int gpos = mSelectedGroupPosition; if (itemtype == ExpandableListView.PACKED_POSITION_TYPE_GROUP) { mGroupSelected = true;/*from w w w .ja va2s.co m*/ mChildSelected = false; mGroupCursor.moveToPosition(gpos); menu.add(hashCode(), PLAY_SELECTION, 0, R.string.play_selection); menu.add(hashCode(), DELETE_ITEMS, 0, R.string.delete_music); menu.add(hashCode(), DELETE_LYRICS, 0, R.string.delete_lyrics); if (gpos == -1) { // this shouldn't happen Log.d("Artist/Album", "no group"); return; } mCurrentGroupArtistName = mGroupCursor.getString(mGroupArtistIdx); mSelectedGroupId = mGroupCursor.getLong(mGroupArtistIdIdx); if (mCurrentGroupArtistName != null && !MediaStore.UNKNOWN_STRING.equals(mCurrentGroupArtistName)) { menu.setHeaderTitle(mCurrentGroupArtistName); menu.add(hashCode(), SEARCH, 0, android.R.string.search_go); } else { menu.setHeaderTitle(getString(R.string.unknown_artist)); } } }
From source file:org.musicmod.android.app.MusicBrowserActivity.java
private void updateNowplaying() { if (mService == null) return;/*from w ww .j av a 2s . c om*/ try { if (mService.getAudioId() > -1 || mService.getPath() != null) { mPlayPauseButton.setVisibility(View.VISIBLE); mNextButton.setVisibility(View.VISIBLE); mTrackName.setText(mService.getTrackName()); if (mService.getArtistName() != null && !MediaStore.UNKNOWN_STRING.equals(mService.getArtistName())) { mTrackDetail.setText(mService.getArtistName()); } else if (mService.getAlbumName() != null && !MediaStore.UNKNOWN_STRING.equals(mService.getAlbumName())) { mTrackDetail.setText(mService.getAlbumName()); } else { mTrackDetail.setText(R.string.unknown_artist); } } else { mPlayPauseButton.setVisibility(View.GONE); mNextButton.setVisibility(View.GONE); mTrackName.setText(R.string.music_library); mTrackDetail.setText(R.string.touch_to_shuffle_all); } if (mAlbumArtLoader != null) mAlbumArtLoader.cancel(true); mAlbumArtLoader = new AsyncAlbumArtLoader(); mAlbumArtLoader.execute(); } catch (RemoteException e) { e.printStackTrace(); } }
From source file:org.yammp.app.ArtistFragment.java
private void doSearch() { CharSequence title = null;//from w w w. j av a 2 s . c o m String query = null; if (mCurrentGroupArtistName == null || MediaStore.UNKNOWN_STRING.equals(mCurrentGroupArtistName)) return; Intent i = new Intent(); i.setAction(MediaStore.INTENT_ACTION_MEDIA_SEARCH); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); title = mCurrentGroupArtistName; query = mCurrentGroupArtistName; i.putExtra(MediaStore.EXTRA_MEDIA_ARTIST, mCurrentGroupArtistName); 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.music.AlbumBrowserActivity.java
private void setTitle() { CharSequence fancyName = ""; if (mAlbumCursor != null && mAlbumCursor.getCount() > 0) { mAlbumCursor.moveToFirst();/*from w w w . ja va 2 s.co m*/ fancyName = mAlbumCursor.getString(mAlbumCursor.getColumnIndex(MediaStore.Audio.Albums.ARTIST)); if (fancyName == null || fancyName.equals(MediaStore.UNKNOWN_STRING)) fancyName = getText(R.string.unknown_artist_name); } if (mArtistId != null && fancyName != null) setTitle(fancyName); else setTitle(R.string.albums_title); }
From source file:com.android.music.ArtistAlbumBrowserFragment.java
@Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { mCurrentAlbumId = Long.valueOf(id).toString(); Intent intent = new Intent(Intent.ACTION_PICK); intent.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/track"); intent.setClass(getActivity(), TrackBrowserActivity.class); intent.putExtra("album", mCurrentAlbumId); Cursor c = (Cursor) mAdapter.getChild(groupPosition, childPosition); String album = c.getString(c.getColumnIndex(MediaStore.Audio.Albums.ALBUM)); if (album == null || album.equals(MediaStore.UNKNOWN_STRING)) { // unknown album, so we should include the artist ID to limit the songs to songs only by that artist mArtistCursor.moveToPosition(groupPosition); mCurrentArtistId = mArtistCursor.getString(mArtistCursor.getColumnIndex(MediaStore.Audio.Artists._ID)); intent.putExtra("artist", mCurrentArtistId); }/*from ww w .ja v a 2s .c om*/ startActivity(intent); return true; }
From source file:com.android.music.AlbumBrowserFragment.java
@Override public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfoIn) { menu.add(0, PLAY_SELECTION, 0, R.string.play_selection); SubMenu sub = menu.addSubMenu(0, ADD_TO_PLAYLIST, 0, R.string.add_to_playlist); MusicUtils.makePlaylistMenu(getActivity(), sub); menu.add(0, DELETE_ITEM, 0, R.string.delete_item); AdapterContextMenuInfo mi = (AdapterContextMenuInfo) menuInfoIn; mAlbumCursor.moveToPosition(mi.position); mCurrentAlbumId = mAlbumCursor.getString(mAlbumCursor.getColumnIndexOrThrow(MediaStore.Audio.Albums._ID)); mCurrentAlbumName = mAlbumCursor/*from w ww .j a va 2 s . c om*/ .getString(mAlbumCursor.getColumnIndexOrThrow(MediaStore.Audio.Albums.ALBUM)); mCurrentArtistNameForAlbum = mAlbumCursor .getString(mAlbumCursor.getColumnIndexOrThrow(MediaStore.Audio.Albums.ARTIST)); mIsUnknownArtist = mCurrentArtistNameForAlbum == null || mCurrentArtistNameForAlbum.equals(MediaStore.UNKNOWN_STRING); mIsUnknownAlbum = mCurrentAlbumName == null || mCurrentAlbumName.equals(MediaStore.UNKNOWN_STRING); if (mIsUnknownAlbum) { menu.setHeaderTitle(getString(R.string.unknown_album_name)); } else { menu.setHeaderTitle(mCurrentAlbumName); } if (!mIsUnknownAlbum || !mIsUnknownArtist) { menu.add(0, SEARCH, 0, R.string.search_title); } }
From source file:com.android.music.AlbumBrowserActivity.java
@Override public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfoIn) { menu.add(0, PLAY_SELECTION, 0, R.string.play_selection); SubMenu sub = menu.addSubMenu(0, ADD_TO_PLAYLIST, 0, R.string.add_to_playlist); MusicUtils.makePlaylistMenu(this, sub); menu.add(0, DELETE_ITEM, 0, R.string.delete_item); AdapterContextMenuInfo mi = (AdapterContextMenuInfo) menuInfoIn; mAlbumCursor.moveToPosition(mi.position); mCurrentAlbumId = mAlbumCursor.getString(mAlbumCursor.getColumnIndexOrThrow(MediaStore.Audio.Albums._ID)); mCurrentAlbumName = mAlbumCursor// ww w . ja v a 2 s .c o m .getString(mAlbumCursor.getColumnIndexOrThrow(MediaStore.Audio.Albums.ALBUM)); mCurrentArtistNameForAlbum = mAlbumCursor .getString(mAlbumCursor.getColumnIndexOrThrow(MediaStore.Audio.Albums.ARTIST)); mIsUnknownArtist = mCurrentArtistNameForAlbum == null || mCurrentArtistNameForAlbum.equals(MediaStore.UNKNOWN_STRING); mIsUnknownAlbum = mCurrentAlbumName == null || mCurrentAlbumName.equals(MediaStore.UNKNOWN_STRING); if (mIsUnknownAlbum) { menu.setHeaderTitle(getString(R.string.unknown_album_name)); } else { menu.setHeaderTitle(mCurrentAlbumName); } if (!mIsUnknownAlbum || !mIsUnknownArtist) { menu.add(0, SEARCH, 0, R.string.search_title); } }
From source file:org.yammp.fragment.ArtistFragment.java
private void doSearch(String artist, String album) { CharSequence title = null;//from w ww . j a va2s. com String query = null; boolean isUnknownArtist = artist == null || MediaStore.UNKNOWN_STRING.equals(artist); boolean isUnknownAlbum = album == null || MediaStore.UNKNOWN_STRING.equals(album); if (isUnknownArtist && isUnknownAlbum) return; Intent i = new Intent(); i.setAction(MediaStore.INTENT_ACTION_MEDIA_SEARCH); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); title = album != null ? album : artist; query = album != null ? album : artist; if (!isUnknownArtist) { i.putExtra(MediaStore.EXTRA_MEDIA_ARTIST, artist); } if (!isUnknownAlbum) { i.putExtra(MediaStore.EXTRA_MEDIA_ALBUM, album); } 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;/*ww w .j a v a2 s . 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; }