[Android] Use composed playlist image in PlaylistActivity collapsible toolbar

Nicolas Pomepuy git at videolan.org
Mon Jul 29 14:08:46 CEST 2019


vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Mon Jul 29 09:08:25 2019 +0200| [f7e72423324852bd55a03d801ead729a51fcb86c] | committer: Nicolas Pomepuy

Use composed playlist image in PlaylistActivity collapsible toolbar

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

 vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.kt | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.kt b/vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.kt
index cde13956d..dc12d213c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.kt
@@ -128,10 +128,15 @@ open class PlaylistActivity : AudioPlayerContainerActivity(), IEventsHandler, IL
         binding.songs.adapter = audioBrowserAdapter
         val fabVisibility = savedInstanceState != null && savedInstanceState.getBoolean(TAG_FAB_VISIBILITY)
 
-        if (!TextUtils.isEmpty(playlist.artworkMrl)) launch {
+        launch {
             val cover = withContext(Dispatchers.IO) {
-                AudioUtil.readCoverBitmap(Uri.decode(playlist.artworkMrl), resources.getDimensionPixelSize(R.dimen.audio_browser_item_size))
+                if (!TextUtils.isEmpty(playlist.artworkMrl)) {
+                    AudioUtil.readCoverBitmap(Uri.decode(playlist.artworkMrl), resources.getDimensionPixelSize(R.dimen.audio_browser_item_size))
+                } else {
+                    ThumbnailsProvider.getPlaylistImage("playlist:${playlist.id}", playlist.tracks.toList(), getScreenWidth())
+                }
             }
+
             if (cover != null) {
                 binding.cover = BitmapDrawable(this at PlaylistActivity.resources, cover)
                 launch {
@@ -144,7 +149,8 @@ open class PlaylistActivity : AudioPlayerContainerActivity(), IEventsHandler, IL
                     }
                 }
             } else fabFallback()
-        } else fabFallback()
+        }
+
         binding.fab.setOnClickListener(this)
     }
 



More information about the Android mailing list