[Android] TV: Load relevant item icons

Geoffrey Métais git at videolan.org
Tue Aug 6 18:06:00 CEST 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Aug  6 17:31:21 2019 +0200| [602770dd7c3a9db8db42cce71fec3af3b731a485] | committer: Geoffrey Métais

TV: Load relevant item icons

Fix #973

> https://code.videolan.org/videolan/vlc-android/commit/602770dd7c3a9db8db42cce71fec3af3b731a485
---

 vlc-android/src/org/videolan/vlc/gui/tv/FileTvItemAdapter.kt | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/FileTvItemAdapter.kt b/vlc-android/src/org/videolan/vlc/gui/tv/FileTvItemAdapter.kt
index 6833c070a..34b469ed4 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/FileTvItemAdapter.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/FileTvItemAdapter.kt
@@ -19,6 +19,7 @@ import org.videolan.vlc.R
 import org.videolan.vlc.databinding.MediaBrowserTvItemBinding
 import org.videolan.vlc.gui.DiffUtilAdapter
 import org.videolan.vlc.gui.helpers.getBitmapFromDrawable
+import org.videolan.vlc.gui.helpers.getMediaIconDrawable
 import org.videolan.vlc.gui.view.FastScroller
 import org.videolan.vlc.interfaces.IEventsHandler
 import org.videolan.vlc.util.UPDATE_PAYLOAD
@@ -96,7 +97,7 @@ class FileTvItemAdapter(type: Int, private val eventsHandler: IEventsHandler, va
         init {
             binding.holder = this
             binding.scaleType = ImageView.ScaleType.CENTER_INSIDE
-            if (defaultCover != null) binding.cover = defaultCover
+            defaultCover?.let { binding.cover = it }
             if (AndroidUtil.isMarshMallowOrLater)
                 itemView.setOnContextClickListener { v ->
                     onMoreClick(v)
@@ -159,7 +160,8 @@ class FileTvItemAdapter(type: Int, private val eventsHandler: IEventsHandler, va
             binding.isSquare = isSquare
             binding.seen = seen
             binding.description = description
-            if (defaultCover != null) binding.cover = defaultCover
+            val cover = if (item is AbstractMediaWrapper) getMediaIconDrawable(binding.root.context, item.type, true) else defaultCover
+            cover?.let { binding.cover = it }
             if (seen == 0L) binding.mlItemSeen.visibility = View.GONE
             if (progress <= 0L) binding.progressBar.visibility = View.GONE
             binding.badgeTV.visibility = if (resolution.isBlank()) View.GONE else View.VISIBLE



More information about the Android mailing list