[Android] Add a metered connection preference

Nicolas Pomepuy git at videolan.org
Wed May 15 13:56:42 UTC 2024


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon May  6 11:27:31 2024 +0200| [7bf767b345ef215de97106af02b7e16c1990ec76] | committer: Nicolas Pomepuy

Add a metered connection preference

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

 application/resources/src/main/res/values/arrays.xml  | 11 +++++++++++
 application/resources/src/main/res/values/strings.xml |  6 ++++++
 application/vlc-android/res/xml/preferences.xml       | 10 ++++++++++
 3 files changed, 27 insertions(+)

diff --git a/application/resources/src/main/res/values/arrays.xml b/application/resources/src/main/res/values/arrays.xml
index fbbe4bfdab..ba49a11e03 100644
--- a/application/resources/src/main/res/values/arrays.xml
+++ b/application/resources/src/main/res/values/arrays.xml
@@ -262,6 +262,17 @@
         <item>98</item>
     </string-array>
 
+    <string-array name="metered_connection_list">
+        <item>@string/metered_do_nothing</item>
+        <item>@string/metered_stop</item>
+        <item>@string/metered_warn</item>
+    </string-array>
+    <string-array name="metered_connection_values" translatable="false">
+        <item>0</item>
+        <item>1</item>
+        <item>2</item>
+    </string-array>
+
     <string-array name="list_title_ellipsize_list">
         <item>@string/list_title_ellipsize_default</item>
         <item>@string/list_title_ellipsize_left</item>
diff --git a/application/resources/src/main/res/values/strings.xml b/application/resources/src/main/res/values/strings.xml
index e3dcee85ac..2dfece2236 100644
--- a/application/resources/src/main/res/values/strings.xml
+++ b/application/resources/src/main/res/values/strings.xml
@@ -1238,4 +1238,10 @@
     <string name="podcast_mode_genres" translatable="false">audiobook(s), podcast, speech, or vocal</string>
     <string name="voice_control">Voice control</string>
     <string name="voice_control_help">VLC can be controlled through Google Assistant by speaking the following commands:\n\t• Play, Pause, Stop, Previous, Next\n\t• Rewind, Fast Forward, Repeat <all|one|off>\n\t• Jump to <time>, Skip <duration>\n\t• What\'s this <artist|album|song>\n\t• Play [artist|album|song|genre|playlist] <name></string>
+
+    <string name="network" >Network</string>
+    <string name="metered_connection">Action for streams when the connection is metered</string>
+    <string name="metered_do_nothing">Do nothing</string>
+    <string name="metered_stop">Pause playback</string>
+    <string name="metered_warn">Warn me (the warning may be missed for audio playback)</string>
 </resources>
diff --git a/application/vlc-android/res/xml/preferences.xml b/application/vlc-android/res/xml/preferences.xml
index 3495b8137f..dc25cdf0ea 100644
--- a/application/vlc-android/res/xml/preferences.xml
+++ b/application/vlc-android/res/xml/preferences.xml
@@ -41,6 +41,16 @@
                 android:title="@string/screen_orientation"/>
     </PreferenceCategory>
 
+    <PreferenceCategory android:title="@string/network">
+        <ListPreference
+                android:defaultValue="0"
+                android:entries="@array/metered_connection_list"
+                android:entryValues="@array/metered_connection_values"
+                android:key="metered_connection"
+                android:summary="%s"
+                android:title="@string/metered_connection"/>
+    </PreferenceCategory>
+
     <PreferenceCategory android:title="@string/history">
         <CheckBoxPreference
                 app:singleLineTitle="false"



More information about the Android mailing list