当前位置: 首页>>代码示例>>Java>>正文


Java MediaMetadataCompat.METADATA_KEY_GENRE属性代码示例

本文整理汇总了Java中android.support.v4.media.MediaMetadataCompat.METADATA_KEY_GENRE属性的典型用法代码示例。如果您正苦于以下问题:Java MediaMetadataCompat.METADATA_KEY_GENRE属性的具体用法?Java MediaMetadataCompat.METADATA_KEY_GENRE怎么用?Java MediaMetadataCompat.METADATA_KEY_GENRE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.support.v4.media.MediaMetadataCompat的用法示例。


在下文中一共展示了MediaMetadataCompat.METADATA_KEY_GENRE属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMetadata

public static MediaMetadataCompat getMetadata(Context ctx, String mediaId) {
    MediaMetadataCompat metadataWithoutBitmap = music.get(mediaId);
    Bitmap albumArt = getAlbumBitmap(ctx, mediaId);

    // Since MediaMetadataCompat is immutable, we need to create a copy to set the album art
    // We don't set it initially on all items so that they don't take unnecessary memory
    MediaMetadataCompat.Builder builder = new MediaMetadataCompat.Builder();
    for (String key :
            new String[]{
                    MediaMetadataCompat.METADATA_KEY_MEDIA_ID,
                    MediaMetadataCompat.METADATA_KEY_ALBUM,
                    MediaMetadataCompat.METADATA_KEY_ARTIST,
                    MediaMetadataCompat.METADATA_KEY_GENRE,
                    MediaMetadataCompat.METADATA_KEY_TITLE
            }) {
        builder.putString(key, metadataWithoutBitmap.getString(key));
    }
    builder.putLong(
            MediaMetadataCompat.METADATA_KEY_DURATION,
            metadataWithoutBitmap.getLong(MediaMetadataCompat.METADATA_KEY_DURATION));
    builder.putBitmap(MediaMetadataCompat.METADATA_KEY_ALBUM_ART, albumArt);
    return builder.build();
}
 
开发者ID:googlecodelabs,项目名称:musicplayer-devices,代码行数:23,代码来源:MusicLibrary.java

示例2: getMetadata

public static MediaMetadataCompat getMetadata(Context ctx, String mediaId) {
    MediaMetadataCompat metadataWithoutBitmap = music.get(mediaId);
    Bitmap albumArt = getAlbumBitmap(ctx, mediaId);

    // Since MediaMetadataCompat is immutable, we need to create a copy to set the album art.
    // We don't set it initially on all items so that they don't take unnecessary memory.
    MediaMetadataCompat.Builder builder = new MediaMetadataCompat.Builder();
    for (String key :
            new String[] {
                MediaMetadataCompat.METADATA_KEY_MEDIA_ID,
                MediaMetadataCompat.METADATA_KEY_ALBUM,
                MediaMetadataCompat.METADATA_KEY_ARTIST,
                MediaMetadataCompat.METADATA_KEY_GENRE,
                MediaMetadataCompat.METADATA_KEY_TITLE
            }) {
        builder.putString(key, metadataWithoutBitmap.getString(key));
    }
    builder.putLong(
            MediaMetadataCompat.METADATA_KEY_DURATION,
            metadataWithoutBitmap.getLong(MediaMetadataCompat.METADATA_KEY_DURATION));
    builder.putBitmap(MediaMetadataCompat.METADATA_KEY_ALBUM_ART, albumArt);
    return builder.build();
}
 
开发者ID:googlecodelabs,项目名称:musicplayer-devices,代码行数:23,代码来源:MusicLibrary.java

示例3: getMetadata

public static MediaMetadataCompat getMetadata(Context context, String mediaId) {
    MediaMetadataCompat metadataWithoutBitmap = music.get(mediaId);
    Bitmap albumArt = getAlbumBitmap(context, mediaId);

    // Since MediaMetadataCompat is immutable, we need to create a copy to set the album art.
    // We don't set it initially on all items so that they don't take unnecessary memory.
    MediaMetadataCompat.Builder builder = new MediaMetadataCompat.Builder();
    for (String key :
            new String[]{
                    MediaMetadataCompat.METADATA_KEY_MEDIA_ID,
                    MediaMetadataCompat.METADATA_KEY_ALBUM,
                    MediaMetadataCompat.METADATA_KEY_ARTIST,
                    MediaMetadataCompat.METADATA_KEY_GENRE,
                    MediaMetadataCompat.METADATA_KEY_TITLE
            }) {
        builder.putString(key, metadataWithoutBitmap.getString(key));
    }
    builder.putLong(
            MediaMetadataCompat.METADATA_KEY_DURATION,
            metadataWithoutBitmap.getLong(MediaMetadataCompat.METADATA_KEY_DURATION));
    builder.putBitmap(MediaMetadataCompat.METADATA_KEY_ALBUM_ART, albumArt);
    return builder.build();
}
 
开发者ID:nazmulidris,项目名称:mediasession-mediaplayer,代码行数:23,代码来源:MusicLibrary.java

示例4: getMetadata

public static MediaMetadataCompat getMetadata(String mediaId) {
    MediaMetadataCompat metadataWithoutBitmap = music.get(mediaId);
    Bitmap albumArt = getAlbumBitmap(mediaId);

    // Since MediaMetadataCompat is immutable, we need to create a copy to set the album art.
    // We don't set it initially on all items so that they don't take unnecessary memory.
    MediaMetadataCompat.Builder builder = new MediaMetadataCompat.Builder();
    for (String key :
            new String[]{
                    MediaMetadataCompat.METADATA_KEY_MEDIA_ID,
                    MediaMetadataCompat.METADATA_KEY_ALBUM,
                    MediaMetadataCompat.METADATA_KEY_ARTIST,
                    MediaMetadataCompat.METADATA_KEY_GENRE,
                    MediaMetadataCompat.METADATA_KEY_TITLE
            }) {
        builder.putString(key, metadataWithoutBitmap.getString(key));
    }
    builder.putLong(
            MediaMetadataCompat.METADATA_KEY_DURATION,
            metadataWithoutBitmap.getLong(MediaMetadataCompat.METADATA_KEY_DURATION));
    builder.putBitmap(MediaMetadataCompat.METADATA_KEY_ALBUM_ART, albumArt);
    return builder.build();
}
 
开发者ID:fendoudebb,项目名称:PlayAndroid,代码行数:23,代码来源:LocalMusicLibrary.java


注:本文中的android.support.v4.media.MediaMetadataCompat.METADATA_KEY_GENRE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。