[Android] Fix the graphical TV issue + background improvements
Nicolas Pomepuy
git at videolan.org
Tue Jun 22 08:15:17 UTC 2021
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Jun 22 10:09:01 2021 +0200| [89bfcb30e29eac3a067a0f8f687b2e92f78aec16] | committer: Nicolas Pomepuy
Fix the graphical TV issue + background improvements
> https://code.videolan.org/videolan/vlc-android/commit/89bfcb30e29eac3a067a0f8f687b2e92f78aec16
---
.../src/main/java/org/videolan/television/ui/TvUtil.kt | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/application/television/src/main/java/org/videolan/television/ui/TvUtil.kt b/application/television/src/main/java/org/videolan/television/ui/TvUtil.kt
index 59a4a0017..175efdc35 100644
--- a/application/television/src/main/java/org/videolan/television/ui/TvUtil.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/TvUtil.kt
@@ -328,10 +328,8 @@ object TvUtil {
@Suppress("UNNECESSARY_SAFE_CALL")
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
fun CoroutineScope.updateBackground(activity: Activity, bm: BackgroundManager?, item: Any?) {
- if (bm === null || item === null) {
- clearBackground(activity, bm)
- return
- }
+ clearBackground(activity, bm)
+ if (bm === null || item === null) return
val screenRatio: Float = activity.getScreenWidth().toFloat() / activity.getScreenHeight()
if (item is MediaLibraryItem) launch {
val artworkMrl = item.artworkMrl
@@ -343,8 +341,7 @@ fun CoroutineScope.updateBackground(activity: Activity, bm: BackgroundManager?,
UiTools.blurBitmap(cover, 10f)
}
if (!isActive) return at launch
- bm?.color = 0
- bm?.drawable = BitmapDrawable(activity.resources, blurred)
+ blurred?.let { bm?.drawable = BitmapDrawable(activity.resources, blurred) }
} else if (item.itemType == MediaLibraryItem.TYPE_PLAYLIST) {
val blurred = withContext(Dispatchers.IO) {
var cover: Bitmap? = ThumbnailsProvider.getPlaylistOrGenreImage("playlist:${item.id}_512", item.tracks.toList(), 512)
@@ -353,8 +350,7 @@ fun CoroutineScope.updateBackground(activity: Activity, bm: BackgroundManager?,
UiTools.blurBitmap(cover, 10f)
}
if (!isActive) return at launch
- bm?.color = 0
- bm?.drawable = BitmapDrawable(activity.resources, blurred)
+ blurred?.let { bm?.drawable = BitmapDrawable(activity.resources, blurred) }
}
} else if (item is MediaMetadataWithImages) launch {
val blurred = withContext(Dispatchers.IO) {
@@ -363,8 +359,7 @@ fun CoroutineScope.updateBackground(activity: Activity, bm: BackgroundManager?,
UiTools.blurBitmap(cover, 10f)
}
if (!isActive) return at launch
- bm?.color = 0
- bm?.drawable = BitmapDrawable(activity.resources, blurred)
+ blurred?.let { bm?.drawable = BitmapDrawable(activity.resources, blurred) }
}
}
More information about the Android
mailing list