[Android] TV: Do not blur backdrop

Geoffrey Métais git at videolan.org
Thu Nov 28 11:40:55 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Nov 13 11:21:27 2019 +0100| [7d75312f826d4bda19af607116226dad03aa84a3] | committer: Geoffrey Métais

TV: Do not blur backdrop

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

 .../org/videolan/vlc/gui/tv/MediaItemDetailsFragment.kt    | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/MediaItemDetailsFragment.kt b/vlc-android/src/org/videolan/vlc/gui/tv/MediaItemDetailsFragment.kt
index 2ff21bcc1..996648af0 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MediaItemDetailsFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MediaItemDetailsFragment.kt
@@ -163,11 +163,15 @@ class MediaItemDetailsFragment : DetailsSupportFragment(), CoroutineScope by Mai
 
     private fun loadBackdrop(url: String? = null) {
         lifecycleScope.launchWhenStarted {
-            val cover = if (!url.isNullOrEmpty()) withContext(Dispatchers.IO) { HttpImageLoader.downloadBitmap(url) } else if (viewModel.media.type == AbstractMediaWrapper.TYPE_AUDIO || viewModel.media.type == AbstractMediaWrapper.TYPE_VIDEO)
-                withContext(Dispatchers.IO) { AudioUtil.readCoverBitmap(viewModel.mediaItemDetails.artworkUrl, 512) }
-            else null
-            val blurred = cover?.let { withContext(Dispatchers.IO) { UiTools.blurBitmap(it) } }
-            blurred?.let { backgroundManager.setBitmap(blurred) }
+            when {
+                !url.isNullOrEmpty() -> withContext(Dispatchers.IO) { HttpImageLoader.downloadBitmap(url) }
+                viewModel.media.type == AbstractMediaWrapper.TYPE_AUDIO || viewModel.media.type == AbstractMediaWrapper.TYPE_VIDEO -> {
+                    withContext(Dispatchers.IO) {
+                        AudioUtil.readCoverBitmap(viewModel.mediaItemDetails.artworkUrl, 512)?.let { UiTools.blurBitmap(it) }
+                    }
+                }
+                else -> null
+            }?.let { backgroundManager.setBitmap(it) }
         }
     }
 



More information about the Android mailing list