diff --git a/goonj/src/main/java/ai/rever/goonj/audioplayer/models/Samples.kt b/goonj/src/main/java/ai/rever/goonj/audioplayer/models/Samples.kt index 5de2012..3a316e1 100644 --- a/goonj/src/main/java/ai/rever/goonj/audioplayer/models/Samples.kt +++ b/goonj/src/main/java/ai/rever/goonj/audioplayer/models/Samples.kt @@ -23,7 +23,6 @@ object Samples { "Talkies", //"If it talks like a duck and walks like a duck.", "One", - R.mipmap.ic_album_art, "https://img.discogs.com/Bss063QHQ7k0sRwejSQWTJ-iKGI=/fit-in/600x573/filters:strip_icc():format(jpeg):mode_rgb():quality(90)/discogs-images/R-900642-1182343816.jpeg.jpg" ), Track( "https://storage.googleapis.com/automotive-media/Jazz_In_Paris.mp3", @@ -32,7 +31,6 @@ object Samples { "Jazz in Paris", //"Jazz for the masses", "Two", - R.mipmap.ic_album_art, "https://i.ebayimg.com/images/g/MMgAAOSwXi9b6BJ3/s-l640.jpg" ), Track( "https://storage.googleapis.com/automotive-media/The_Messenger.mp3", @@ -41,7 +39,6 @@ object Samples { "The messenger", //"Hipster guide to London", "Three", - R.mipmap.ic_album_art, "https://www.mobygames.com/images/covers/l/507031-the-messenger-nintendo-switch-front-cover.jpg" ), Track( "https://raw.githubusercontent.com/rever-ai/SampleMusic/master/Hard_TON_-_07_-_Choc-ice_Dance.mp3", @@ -49,7 +46,6 @@ object Samples { "Audio 4", //"Hipster guide to London", "Four", - R.mipmap.ic_album_art, "https://www.mobygames.com/images/covers/l/507031-the-messenger-nintendo-switch-front-cover.jpg" ), Track( "https://raw.githubusercontent.com/rever-ai/SampleMusic/master/Big_Blood_-_01_-_Bah-num.mp3", @@ -57,7 +53,6 @@ object Samples { "Audio 5", //"Hipster guide to London", "Five", - R.mipmap.ic_album_art, "https://www.mobygames.com/images/covers/l/507031-the-messenger-nintendo-switch-front-cover.jpg" ), Track( "https://raw.githubusercontent.com/rever-ai/SampleMusic/master/Black_Ant_-_08_-_realest_year_9.mp3", @@ -65,13 +60,12 @@ object Samples { "Audio 6", //"Hipster guide to London", "Six", - R.mipmap.ic_album_art, "https://www.mobygames.com/images/covers/l/507031-the-messenger-nintendo-switch-front-cover.jpg" ) ) class Track( - val url: String, val mediaId: String, val title: String, val artist: String, val bitmapResource: Int, + val url: String, val mediaId: String, val title: String, val artist: String, val albumArtUrl : String? = "" ) : Serializable { var state = MediaItemStatus.PLAYBACK_STATE_PENDING @@ -80,6 +74,8 @@ object Samples { var duration: Long = 0 var timestamp: Long = 0 var remoteItemId: String? = null + var bitmapResource: Int = R.mipmap.ic_album_art + var bitmap: Bitmap? =null override fun toString(): String { return "$title Description: $artist DURATION: $duration INDEX: $index state: $state" @@ -95,11 +91,15 @@ object Samples { .setExtras(extras) context?.let { - val bitmap = getBitmap(context, track.bitmapResource) - extras.putParcelable(MediaMetadataCompat.METADATA_KEY_ALBUM_ART, bitmap) - extras.putParcelable(MediaMetadataCompat.METADATA_KEY_DISPLAY_ICON, bitmap) + if(track.bitmap != null){ + mediaDescriptionBuilder.setIconBitmap(track.bitmap) + } else { + val bitmap = getBitmap(context, track.bitmapResource) + extras.putParcelable(MediaMetadataCompat.METADATA_KEY_ALBUM_ART, bitmap) + extras.putParcelable(MediaMetadataCompat.METADATA_KEY_DISPLAY_ICON, bitmap) - mediaDescriptionBuilder.setIconBitmap(bitmap) + mediaDescriptionBuilder.setIconBitmap(bitmap) + } } return mediaDescriptionBuilder.build() }