[Android] TV: Improve background switching
Geoffrey Métais
git at videolan.org
Tue Dec 3 12:00:58 CET 2019
vlc-android | branch: 3.2.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Nov 26 15:39:59 2019 +0100| [b97f6d98760425206b51aff537572068a907e239] | committer: Geoffrey Métais
TV: Improve background switching
(cherry picked from commit 7c6f0643e531c6afad6f0251d0a80cb63122c754)
> https://code.videolan.org/videolan/vlc-android/commit/b97f6d98760425206b51aff537572068a907e239
---
vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.kt | 8 +++++---
.../src/org/videolan/vlc/gui/tv/browser/BaseBrowserTvFragment.kt | 1 +
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.kt b/vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.kt
index 67012f1db..abb67809e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.kt
@@ -356,8 +356,10 @@ object TvUtil {
@Suppress("UNNECESSARY_SAFE_CALL")
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
fun CoroutineScope.updateBackground(context: Context, bm: BackgroundManager?, item: Any?) {
- if (bm === null || item === null) return
- clearBackground(context, bm)
+ if (bm === null || item === null) {
+ clearBackground(context, bm)
+ return
+ }
if (item is MediaLibraryItem) launch {
val crop = item.itemType != MediaLibraryItem.TYPE_MEDIA || (item as AbstractMediaWrapper).type == AbstractMediaWrapper.TYPE_AUDIO
val artworkMrl = item.artworkMrl
@@ -386,7 +388,7 @@ fun CoroutineScope.updateBackground(context: Context, bm: BackgroundManager?, it
}
}
-private fun clearBackground(context: Context, bm: BackgroundManager?) {
+fun clearBackground(context: Context, bm: BackgroundManager?) {
if (bm === null) return
bm.color = ContextCompat.getColor(context, R.color.tv_bg)
bm.drawable = null
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseBrowserTvFragment.kt b/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseBrowserTvFragment.kt
index fb4f27408..ae13e3997 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseBrowserTvFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseBrowserTvFragment.kt
@@ -188,6 +188,7 @@ abstract class BaseBrowserTvFragment : Fragment(), BrowserFragmentInterface, IEv
}
override fun onStart() {
+ clearBackground(requireContext(), backgroundManager)
super.onStart()
setFocus = true
}
More information about the Android
mailing list