mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +05:30
commit
7f3967d6bc
@ -797,6 +797,11 @@ class PlayerFragment : Fragment() {
|
||||
.build()
|
||||
|
||||
exoPlayer.setAudioAttributes(audioAttributes, true)
|
||||
|
||||
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireContext())
|
||||
val playbackSpeed = sharedPreferences.getString("playback_speed", "1F")?.toFloat()
|
||||
exoPlayer.setPlaybackSpeed(playbackSpeed!!)
|
||||
|
||||
initializePlayerNotification(requireContext())
|
||||
}
|
||||
|
||||
|
@ -9,11 +9,19 @@ import androidx.preference.PreferenceFragmentCompat
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.github.libretube.R
|
||||
|
||||
class DownloadSettings : PreferenceFragmentCompat() {
|
||||
val TAG = "DownloadSettings"
|
||||
class AdvancedSettings : PreferenceFragmentCompat() {
|
||||
val TAG = "AdvancedSettings"
|
||||
private val directoryRequestCode = 9999
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
setPreferencesFromResource(R.xml.download_settings, rootKey)
|
||||
setPreferencesFromResource(R.xml.advanced_settings, rootKey)
|
||||
|
||||
val clearHistory = findPreference<Preference>("clear_history")
|
||||
clearHistory?.setOnPreferenceClickListener {
|
||||
val sharedPreferences =
|
||||
PreferenceManager.getDefaultSharedPreferences(requireContext())
|
||||
sharedPreferences.edit().remove("search_history").commit()
|
||||
true
|
||||
}
|
||||
|
||||
// doesn't work yet
|
||||
val directory = findPreference<Preference>("download_directory")
|
@ -1,23 +0,0 @@
|
||||
package com.github.libretube.preferences
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.github.libretube.R
|
||||
|
||||
class HistorySettings : PreferenceFragmentCompat() {
|
||||
private val TAG = "HistorySettings"
|
||||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
setPreferencesFromResource(R.xml.history_settings, rootKey)
|
||||
|
||||
val clearHistory = findPreference<Preference>("clear_history")
|
||||
clearHistory?.setOnPreferenceClickListener {
|
||||
val sharedPreferences =
|
||||
PreferenceManager.getDefaultSharedPreferences(requireContext())
|
||||
sharedPreferences.edit().remove("search_history").commit()
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
@ -149,6 +149,13 @@ class MainSettings : PreferenceFragmentCompat() {
|
||||
true
|
||||
}
|
||||
|
||||
val appearance = findPreference<Preference>("appearance")
|
||||
appearance?.setOnPreferenceClickListener {
|
||||
val newFragment = AppearanceSettings()
|
||||
navigateSettings(newFragment)
|
||||
true
|
||||
}
|
||||
|
||||
val sponsorblock = findPreference<Preference>("sponsorblock")
|
||||
sponsorblock?.setOnPreferenceClickListener {
|
||||
val newFragment = SponsorBlockSettings()
|
||||
@ -156,23 +163,9 @@ class MainSettings : PreferenceFragmentCompat() {
|
||||
true
|
||||
}
|
||||
|
||||
val downloads = findPreference<Preference>("downloads")
|
||||
downloads?.setOnPreferenceClickListener {
|
||||
val newFragment = DownloadSettings()
|
||||
navigateSettings(newFragment)
|
||||
true
|
||||
}
|
||||
|
||||
val history = findPreference<Preference>("history")
|
||||
history?.setOnPreferenceClickListener {
|
||||
val newFragment = HistorySettings()
|
||||
navigateSettings(newFragment)
|
||||
true
|
||||
}
|
||||
|
||||
val appearance = findPreference<Preference>("appearance")
|
||||
appearance?.setOnPreferenceClickListener {
|
||||
val newFragment = AppearanceSettings()
|
||||
val advanced = findPreference<Preference>("advanced")
|
||||
advanced?.setOnPreferenceClickListener {
|
||||
val newFragment = AdvancedSettings()
|
||||
navigateSettings(newFragment)
|
||||
true
|
||||
}
|
||||
|
@ -1,10 +1,11 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:autoMirrored="true"
|
||||
android:tint="?android:attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M4,14h4v-4L4,10v4zM4,19h4v-4L4,15v4zM4,9h4L8,5L4,5v4zM9,14h12v-4L9,10v4zM9,19h12v-4L9,15v4zM9,5v4h12L21,5L9,5z" />
|
||||
android:pathData="M4,10.5c-0.83,0 -1.5,0.67 -1.5,1.5s0.67,1.5 1.5,1.5 1.5,-0.67 1.5,-1.5 -0.67,-1.5 -1.5,-1.5zM4,4.5c-0.83,0 -1.5,0.67 -1.5,1.5S3.17,7.5 4,7.5 5.5,6.83 5.5,6 4.83,4.5 4,4.5zM4,16.5c-0.83,0 -1.5,0.68 -1.5,1.5s0.68,1.5 1.5,1.5 1.5,-0.68 1.5,-1.5 -0.67,-1.5 -1.5,-1.5zM7,19h14v-2L7,17v2zM7,13h14v-2L7,11v2zM7,5v2h14L21,5L7,5z" />
|
||||
</vector>
|
||||
|
@ -610,4 +610,24 @@
|
||||
<item>.mkv</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="playbackSpeed">
|
||||
<item>0.25x</item>
|
||||
<item>0.5x</item>
|
||||
<item>0.75x</item>
|
||||
<item>1x</item>
|
||||
<item>1.25x</item>
|
||||
<item>1.5x</item>
|
||||
<item>2x</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="playbackSpeedValues">
|
||||
<item>0.25F</item>
|
||||
<item>0.5F</item>
|
||||
<item>0.75F</item>
|
||||
<item>1F</item>
|
||||
<item>1.25F</item>
|
||||
<item>1.5F</item>
|
||||
<item>2F</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
@ -45,7 +45,7 @@
|
||||
<string name="empty">You have to enter a username and password.</string>
|
||||
<string name="notgmail">This is not your Gmail account.</string>
|
||||
<string name="defres">Default video resolution</string>
|
||||
<string name="grid">Choose grid columns</string>
|
||||
<string name="grid">Grid columns</string>
|
||||
<string name="emptyList">Nothing here.</string>
|
||||
<string name="deletePlaylist">Delete playlist</string>
|
||||
<string name="areYouSure">Delete the playlist?</string>
|
||||
@ -135,4 +135,9 @@
|
||||
<string name="update_summary">Click here to check whether there\'s a new app update available.</string>
|
||||
<string name="app_uptodate">App up to date</string>
|
||||
<string name="no_update_available">There\'s currently no new update available. Stay tuned!</string>
|
||||
<string name="playback_speed">Default playback speed</string>
|
||||
<string name="advanced">Advanced</string>
|
||||
<string name="player">Player</string>
|
||||
<string name="appearance_summary">Make the app look how you want to.</string>
|
||||
<string name="advanced_summary">Player, Downloads, History</string>
|
||||
</resources>
|
63
app/src/main/res/xml/advanced_settings.xml
Normal file
63
app/src/main/res/xml/advanced_settings.xml
Normal file
@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto" >
|
||||
|
||||
<PreferenceCategory app:title="@string/player">
|
||||
|
||||
<ListPreference
|
||||
app:title="@string/defres"
|
||||
app:key="default_res"
|
||||
app:entries="@array/defres"
|
||||
app:entryValues="@array/defresValue"
|
||||
app:defaultValue=""
|
||||
android:icon="@drawable/ic_hd"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
<ListPreference
|
||||
app:title="@string/playback_speed"
|
||||
app:key="playback_speed"
|
||||
app:entries="@array/playbackSpeed"
|
||||
app:entryValues="@array/playbackSpeedValues"
|
||||
app:defaultValue="1F"
|
||||
android:icon="@drawable/ic_play"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory app:title="@string/downloads">
|
||||
|
||||
<ListPreference
|
||||
app:key="video_format"
|
||||
app:title="@string/video_format"
|
||||
app:entries="@array/videoFormats"
|
||||
app:entryValues="@array/videoFormatsValues"
|
||||
app:defaultValue=".mp4"
|
||||
app:summary="@string/video_format_summary"
|
||||
app:icon="@drawable/ic_videocam" />
|
||||
|
||||
<!--
|
||||
<Preference
|
||||
app:key="download_directory"
|
||||
app:title="@string/download_directory"
|
||||
app:summary="@string/download_directory_summary"
|
||||
app:icon="@drawable/ic_folder" />
|
||||
-->
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory app:title="@string/search_history">
|
||||
|
||||
<SwitchPreference
|
||||
app:title="@string/search_history"
|
||||
app:key="search_history_toggle"
|
||||
android:defaultValue="true"
|
||||
android:icon="@drawable/ic_history" />
|
||||
|
||||
<Preference
|
||||
app:title="@string/clear_history"
|
||||
app:key="clear_history"
|
||||
android:icon="@drawable/ic_delete" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
@ -10,7 +10,8 @@
|
||||
app:entries="@array/themes"
|
||||
app:entryValues="@array/themesValue"
|
||||
app:defaultValue="A"
|
||||
android:icon="@drawable/ic_theme" />
|
||||
android:icon="@drawable/ic_theme"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
<ListPreference
|
||||
app:title="@string/color_accent"
|
||||
@ -18,7 +19,8 @@
|
||||
app:entries="@array/accents"
|
||||
app:entryValues="@array/accentsValue"
|
||||
app:defaultValue="red"
|
||||
android:icon="@drawable/ic_color" />
|
||||
android:icon="@drawable/ic_color"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
<ListPreference
|
||||
app:title="@string/app_icon"
|
||||
@ -26,7 +28,8 @@
|
||||
app:entries="@array/icons"
|
||||
app:entryValues="@array/iconsValue"
|
||||
app:defaultValue="MainActivity"
|
||||
android:icon="@drawable/ic_frame" />
|
||||
android:icon="@drawable/ic_frame"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
@ -38,15 +41,7 @@
|
||||
app:entries="@array/tabs"
|
||||
app:entryValues="@array/tabsValue"
|
||||
app:defaultValue="home"
|
||||
android:icon="@drawable/ic_home_outlined" />
|
||||
|
||||
<ListPreference
|
||||
app:title="@string/defres"
|
||||
app:key="default_res"
|
||||
app:entries="@array/defres"
|
||||
app:entryValues="@array/defresValue"
|
||||
app:defaultValue=""
|
||||
android:icon="@drawable/ic_hd"
|
||||
android:icon="@drawable/ic_home_outlined"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
<ListPreference
|
||||
|
@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<PreferenceCategory app:title="@string/downloads">
|
||||
|
||||
<ListPreference
|
||||
app:key="video_format"
|
||||
app:title="@string/video_format"
|
||||
app:entries="@array/videoFormats"
|
||||
app:entryValues="@array/videoFormatsValues"
|
||||
app:defaultValue=".mp4"
|
||||
app:summary="@string/video_format_summary"
|
||||
app:icon="@drawable/ic_videocam" />
|
||||
|
||||
<!--
|
||||
<Preference
|
||||
app:key="download_directory"
|
||||
app:title="@string/download_directory"
|
||||
app:summary="@string/download_directory_summary"
|
||||
app:icon="@drawable/ic_folder" />
|
||||
-->
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<PreferenceCategory app:title="@string/search_history">
|
||||
|
||||
<SwitchPreference
|
||||
app:title="@string/search_history"
|
||||
app:key="search_history_toggle"
|
||||
android:defaultValue="true"
|
||||
android:icon="@drawable/ic_history" />
|
||||
|
||||
<Preference
|
||||
app:title="@string/clear_history"
|
||||
app:key="clear_history"
|
||||
android:icon="@drawable/ic_delete" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
@ -59,6 +59,7 @@
|
||||
<Preference
|
||||
app:key="appearance"
|
||||
app:title="@string/appearance"
|
||||
app:summary="@string/appearance_summary"
|
||||
android:icon="@drawable/ic_color" />
|
||||
|
||||
<Preference
|
||||
@ -68,14 +69,10 @@
|
||||
android:icon="@drawable/ic_block" />
|
||||
|
||||
<Preference
|
||||
app:title="@string/downloads"
|
||||
app:key="downloads"
|
||||
android:icon="@drawable/ic_file_download" />
|
||||
|
||||
<Preference
|
||||
app:key="history"
|
||||
app:title="@string/history"
|
||||
android:icon="@drawable/ic_history" />
|
||||
app:key="advanced"
|
||||
app:title="@string/advanced"
|
||||
app:summary="@string/advanced_summary"
|
||||
android:icon="@drawable/ic_list" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user