Add cache for videos
This commit is contained in:
parent
731863ef6c
commit
a8b17ce0b2
|
@ -186,17 +186,25 @@
|
|||
<string name="edit_video">Modifier une vidéo</string>
|
||||
<string name="settings">Paramètres</string>
|
||||
|
||||
|
||||
<string name="video_settings">Paramètres des vidéos</string>
|
||||
<string name="app_interface">Interface</string>
|
||||
|
||||
|
||||
<string-array name="settings_video_mode">
|
||||
<item>Normal</item>
|
||||
<item>Streaming</item>
|
||||
<item>Navigateur</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<string name="set_cache_mode">Cache</string>
|
||||
<string name="set_video_cache_description">Set the cache for videos (default 100Mb)</string>
|
||||
<string name="video_cache_value">Cache pour les vidéos: %d Mo</string>
|
||||
<string name="set_video_mode_choice" translatable="false">set_video_mode_choice</string>
|
||||
<string name="set_video_minimize_choice" translatable="false">set_video_minimize_choice</string>
|
||||
<string name="set_video_language_choice" translatable="false">set_video_language_choice</string>
|
||||
<string name="set_video_quality_choice" translatable="false">set_video_quality_choice</string>
|
||||
<string name="set_video_cache_choice" translatable="false">set_video_cache_choice</string>
|
||||
|
||||
<string-array name="settings_video_quality">
|
||||
<item>Elevé</item>
|
||||
|
|
|
@ -135,13 +135,19 @@
|
|||
<string name="my_history">History</string>
|
||||
<string name="edit">Edit</string>
|
||||
|
||||
<string name="video_settings">Video settings</string>
|
||||
<string name="app_interface">Interface</string>
|
||||
|
||||
<string name="set_video_mode_choice" translatable="false">set_video_mode_choice</string>
|
||||
<string name="set_video_minimize_choice" translatable="false">set_video_minimize_choice</string>
|
||||
<string name="set_video_language_choice" translatable="false">set_video_language_choice</string>
|
||||
<string name="set_video_quality_choice" translatable="false">set_video_quality_choice</string>
|
||||
|
||||
<string name="set_video_cache_choice" translatable="false">set_video_cache_choice</string>
|
||||
<string name="set_cache_mode">Cache</string>
|
||||
<string name="set_video_cache_description">Définir le cache pour les vidéos (défaut 100Mo)</string>
|
||||
<string name="set_video_quality_description">Define a default quality for videos</string>
|
||||
<string name="set_quality_mode">Resolution for videos</string>
|
||||
<string name="video_cache_value">Video cache: %d Mb</string>
|
||||
|
||||
<string name="captions">Captions</string>
|
||||
<string name="pickup_captions">Pick captions</string>
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M2,20h20v-4L2,16v4zM4,17h2v2L4,19v-2zM2,4v4h20L22,4L2,4zM6,7L4,7L4,5h2v2zM2,14h20v-4L2,10v4zM4,11h2v2L4,13v-2z"/>
|
||||
</vector>
|
|
@ -3,27 +3,38 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:key="app_prefs">
|
||||
<androidx.preference.ListPreference
|
||||
android:icon="@drawable/ic_baseline_slow_motion_video_24"
|
||||
android:key="@string/set_video_mode_choice"
|
||||
android:summary="@string/set_video_mode_description"
|
||||
android:title="@string/set_video_mode" />
|
||||
<PreferenceCategory android:title="@string/video_settings">
|
||||
<androidx.preference.ListPreference
|
||||
android:icon="@drawable/ic_baseline_slow_motion_video_24"
|
||||
android:key="@string/set_video_mode_choice"
|
||||
android:summary="@string/set_video_mode_description"
|
||||
android:title="@string/set_video_mode" />
|
||||
<androidx.preference.SwitchPreference
|
||||
android:icon="@drawable/ic_baseline_featured_video_24"
|
||||
android:key="@string/set_video_minimize_choice"
|
||||
android:summary="@string/set_video_minimize_description"
|
||||
android:title="@string/set_video_minimize" />
|
||||
|
||||
<androidx.preference.SwitchPreference
|
||||
android:icon="@drawable/ic_baseline_featured_video_24"
|
||||
android:key="@string/set_video_minimize_choice"
|
||||
android:summary="@string/set_video_minimize_description"
|
||||
android:title="@string/set_video_minimize" />
|
||||
<androidx.preference.ListPreference
|
||||
android:icon="@drawable/ic_baseline_high_quality_24"
|
||||
android:key="@string/set_video_quality_choice"
|
||||
android:summary="@string/set_video_quality_description"
|
||||
android:title="@string/set_quality_mode" />
|
||||
|
||||
<androidx.preference.MultiSelectListPreference
|
||||
android:icon="@drawable/ic_baseline_language_24"
|
||||
android:key="@string/set_video_language_choice"
|
||||
android:summary="@string/set_video_language_description"
|
||||
android:title="@string/set_video_language" />
|
||||
<androidx.preference.SeekBarPreference
|
||||
android:icon="@drawable/ic_baseline_storage_24"
|
||||
android:defaultValue="10"
|
||||
android:max="50"
|
||||
android:key="@string/set_video_cache_choice"
|
||||
android:summary="@string/set_video_cache_description"
|
||||
android:title="@string/set_cache_mode" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<androidx.preference.ListPreference
|
||||
android:icon="@drawable/ic_baseline_high_quality_24"
|
||||
android:key="@string/set_video_quality_choice"
|
||||
android:summary="@string/set_video_quality_description"
|
||||
android:title="@string/set_quality_mode" />
|
||||
<PreferenceCategory android:title="@string/app_interface">
|
||||
<androidx.preference.MultiSelectListPreference
|
||||
android:icon="@drawable/ic_baseline_language_24"
|
||||
android:key="@string/set_video_language_choice"
|
||||
android:summary="@string/set_video_language_description"
|
||||
android:title="@string/set_video_language" />
|
||||
</PreferenceCategory>
|
||||
</androidx.preference.PreferenceScreen>
|
Loading…
Reference in New Issue