[Android] Skip thumbnail request when already failed

Geoffrey Métais git at videolan.org
Mon Apr 9 17:33:08 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Apr  9 17:32:46 2018 +0200| [f27a1b168b961eee4d8b16d2f8716f98196a8dad] | committer: Geoffrey Métais

Skip thumbnail request when already failed

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

 vlc-android/src/org/videolan/vlc/util/ThumbnailsProvider.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/util/ThumbnailsProvider.java b/vlc-android/src/org/videolan/vlc/util/ThumbnailsProvider.java
index 66d747533..d527d6ccb 100644
--- a/vlc-android/src/org/videolan/vlc/util/ThumbnailsProvider.java
+++ b/vlc-android/src/org/videolan/vlc/util/ThumbnailsProvider.java
@@ -61,6 +61,7 @@ public class ThumbnailsProvider {
         final Bitmap cacheBM = hasCache ? BitmapCache.getInstance().getBitmapFromMemCache(thumbPath) : null;
         if (cacheBM != null) return cacheBM;
         if (hasCache && new File(thumbPath).exists()) return readCoverBitmap(thumbPath, sImageWidth);
+        if (media.isThumbnailGenerated()) return null;
         final Bitmap bitmap = ThumbnailUtils.createVideoThumbnail(filePath, MediaStore.Video.Thumbnails.MINI_KIND);
         if (bitmap != null) {
             BitmapCache.getInstance().addBitmapToMemCache(thumbPath, bitmap);
@@ -68,7 +69,7 @@ public class ThumbnailsProvider {
                 media.setThumbnail(thumbPath);
                 saveOnDisk(bitmap, thumbPath);
             }
-        } else if (media.getId() != 0L && !media.isThumbnailGenerated()) {
+        } else if (media.getId() != 0L) {
             Medialibrary.getInstance().requestThumbnail(media.getId());
         }
         return bitmap;



More information about the Android mailing list