[Android] Hide the video thumbnail progress in case of failure

Nicolas Pomepuy git at videolan.org
Tue Jul 18 13:14:05 UTC 2023


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Jul 18 14:22:29 2023 +0200| [353e434024080ab78fce0f1b2fc73fdaf2149e20] | committer: Duncan McNamara

Hide the video thumbnail progress in case of failure

> https://code.videolan.org/videolan/vlc-android/commit/353e434024080ab78fce0f1b2fc73fdaf2149e20
---

 .../vlc-android/src/org/videolan/vlc/gui/helpers/ImageLoader.kt        | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/helpers/ImageLoader.kt b/application/vlc-android/src/org/videolan/vlc/gui/helpers/ImageLoader.kt
index 26ccd28b05..bff35a6a05 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/helpers/ImageLoader.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/helpers/ImageLoader.kt
@@ -61,6 +61,7 @@ private const val TAG = "ImageLoader"
 @BindingAdapter(value = ["media", "imageWidth", "tv", "card"], requireAll = false)
 fun loadImage(v: View, item: MediaLibraryItem?, imageWidth: Int = 0, tv: Boolean = false, card: Boolean = false) {
     if (item === null) return
+    v.tag = item.title
 
     if (item.itemType == MediaLibraryItem.TYPE_PLAYLIST || item.itemType == MediaLibraryItem.TYPE_GENRE) {
         if (imageWidth != 0) {
@@ -250,6 +251,7 @@ private suspend fun getImage(v: View, item: MediaLibraryItem, binding: ViewDataB
     if (image == null) {
         //keep the default image
         binding?.setVariable(BR.scaleType, ImageView.ScaleType.CENTER_INSIDE)
+        if (!bindChanged) binding?.setVariable(BR.showProgress, false)
         binding?.removeOnRebindCallback(rebindCallbacks!!)
         return
     }
@@ -276,6 +278,7 @@ private suspend fun getPlaylistOrGenreImage(v: View, item: MediaLibraryItem, bin
         ThumbnailsProvider.getPlaylistOrGenreImage("${if (item is MediaWrapper && item.type == MediaWrapper.TYPE_PLAYLIST)"playlist" else "genre"}:${item.id}_$width", tracks, width)
     } else null
     if (!bindChanged && playlistImage == null) playlistImage = UiTools.getDefaultAudioDrawable(AppContextProvider.appContext).bitmap
+    if (!bindChanged && playlistImage == null) binding?.setVariable(BR.showProgress, false)
     if (!bindChanged) updateImageView(playlistImage, v, binding)
 
     binding?.removeOnRebindCallback(rebindCallbacks!!)



More information about the Android mailing list