[Android] Add a setting to disable the force SMB 1 option + fix custom libvlc option bug

Nicolas Pomepuy git at videolan.org
Wed Nov 18 11:23:30 CET 2020


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Nov 18 11:19:26 2020 +0100| [8c88b12c50960b5709dd4db44d9792390a7f5d03] | committer: Nicolas Pomepuy

Add a setting to disable the force SMB 1 option + fix custom libvlc option bug

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

 application/resources/src/main/res/values/strings.xml     |  2 ++
 .../television/ui/preferences/PreferencesAdvanced.kt      | 15 +++++++++------
 application/vlc-android/res/xml/preferences_adv.xml       |  7 +++++++
 .../videolan/vlc/gui/preferences/PreferencesAdvanced.kt   | 11 +++++++----
 4 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/application/resources/src/main/res/values/strings.xml b/application/resources/src/main/res/values/strings.xml
index 0b8cb692c..b7cfec005 100644
--- a/application/resources/src/main/res/values/strings.xml
+++ b/application/resources/src/main/res/values/strings.xml
@@ -772,5 +772,7 @@
     <string name="timeout_normal">Normal</string>
     <string name="timeout_long">Long</string>
     <string name="video_hud_timeout">Video player controls hiding delay</string>
+    <string name="prefersmbv1">Prefer SMB 1</string>
+    <string name="prefersmbv1_summary">Uncheck this setting if you have some difficulties browsing your SMB server</string>
 
 </resources>
diff --git a/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesAdvanced.kt b/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesAdvanced.kt
index 8db6f0185..bbdb5dca8 100644
--- a/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesAdvanced.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesAdvanced.kt
@@ -148,8 +148,7 @@ class PreferencesAdvanced : BasePreferenceFragment(), SharedPreferences.OnShared
                         activity?.let { Toast.makeText(it, R.string.network_caching_popup, Toast.LENGTH_SHORT).show() }
                     }
                 }
-                VLCInstance.restart()
-                (activity as? PreferencesActivity)?.restartMediaPlayer()
+                restartLibVLC()
             }
             "custom_libvlc_options" -> {
                 try {
@@ -160,12 +159,16 @@ class PreferencesAdvanced : BasePreferenceFragment(), SharedPreferences.OnShared
                 } finally {
                     (activity as? PreferencesActivity)?.restartMediaPlayer()
                 }
+                restartLibVLC()
             }
-            // No break because need VLCInstance.restart();
-            "opengl", "chroma_format", "deblocking", "enable_frame_skip", "enable_time_stretching_audio", "enable_verbose_mode" -> {
-                VLCInstance.restart()
-                (activity as? PreferencesActivity)?.restartMediaPlayer()
+            "opengl", "chroma_format", "deblocking", "enable_frame_skip", "enable_time_stretching_audio", "enable_verbose_mode", "prefer_smbv1" -> {
+                restartLibVLC()
             }
         }
     }
+
+    fun restartLibVLC() {
+        VLCInstance.restart()
+        (activity as? PreferencesActivity)?.restartMediaPlayer()
+    }
 }
diff --git a/application/vlc-android/res/xml/preferences_adv.xml b/application/vlc-android/res/xml/preferences_adv.xml
index c781b7992..d7178199c 100644
--- a/application/vlc-android/res/xml/preferences_adv.xml
+++ b/application/vlc-android/res/xml/preferences_adv.xml
@@ -11,6 +11,13 @@
             android:summary="@string/network_caching_summary"
             android:title="@string/network_caching"/>
 
+    <CheckBoxPreference
+            app:singleLineTitle="false"
+            android:defaultValue="true"
+            android:key="prefer_smbv1"
+            android:summary="@string/prefersmbv1_summary"
+            android:title="@string/prefersmbv1"/>
+
     <Preference
             android:enabled="true"
             android:key="dump_media_db"
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.kt b/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.kt
index 6d82d7c92..647ff1489 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.kt
@@ -150,8 +150,7 @@ class PreferencesAdvanced : BasePreferenceFragment(), SharedPreferences.OnShared
                         UiTools.snacker(requireView(), R.string.network_caching_popup)
                     }
                 }
-                VLCInstance.restart()
-                (activity as? PreferencesActivity)?.restartMediaPlayer()
+                restartLibVLC()
             }
             // No break because need VLCInstance.restart();
             "custom_libvlc_options" -> {
@@ -163,12 +162,16 @@ class PreferencesAdvanced : BasePreferenceFragment(), SharedPreferences.OnShared
                 } finally {
                     (activity as? PreferencesActivity)?.restartMediaPlayer()
                 }
-
+                restartLibVLC()
             }
-            "opengl", "chroma_format", "deblocking", "enable_frame_skip", "enable_time_stretching_audio", "enable_verbose_mode" -> {
+            "opengl", "chroma_format", "deblocking", "enable_frame_skip", "enable_time_stretching_audio", "enable_verbose_mode", "prefer_smbv1" -> {
                 VLCInstance.restart()
                 (activity as? PreferencesActivity)?.restartMediaPlayer()
             }
         }
     }
+    fun restartLibVLC() {
+        VLCInstance.restart()
+        (activity as? PreferencesActivity)?.restartMediaPlayer()
+    }
 }



More information about the Android mailing list