[Android] Use composed playlist image in PlaylistActivity collapsible toolbar
Nicolas Pomepuy
git at videolan.org
Mon Jul 29 16:37:14 CEST 2019
vlc-android | branch: 3.2.x | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Mon Jul 29 09:08:25 2019 +0200| [d35e5c4171b02185bdd544bad8321f788d8ebdf8] | committer: Geoffrey Métais
Use composed playlist image in PlaylistActivity collapsible toolbar
(cherry picked from commit f7e72423324852bd55a03d801ead729a51fcb86c)
> https://code.videolan.org/videolan/vlc-android/commit/d35e5c4171b02185bdd544bad8321f788d8ebdf8
---
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