diff --git a/app/src/acad/res/values/strings.xml b/app/src/acad/res/values/strings.xml
index 9ec3700..c3d2d65 100644
--- a/app/src/acad/res/values/strings.xml
+++ b/app/src/acad/res/values/strings.xml
@@ -186,17 +186,25 @@
Modifier une vidéo
Paramètres
+
+ Paramètres des vidéos
+ Interface
+
+
- Normal
- Streaming
- Navigateur
-
+ Cache
+ Set the cache for videos (default 100Mb)
+ Cache pour les vidéos: %d Mo
set_video_mode_choice
set_video_minimize_choice
set_video_language_choice
set_video_quality_choice
+ set_video_cache_choice
- Elevé
diff --git a/app/src/full/res/values/strings.xml b/app/src/full/res/values/strings.xml
index e2a0017..3b7a410 100644
--- a/app/src/full/res/values/strings.xml
+++ b/app/src/full/res/values/strings.xml
@@ -135,13 +135,19 @@
History
Edit
+ Video settings
+ Interface
+
set_video_mode_choice
set_video_minimize_choice
set_video_language_choice
set_video_quality_choice
-
+ set_video_cache_choice
+ Cache
+ Définir le cache pour les vidéos (défaut 100Mo)
Define a default quality for videos
Resolution for videos
+ Video cache: %d Mb
Captions
Pick captions
diff --git a/app/src/main/java/app/fedilab/fedilabtube/fragment/SettingsFragment.java b/app/src/main/java/app/fedilab/fedilabtube/fragment/SettingsFragment.java
index 3a32801..8beb574 100644
--- a/app/src/main/java/app/fedilab/fedilabtube/fragment/SettingsFragment.java
+++ b/app/src/main/java/app/fedilab/fedilabtube/fragment/SettingsFragment.java
@@ -9,6 +9,7 @@ import androidx.preference.ListPreference;
import androidx.preference.MultiSelectListPreference;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceScreen;
+import androidx.preference.SeekBarPreference;
import androidx.preference.SwitchPreference;
import java.util.ArrayList;
@@ -16,6 +17,7 @@ import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Set;
@@ -104,6 +106,13 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
}
}
}
+ if (key.compareTo(getString(R.string.set_video_cache_choice)) == 0) {
+ SeekBarPreference set_video_cache_choice = findPreference(getString(R.string.set_video_cache_choice));
+ assert set_video_cache_choice != null;
+ final int progress = set_video_cache_choice.getValue();
+ set_video_cache_choice.setSummary(getActivity().getString(R.string.video_cache_value, progress*10));
+ editor.putInt(Helper.SET_VIDEO_CACHE, progress*10);
+ }
if (key.compareTo(getString(R.string.set_video_minimize_choice)) == 0) {
SwitchPreference set_video_minimize_choice = findPreference(getString(R.string.set_video_minimize_choice));
assert set_video_minimize_choice != null;
@@ -159,6 +168,11 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared
set_video_quality_choice.setEntryValues(entryValuesQuality);
set_video_quality_choice.setValueIndex(video_quality);
}
+ //****** Video cache *******
+ SeekBarPreference set_video_cache_choice = findPreference(getString(R.string.set_video_cache_choice));
+ int video_cache = sharedpref.getInt(Helper.SET_VIDEO_CACHE, Helper.DEFAULT_VIDEO_CACHE_MB);
+ assert set_video_cache_choice != null;
+ set_video_cache_choice.setValue(video_cache/10);
boolean minimized = sharedpref.getBoolean(getString(R.string.set_video_minimize_choice), true);
SwitchPreference set_video_minimize_choice = findPreference(getString(R.string.set_video_minimize_choice));
diff --git a/app/src/main/res/drawable/ic_baseline_storage_24.xml b/app/src/main/res/drawable/ic_baseline_storage_24.xml
new file mode 100644
index 0000000..5ca45e3
--- /dev/null
+++ b/app/src/main/res/drawable/ic_baseline_storage_24.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/xml/main_preferences.xml b/app/src/main/res/xml/main_preferences.xml
index da0db6b..daf3d80 100644
--- a/app/src/main/res/xml/main_preferences.xml
+++ b/app/src/main/res/xml/main_preferences.xml
@@ -3,27 +3,38 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:key="app_prefs">
-
+
+
+
-
+
-
+
+
-
+
+
+
\ No newline at end of file