diff --git a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt index d3130372c..16495a5c3 100644 --- a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt @@ -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()) } diff --git a/app/src/main/java/com/github/libretube/preferences/DownloadSettings.kt b/app/src/main/java/com/github/libretube/preferences/AdvancedSettings.kt similarity index 79% rename from app/src/main/java/com/github/libretube/preferences/DownloadSettings.kt rename to app/src/main/java/com/github/libretube/preferences/AdvancedSettings.kt index fbb31ef34..32c8b0e3b 100644 --- a/app/src/main/java/com/github/libretube/preferences/DownloadSettings.kt +++ b/app/src/main/java/com/github/libretube/preferences/AdvancedSettings.kt @@ -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("clear_history") + clearHistory?.setOnPreferenceClickListener { + val sharedPreferences = + PreferenceManager.getDefaultSharedPreferences(requireContext()) + sharedPreferences.edit().remove("search_history").commit() + true + } // doesn't work yet val directory = findPreference("download_directory") diff --git a/app/src/main/java/com/github/libretube/preferences/HistorySettings.kt b/app/src/main/java/com/github/libretube/preferences/HistorySettings.kt deleted file mode 100644 index b8d889ccb..000000000 --- a/app/src/main/java/com/github/libretube/preferences/HistorySettings.kt +++ /dev/null @@ -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("clear_history") - clearHistory?.setOnPreferenceClickListener { - val sharedPreferences = - PreferenceManager.getDefaultSharedPreferences(requireContext()) - sharedPreferences.edit().remove("search_history").commit() - true - } - } -} diff --git a/app/src/main/java/com/github/libretube/preferences/MainSettings.kt b/app/src/main/java/com/github/libretube/preferences/MainSettings.kt index 8ab101257..04bb1d33d 100644 --- a/app/src/main/java/com/github/libretube/preferences/MainSettings.kt +++ b/app/src/main/java/com/github/libretube/preferences/MainSettings.kt @@ -149,6 +149,13 @@ class MainSettings : PreferenceFragmentCompat() { true } + val appearance = findPreference("appearance") + appearance?.setOnPreferenceClickListener { + val newFragment = AppearanceSettings() + navigateSettings(newFragment) + true + } + val sponsorblock = findPreference("sponsorblock") sponsorblock?.setOnPreferenceClickListener { val newFragment = SponsorBlockSettings() @@ -156,23 +163,9 @@ class MainSettings : PreferenceFragmentCompat() { true } - val downloads = findPreference("downloads") - downloads?.setOnPreferenceClickListener { - val newFragment = DownloadSettings() - navigateSettings(newFragment) - true - } - - val history = findPreference("history") - history?.setOnPreferenceClickListener { - val newFragment = HistorySettings() - navigateSettings(newFragment) - true - } - - val appearance = findPreference("appearance") - appearance?.setOnPreferenceClickListener { - val newFragment = AppearanceSettings() + val advanced = findPreference("advanced") + advanced?.setOnPreferenceClickListener { + val newFragment = AdvancedSettings() navigateSettings(newFragment) true } diff --git a/app/src/main/res/drawable/ic_list.xml b/app/src/main/res/drawable/ic_list.xml index f5811370e..c46cab24a 100644 --- a/app/src/main/res/drawable/ic_list.xml +++ b/app/src/main/res/drawable/ic_list.xml @@ -1,10 +1,11 @@ + android:viewportHeight="24"> + 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" /> diff --git a/app/src/main/res/values/array.xml b/app/src/main/res/values/array.xml index fb04e20cf..2c1a154b4 100644 --- a/app/src/main/res/values/array.xml +++ b/app/src/main/res/values/array.xml @@ -610,4 +610,24 @@ .mkv + + 0.25x + 0.5x + 0.75x + 1x + 1.25x + 1.5x + 2x + + + + 0.25F + 0.5F + 0.75F + 1F + 1.25F + 1.5F + 2F + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f73990d14..c30bf7fa6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -45,7 +45,7 @@ You have to enter a username and password. This is not your Gmail account. Default video resolution - Choose grid columns + Grid columns Nothing here. Delete playlist Delete the playlist? @@ -135,4 +135,9 @@ Click here to check whether there\'s a new app update available. App up to date There\'s currently no new update available. Stay tuned! + Default playback speed + Advanced + Player + Make the app look how you want to. + Player, Downloads, History \ No newline at end of file diff --git a/app/src/main/res/xml/advanced_settings.xml b/app/src/main/res/xml/advanced_settings.xml new file mode 100644 index 000000000..733c05ef7 --- /dev/null +++ b/app/src/main/res/xml/advanced_settings.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/appearance_settings.xml b/app/src/main/res/xml/appearance_settings.xml index 1714cc342..d8b27372a 100644 --- a/app/src/main/res/xml/appearance_settings.xml +++ b/app/src/main/res/xml/appearance_settings.xml @@ -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" /> + android:icon="@drawable/ic_color" + app:useSimpleSummaryProvider="true" /> + android:icon="@drawable/ic_frame" + app:useSimpleSummaryProvider="true" /> @@ -38,15 +41,7 @@ app:entries="@array/tabs" app:entryValues="@array/tabsValue" app:defaultValue="home" - android:icon="@drawable/ic_home_outlined" /> - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/xml/history_settings.xml b/app/src/main/res/xml/history_settings.xml deleted file mode 100644 index 5a3fd2deb..000000000 --- a/app/src/main/res/xml/history_settings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - diff --git a/app/src/main/res/xml/settings.xml b/app/src/main/res/xml/settings.xml index 50651364e..8a9a59986 100644 --- a/app/src/main/res/xml/settings.xml +++ b/app/src/main/res/xml/settings.xml @@ -59,6 +59,7 @@ - - + app:key="advanced" + app:title="@string/advanced" + app:summary="@string/advanced_summary" + android:icon="@drawable/ic_list" />