[Android] Add a default album cover in the HeaderMediaListActivity

Nicolas Pomepuy git at videolan.org
Thu Sep 7 13:16:49 UTC 2023


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Sep  7 07:17:13 2023 +0200| [89ccfaab94769fe61c5d00f827fd58bc30c4c399] | committer: Duncan McNamara

Add a default album cover in the HeaderMediaListActivity

Fixes #2988

> https://code.videolan.org/videolan/vlc-android/commit/89ccfaab94769fe61c5d00f827fd58bc30c4c399
---

 .../src/org/videolan/vlc/gui/HeaderMediaListActivity.kt        | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt
index 881aae161c..2e004e8fa9 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt
@@ -194,10 +194,14 @@ open class HeaderMediaListActivity : AudioPlayerContainerActivity(), IEventsHand
 
         val context = this
         lifecycleScope.launch {
+            var showBackground = true
             val cover = withContext(Dispatchers.IO) {
                 val width = if (binding.backgroundView.width > 0) binding.backgroundView.width else context.getScreenWidth()
                 if (!playlist.artworkMrl.isNullOrEmpty()) {
                     AudioUtil.fetchCoverBitmap(Uri.decode(playlist.artworkMrl), width)
+                } else if (playlist is Album) {
+                    showBackground = false
+                    UiTools.getDefaultAlbumDrawableBig(this at HeaderMediaListActivity).bitmap
                 } else {
                     ThumbnailsProvider.getPlaylistOrGenreImage("playlist:${playlist.id}_$width", playlist.tracks.toList(), width)
                 }
@@ -205,8 +209,10 @@ open class HeaderMediaListActivity : AudioPlayerContainerActivity(), IEventsHand
             if (cover != null) {
                 binding.cover = BitmapDrawable(this at HeaderMediaListActivity.resources, cover)
                 binding.appbar.setExpanded(true, true)
-                val radius = if (isPlaylist) 25f else 15f
-                UiTools.blurView(binding.backgroundView, cover, radius, UiTools.getColorFromAttribute(context, R.attr.audio_player_background_tint))
+                if (showBackground) {
+                    val radius = if (isPlaylist) 25f else 15f
+                    UiTools.blurView(binding.backgroundView, cover, radius, UiTools.getColorFromAttribute(context, R.attr.audio_player_background_tint))
+                }
             }
         }
 



More information about the Android mailing list