本文整理汇总了Java中android.provider.MediaStore.Audio.AudioColumns.ARTIST属性的典型用法代码示例。如果您正苦于以下问题:Java AudioColumns.ARTIST属性的具体用法?Java AudioColumns.ARTIST怎么用?Java AudioColumns.ARTIST使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.provider.MediaStore.Audio.AudioColumns
的用法示例。
在下文中一共展示了AudioColumns.ARTIST属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateLoader
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
String[] projection = new String[] {
BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM, AudioColumns.ARTIST,
};
StringBuilder selection = new StringBuilder();
Uri uri = Audio.Media.EXTERNAL_CONTENT_URI;
String sortOrder = Audio.Media.DEFAULT_SORT_ORDER;
uri = Audio.Media.EXTERNAL_CONTENT_URI;
long[] mNowPlaying = MusicUtils.getQueue();
if (mNowPlaying.length == 0)
return null;
selection = new StringBuilder();
selection.append(BaseColumns._ID + " IN (");
if (mNowPlaying == null || mNowPlaying.length <= 0)
return null;
for (long queue_id : mNowPlaying) {
selection.append(queue_id + ",");
}
selection.deleteCharAt(selection.length() - 1);
selection.append(")");
return new AddIdCursorLoader(getActivity(), uri, projection, selection.toString(), null,
sortOrder);
}
示例2: reloadQueueCursor
/**
* Reload the queue after we remove a track
*/
private void reloadQueueCursor() {
String[] projection = new String[] {
BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM, AudioColumns.ARTIST,
};
StringBuilder selection = new StringBuilder();
Uri uri = Audio.Media.EXTERNAL_CONTENT_URI;
String sortOrder = Audio.Media.DEFAULT_SORT_ORDER;
uri = Audio.Media.EXTERNAL_CONTENT_URI;
long[] mNowPlaying = MusicUtils.getQueue();
if (mNowPlaying.length == 0)
return;
selection = new StringBuilder();
selection.append(BaseColumns._ID + " IN (");
if (mNowPlaying == null || mNowPlaying.length <= 0)
return;
for (long queue_id : mNowPlaying) {
selection.append(queue_id + ",");
}
selection.deleteCharAt(selection.length() - 1);
selection.append(")");
mCursor = MusicUtils.query(getActivity(), uri, projection, selection.toString(), null,
sortOrder);
mQuickQueueAdapter.changeCursor(mCursor);
}
示例3: setupFragmentData
@Override
public void setupFragmentData() {
mAdapter = new AlbumListAdapter(getActivity(), R.layout.music_listview_items, null,
new String[] {}, new int[] {}, 0);
mProjection = new String[] {
BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM, AudioColumns.ARTIST
};
StringBuilder where = new StringBuilder();
where.append(AudioColumns.IS_MUSIC + "=1")
.append(" AND " + MediaColumns.TITLE + " != ''");
long albumId = getArguments().getLong(BaseColumns._ID);
where.append(" AND " + AudioColumns.ALBUM_ID + "=" + albumId);
mWhere = where.toString();
mSortOrder = Audio.Media.TRACK + ", " + Audio.Media.DEFAULT_SORT_ORDER;
mUri = Audio.Media.EXTERNAL_CONTENT_URI;
mFragmentGroupId = 89;
mType = TYPE_ALBUM;
mTitleColumn = MediaColumns.TITLE;
}
示例4: setupFragmentData
public void setupFragmentData(){
mAdapter = new RecentlyAddedAdapter(getActivity(), R.layout.music_listview_items,
null, new String[] {}, new int[] {}, 0);
mProjection = new String[] {
BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM, AudioColumns.ARTIST
};
StringBuilder where = new StringBuilder();
int X = MusicUtils.getIntPref(getActivity(), NUMWEEKS, 5) * 3600 * 24 * 7;
where.append(MediaColumns.TITLE + " != ''");
where.append(" AND " + AudioColumns.IS_MUSIC + "=1");
where.append(" AND " + MediaColumns.DATE_ADDED + ">"
+ (System.currentTimeMillis() / 1000 - X));
mWhere = where.toString();
mSortOrder = MediaColumns.DATE_ADDED + " DESC";
mUri = Audio.Media.EXTERNAL_CONTENT_URI;
mTitleColumn = MediaColumns.TITLE;
}
示例5: onLoadFinished
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
if (data == null) {
return;
}
long[] mNowPlaying = MusicUtils.getQueue();
String[] audioCols = new String[] { BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ARTIST, AudioColumns.ALBUM};
MatrixCursor playlistCursor = new MatrixCursor(audioCols);
for(int i = 0; i < mNowPlaying.length; i++){
data.moveToPosition(-1);
while (data.moveToNext()) {
long audioid = data.getLong(data.getColumnIndexOrThrow(BaseColumns._ID));
if( audioid == mNowPlaying[i]) {
String trackName = data.getString(data.getColumnIndexOrThrow(MediaColumns.TITLE));
String artistName = data.getString(data.getColumnIndexOrThrow(AudioColumns.ARTIST));
String albumName = data.getString(data.getColumnIndexOrThrow(AudioColumns.ALBUM));
playlistCursor.addRow(new Object[] {audioid, trackName, artistName, albumName });
}
}
}
data.close();
mCursor = playlistCursor;
super.onLoadFinished(loader, playlistCursor);
}
示例6: setupFragmentData
public void setupFragmentData(){
mAdapter = new GenreListAdapter(getActivity(), R.layout.music_listview_items, null,
new String[] {}, new int[] {}, 0);
mProjection = new String[] {
BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM,
AudioColumns.ARTIST
};
StringBuilder where = new StringBuilder();
where.append(AudioColumns.IS_MUSIC + "=1").append(
" AND " + MediaColumns.TITLE + " != ''");
mWhere = where.toString();
mSortOrder = Genres.Members.DEFAULT_SORT_ORDER;
mUri = Genres.Members.getContentUri(EXTERNAL, getArguments().getLong(BaseColumns._ID));
mFragmentGroupId = 3;
mType = TYPE_GENRE;
mTitleColumn = MediaColumns.TITLE;
}
示例7: setupFragmentData
@Override
public void setupFragmentData(){
mAdapter = new ArtistListAdapter(getActivity(), R.layout.music_listview_items, null,
new String[] {}, new int[] {}, 0);
mProjection = new String[] {
BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM, AudioColumns.ARTIST
};
StringBuilder where = new StringBuilder();
where.append(AudioColumns.IS_MUSIC + "=1")
.append(" AND " + MediaColumns.TITLE + " != ''");
long artist_id = getArguments().getLong(BaseColumns._ID);
where.append(" AND " + AudioColumns.ARTIST_ID + "=" + artist_id);
mWhere = where.toString();
mSortOrder = MediaColumns.TITLE;
mUri = Audio.Media.EXTERNAL_CONTENT_URI;
mFragmentGroupId = 88;
mType = TYPE_ARTIST;
mTitleColumn = MediaColumns.TITLE;
}
示例8: setupFragmentData
public void setupFragmentData(){
mAdapter = new RecentlyAddedAdapter(getActivity(), R.layout.listview_items,
null, new String[] {}, new int[] {}, 0);
mProjection = new String[] {
BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM, AudioColumns.ARTIST
};
StringBuilder where = new StringBuilder();
int X = MusicUtils.getIntPref(getActivity(), NUMWEEKS, 5) * 3600 * 24 * 7;
where.append(MediaColumns.TITLE + " != ''");
where.append(" AND " + AudioColumns.IS_MUSIC + "=1");
where.append(" AND " + MediaColumns.DATE_ADDED + ">"
+ (System.currentTimeMillis() / 1000 - X));
mWhere = where.toString();
mSortOrder = MediaColumns.DATE_ADDED + " DESC";
mUri = Audio.Media.EXTERNAL_CONTENT_URI;
mTitleColumn = MediaColumns.TITLE;
}
示例9: setupFragmentData
@Override
public void setupFragmentData() {
mAdapter = new AlbumListAdapter(getActivity(), R.layout.listview_items, null,
new String[] {}, new int[] {}, 0);
mProjection = new String[] {
BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM, AudioColumns.ARTIST
};
StringBuilder where = new StringBuilder();
where.append(AudioColumns.IS_MUSIC + "=1")
.append(" AND " + MediaColumns.TITLE + " != ''");
long albumId = getArguments().getLong(BaseColumns._ID);
where.append(" AND " + AudioColumns.ALBUM_ID + "=" + albumId);
mWhere = where.toString();
mSortOrder = Audio.Media.TRACK + ", " + Audio.Media.DEFAULT_SORT_ORDER;
mUri = Audio.Media.EXTERNAL_CONTENT_URI;
mFragmentGroupId = 89;
mType = TYPE_ALBUM;
mTitleColumn = MediaColumns.TITLE;
}
示例10: setupFragmentData
public void setupFragmentData(){
mAdapter = new RecentlyAddedAdapter(getActivity(), R.layout.listview_items,
null, new String[] {}, new int[] {}, 0);
//构造查询语句,父类中回调,给cursorloader使用
mProjection = new String[] {
BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM, AudioColumns.ARTIST
};
StringBuilder where = new StringBuilder();
int X = MusicUtils.getIntPref(getActivity(), NUMWEEKS, 5) * 3600 * 24 * 7;
where.append(MediaColumns.TITLE + " != ''");
where.append(" AND " + AudioColumns.IS_MUSIC + "=1");
where.append(" AND " + MediaColumns.DATE_ADDED + ">"
+ (System.currentTimeMillis() / 1000 - X));
mWhere = where.toString();
mSortOrder = MediaColumns.DATE_ADDED + " DESC";
//查询音乐的uri?
mUri = Audio.Media.EXTERNAL_CONTENT_URI;
mTitleColumn = MediaColumns.TITLE;
}
示例11: setupFragmentData
public void setupFragmentData(){
mAdapter = new GenreListAdapter(getActivity(), R.layout.listview_items, null,
new String[] {}, new int[] {}, 0);
mProjection = new String[] {
BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM,
AudioColumns.ARTIST
};
StringBuilder where = new StringBuilder();
where.append(AudioColumns.IS_MUSIC + "=1").append(
" AND " + MediaColumns.TITLE + " != ''");
mWhere = where.toString();
mSortOrder = Genres.Members.DEFAULT_SORT_ORDER;
mUri = Genres.Members.getContentUri(EXTERNAL, getArguments().getLong(BaseColumns._ID));
mFragmentGroupId = 3;
mType = TYPE_GENRE;
mTitleColumn = MediaColumns.TITLE;
}
示例12: setupFragmentData
public void setupFragmentData(){
mAdapter = new SonglistAdapter(getActivity(), R.layout.listview_items, null,
new String[] {}, new int[] {}, 0);
mProjection = new String[] {
BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM, AudioColumns.ARTIST
};
StringBuilder where = new StringBuilder();
where.append(AudioColumns.IS_MUSIC + "=1").append(" AND " + MediaColumns.TITLE + " != ''");
mWhere = where.toString();
mSortOrder = Audio.Media.DEFAULT_SORT_ORDER;
mUri = Audio.Media.EXTERNAL_CONTENT_URI;
mFragmentGroupId = 3;
mType = TYPE_SONG;
mTitleColumn = MediaColumns.TITLE;
View shuffle_temp = View.inflate(getActivity(), R.layout.shuffle_all, null);
mListView.addHeaderView(shuffle_temp);
RelativeLayout shuffle = (RelativeLayout)shuffle_temp.findViewById(R.id.shuffle_wrapper);
shuffle.setVisibility(View.VISIBLE);
shuffle.setOnClickListener(new RelativeLayout.OnClickListener() {
public void onClick(View v)
{
MusicUtils.suffle(getActivity());
}
});
}
示例13: setupFragmentData
@Override
public void setupFragmentData(){
mAdapter = new ArtistListAdapter(getActivity(), R.layout.listview_items, null,
new String[] {}, new int[] {}, 0);
mProjection = new String[] {
BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM, AudioColumns.ARTIST
};
StringBuilder where = new StringBuilder();
where.append(AudioColumns.IS_MUSIC + "=1")
.append(" AND " + MediaColumns.TITLE + " != ''");
long artist_id = getArguments().getLong(BaseColumns._ID);
where.append(" AND " + AudioColumns.ARTIST_ID + "=" + artist_id);
mWhere = where.toString();
mSortOrder = MediaColumns.TITLE;
mUri = Audio.Media.EXTERNAL_CONTENT_URI;
mFragmentGroupId = 88;
mType = TYPE_ARTIST;
mTitleColumn = MediaColumns.TITLE;
}
示例14: loadInBackground
@Override
public Cursor loadInBackground() {
Cursor mediaCursor = getContext().getContentResolver().query(mUri, mProjection, mSelection,
mSelectionArgs, mSortOrder);
//Get cursor filled with Audio Id's
String [] projection = new String[] {
BaseColumns._ID, AlbumColumns.ALBUM
};
Uri uri = Audio.Albums.EXTERNAL_CONTENT_URI;
String sortOrder = Audio.Albums.DEFAULT_SORT_ORDER;
Cursor albumCursor = getContext().getContentResolver().query(uri, projection, null, null, sortOrder);
//Matrix cursor to hold final data to be returned to calling context
MatrixCursor cursor = new MatrixCursor( new String[]
{ BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ARTIST, AudioColumns.ALBUM, AudioColumns.ALBUM_ID});
//Map data from Audio Id cursor to the ALbumName Colum
ContentQueryMap mQueryMap = new ContentQueryMap(albumCursor, AlbumColumns.ALBUM, false, null);
Map<String, ContentValues> data = mQueryMap.getRows();
if (mediaCursor != null) {
while(mediaCursor.moveToNext()) {
String id = mediaCursor.getString(mediaCursor.getColumnIndexOrThrow(BaseColumns._ID));
String title = mediaCursor.getString(mediaCursor.getColumnIndexOrThrow(MediaColumns.TITLE));
String artist = mediaCursor.getString(mediaCursor.getColumnIndexOrThrow(AudioColumns.ARTIST));
String album = mediaCursor.getString(mediaCursor.getColumnIndexOrThrow(AudioColumns.ALBUM));
ContentValues tData = data.get(album);
String albumid = (String) tData.get(BaseColumns._ID);
cursor.addRow(new String[] {id, title, artist, album, albumid});
}
mediaCursor.close();
}
if (cursor != null) {
// Ensure the cursor window is filled
registerContentObserver(cursor, mObserver);
}
return cursor;
}
示例15: setupFragmentData
@Override
public void setupFragmentData() {
mAdapter = new NowPlayingAdapter(getActivity(), R.layout.music_dragsort_listview_items, null,
new String[] {}, new int[] {}, 0);
mProjection = new String[] {
BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM, AudioColumns.ARTIST
};
mSortOrder = Audio.Media.DEFAULT_SORT_ORDER;
mUri = Audio.Media.EXTERNAL_CONTENT_URI;
StringBuilder where = new StringBuilder();
long[] mNowPlaying = MusicUtils.getQueue();
if (mNowPlaying.length <= 0){
where.append(AudioColumns.IS_MUSIC + "=1").append(" AND " + MediaColumns.TITLE + " != ''");
}
else{
where.append(BaseColumns._ID + " IN (");
for (long queue_id : mNowPlaying) {
where.append(queue_id + ",");
}
where.deleteCharAt(where.length() - 1);
where.append(")");
}
mWhere = where.toString();
mMediaIdColumn = BaseColumns._ID;
mType = TYPE_SONG;
mFragmentGroupId = 91;
}