mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-15 06:40:30 +05:30
add toggle
This commit is contained in:
parent
458af7d7d4
commit
e7e4cf7c07
@ -455,7 +455,10 @@ class PlayerFragment : Fragment() {
|
|||||||
if (!relatedStreamsEnabled) toggleComments()
|
if (!relatedStreamsEnabled) toggleComments()
|
||||||
// prepare for autoplay
|
// prepare for autoplay
|
||||||
initAutoPlay()
|
initAutoPlay()
|
||||||
PreferenceHelper.addToWatchHistory(requireContext(), videoId!!, response)
|
val watchHistoryEnabled =
|
||||||
|
PreferenceHelper.getBoolean(requireContext(), "Watch_history_toggle", true)
|
||||||
|
if (watchHistoryEnabled)
|
||||||
|
PreferenceHelper.addToWatchHistory(requireContext(), videoId!!, response)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,12 +18,20 @@ class AdvancedSettings : PreferenceFragmentCompat() {
|
|||||||
val settingsActivity = activity as SettingsActivity
|
val settingsActivity = activity as SettingsActivity
|
||||||
settingsActivity.binding.topBarTextView.text = getString(R.string.advanced)
|
settingsActivity.binding.topBarTextView.text = getString(R.string.advanced)
|
||||||
|
|
||||||
|
// clear search history
|
||||||
val clearHistory = findPreference<Preference>("clear_history")
|
val clearHistory = findPreference<Preference>("clear_history")
|
||||||
clearHistory?.setOnPreferenceClickListener {
|
clearHistory?.setOnPreferenceClickListener {
|
||||||
PreferenceHelper.removePreference(requireContext(), "search_history")
|
PreferenceHelper.removePreference(requireContext(), "search_history")
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clear watch history
|
||||||
|
val clearWatchHistory = findPreference<Preference>("clear_watch_history")
|
||||||
|
clearWatchHistory?.setOnPreferenceClickListener {
|
||||||
|
PreferenceHelper.removePreference(requireContext(), "watch_history")
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
val resetSettings = findPreference<Preference>("reset_settings")
|
val resetSettings = findPreference<Preference>("reset_settings")
|
||||||
resetSettings?.setOnPreferenceClickListener {
|
resetSettings?.setOnPreferenceClickListener {
|
||||||
showResetDialog()
|
showResetDialog()
|
||||||
|
@ -79,7 +79,7 @@
|
|||||||
<string name="okay">OK</string>
|
<string name="okay">OK</string>
|
||||||
<string name="history">History</string>
|
<string name="history">History</string>
|
||||||
<string name="search_history">Search History</string>
|
<string name="search_history">Search History</string>
|
||||||
<string name="clear_history">Clear History</string>
|
<string name="clear_history">Clear search history</string>
|
||||||
<string name="music_songs">YT Music Songs</string>
|
<string name="music_songs">YT Music Songs</string>
|
||||||
<string name="music_videos">YT Music Videos</string>
|
<string name="music_videos">YT Music Videos</string>
|
||||||
<string name="music_albums">YT Music Albums</string>
|
<string name="music_albums">YT Music Albums</string>
|
||||||
@ -207,4 +207,5 @@
|
|||||||
<string name="deleteAccount_summary">Delete your Piped account</string>
|
<string name="deleteAccount_summary">Delete your Piped account</string>
|
||||||
<string name="account">Account</string>
|
<string name="account">Account</string>
|
||||||
<string name="restore">Restore</string>
|
<string name="restore">Restore</string>
|
||||||
|
<string name="watch_history">Watch history</string>
|
||||||
</resources>
|
</resources>
|
@ -46,6 +46,21 @@
|
|||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
<PreferenceCategory app:title="@string/watch_history">
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:icon="@drawable/ic_history_filled"
|
||||||
|
app:key="watch_history_toggle"
|
||||||
|
app:title="@string/watch_history" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:icon="@drawable/ic_trash"
|
||||||
|
app:key="clear_watch_history"
|
||||||
|
app:title="@string/clear_history" />
|
||||||
|
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory>
|
<PreferenceCategory>
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
|
Loading…
Reference in New Issue
Block a user