Example usage for android.support.v4.media MediaMetadataCompat METADATA_KEY_COMPILATION

List of usage examples for android.support.v4.media MediaMetadataCompat METADATA_KEY_COMPILATION

Introduction

In this page you can find the example usage for android.support.v4.media MediaMetadataCompat METADATA_KEY_COMPILATION.

Prototype

String METADATA_KEY_COMPILATION

To view the source code for android.support.v4.media MediaMetadataCompat METADATA_KEY_COMPILATION.

Click Source Link

Document

The compilation status of the media.

Usage

From source file:com.bayapps.android.robophish.model.MusicProvider.java

private MediaBrowserCompat.MediaItem createMediaItem(MediaMetadataCompat metadata) {
    // Since mediaMetadata fields are immutable, we need to create a copy, so we
    // can set a hierarchy-aware mediaID. We will need to know the media hierarchy
    // when we get a onPlayFromMusicID call, so we can create the proper queue based
    // on where the music was selected from (by artist, by genre, random, etc)
    String title = metadata.getString(MediaMetadataCompat.METADATA_KEY_MEDIA_ID);

    String venue = metadata.getString(MediaMetadataCompat.METADATA_KEY_DISPLAY_SUBTITLE);

    String showId = metadata.getString(MediaMetadataCompat.METADATA_KEY_COMPILATION);
    String hierarchyAwareMediaID = MediaIDHelper.createMediaID(metadata.getDescription().getMediaId(),
            MEDIA_ID_TRACKS_BY_SHOW, showId);
    MediaMetadataCompat copy = new MediaMetadataCompat.Builder(metadata)
            .putString(MediaMetadataCompat.METADATA_KEY_MEDIA_ID, hierarchyAwareMediaID)
            .putString(MediaMetadataCompat.METADATA_KEY_DISPLAY_SUBTITLE, venue).build();

    return new MediaBrowserCompat.MediaItem(copy.getDescription(), MediaBrowserCompat.MediaItem.FLAG_PLAYABLE);

}