Skip to content
Snippets Groups Projects
Commit b97f6d98 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

TV: Improve background switching

(cherry picked from commit 7c6f0643)
parent 78c4f498
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -188,6 +188,7 @@ abstract class BaseBrowserTvFragment : Fragment(), BrowserFragmentInterface, IEv
}
override fun onStart() {
clearBackground(requireContext(), backgroundManager)
super.onStart()
setFocus = true
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment