[Android] Add a setting to avoid showing video thumbnails

Nicolas Pomepuy git at videolan.org
Fri May 17 09:38:11 CEST 2019


vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Tue Apr 30 11:19:29 2019 +0200| [c9942e0fdc281c55fc633a1f4f5993f6028f17fe] | committer: Geoffrey Métais

Add a setting to avoid showing video thumbnails

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

 vlc-android/res/values/strings.xml                                  | 2 ++
 vlc-android/res/xml/preferences_video.xml                           | 6 ++++++
 vlc-android/src/org/videolan/vlc/gui/helpers/ImageLoader.kt         | 5 +++++
 .../src/org/videolan/vlc/gui/preferences/PreferencesVideo.kt        | 4 ++++
 4 files changed, 17 insertions(+)

diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index 3d5af66d9..b5d549ff3 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -702,4 +702,6 @@
     <string name="device_default">Device default</string>
     <string name="track_number">%s tracks</string>
     <string name="jump_to">Jump to</string>
+    <string name="show_video_thumbnails_summary">Show video thumbnails in lists</string>
+    <string name="show_video_thumbnails">Video thumbnails</string>
 </resources>
diff --git a/vlc-android/res/xml/preferences_video.xml b/vlc-android/res/xml/preferences_video.xml
index d35e03d88..655b07d0e 100644
--- a/vlc-android/res/xml/preferences_video.xml
+++ b/vlc-android/res/xml/preferences_video.xml
@@ -23,6 +23,12 @@
         android:key="force_list_portrait"
         android:summary="@string/force_list_portrait_summary"
         android:title="@string/force_list_portrait" />
+
+    <CheckBoxPreference
+        android:defaultValue="true"
+        android:key="show_video_thumbnails"
+        android:summary="@string/show_video_thumbnails_summary"
+        android:title="@string/show_video_thumbnails" />
     <CheckBoxPreference
         android:defaultValue="false"
         android:key="save_brightness"
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 60c6cd299..574817f75 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/ImageLoader.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/ImageLoader.kt
@@ -29,6 +29,7 @@ import org.videolan.vlc.databinding.AudioBrowserTvItemBinding
 import org.videolan.vlc.gui.tv.TvUtil
 import org.videolan.vlc.util.AppScope
 import org.videolan.vlc.util.HttpImageLoader
+import org.videolan.vlc.util.Settings
 import org.videolan.vlc.util.ThumbnailsProvider
 import org.videolan.vlc.util.ThumbnailsProvider.obtainBitmap
 
@@ -47,6 +48,10 @@ fun loadImage(v: View, item: MediaLibraryItem?) {
     if (item.itemType == MediaLibraryItem.TYPE_GENRE && !isForTV(binding)) {
         return
     }
+    if (item is MediaWrapper && item.type == MediaWrapper.TYPE_VIDEO && !Settings.getInstance(v.context).getBoolean("show_video_thumbnails", true)) {
+        updateImageView(UiTools.getDefaultVideoDrawable(v.context).bitmap, v, binding)
+        return
+    }
     val isMedia = item.itemType == MediaLibraryItem.TYPE_MEDIA
     val isGroup = isMedia && (item as MediaWrapper).type == MediaWrapper.TYPE_GROUP
     val isFolder = !isMedia && item.itemType == MediaLibraryItem.TYPE_FOLDER;
diff --git a/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesVideo.kt b/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesVideo.kt
index 8077014ce..a52258c48 100644
--- a/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesVideo.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesVideo.kt
@@ -59,6 +59,10 @@ class PreferencesVideo : BasePreferenceFragment() {
                 (activity as PreferencesActivity).setRestart()
                 return true
             }
+            "show_video_thumbnails" -> {
+                (activity as PreferencesActivity).setRestart()
+                return true
+            }
             "media_seen" -> activity!!.setResult(PreferencesActivity.RESULT_UPDATE_SEEN_MEDIA)
         }
         return super.onPreferenceTreeClick(preference)



More information about the Android mailing list