[Android] ImageLoader: Skip network files

Geoffrey Métais git at videolan.org
Fri Jan 18 18:23:47 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Jan 18 18:18:59 2019 +0100| [d8eb796bf13e4ba5d93542543dc724db4d6ff3c7] | committer: Geoffrey Métais

ImageLoader: Skip network files

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

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

diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/ImageLoader.kt b/vlc-android/src/org/videolan/vlc/gui/helpers/ImageLoader.kt
index 73b225f56..52e10d00a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/ImageLoader.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/ImageLoader.kt
@@ -36,8 +36,10 @@ fun loadImage(v: View, item: MediaLibraryItem?) {
             || item.itemType == MediaLibraryItem.TYPE_GENRE
             || item.itemType == MediaLibraryItem.TYPE_PLAYLIST)
         return
-    val binding = DataBindingUtil.findBinding<ViewDataBinding>(v)
     val isMedia = item.itemType == MediaLibraryItem.TYPE_MEDIA
+    if (isMedia && (item as MediaWrapper).uri.scheme != "file") {
+        return
+    }
     val isGroup = isMedia && (item as MediaWrapper).type == MediaWrapper.TYPE_GROUP
     val isFolder = !isMedia && item.itemType == MediaLibraryItem.TYPE_FOLDER;
     val cacheKey = when {
@@ -46,6 +48,7 @@ fun loadImage(v: View, item: MediaLibraryItem?) {
         else -> ThumbnailsProvider.getMediaCacheKey(isMedia, item)
     }
     val bitmap = if (cacheKey !== null) sBitmapCache.getBitmapFromMemCache(cacheKey) else null
+    val binding = DataBindingUtil.findBinding<ViewDataBinding>(v)
     if (bitmap !== null) updateImageView(bitmap, v, binding)
     else AppScope.launch { getImage(v, findInLibrary(item, isMedia, isGroup), binding) }
 }



More information about the Android mailing list