[Android] Save and restore the sleep timer reset interaction checkbox state
Nicolas Pomepuy
git at videolan.org
Tue Jun 11 14:50:38 UTC 2024
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed May 29 11:12:08 2024 +0200| [e865f10c99dd331f617300b2ec655afc0f8c7f20] | committer: Nicolas Pomepuy
Save and restore the sleep timer reset interaction checkbox state
> https://code.videolan.org/videolan/vlc-android/commit/e865f10c99dd331f617300b2ec655afc0f8c7f20
---
application/tools/src/main/java/org/videolan/tools/Settings.kt | 1 +
.../vlc-android/src/org/videolan/vlc/gui/dialogs/SleepTimerDialog.kt | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/application/tools/src/main/java/org/videolan/tools/Settings.kt b/application/tools/src/main/java/org/videolan/tools/Settings.kt
index 85e466ff5a..7afb9904cd 100644
--- a/application/tools/src/main/java/org/videolan/tools/Settings.kt
+++ b/application/tools/src/main/java/org/videolan/tools/Settings.kt
@@ -217,6 +217,7 @@ const val WIDGETS_FOREGROUND_LAST_COLORS = "widgets_foreground_last_colors"
const val CUSTOM_POPUP_HEIGHT = "custom_popup_height"
const val SLEEP_TIMER_WAIT = "sleep_timer_wait"
+const val SLEEP_TIMER_RESET_INTERACTION = "sleep_timer_reset_interaction"
const val NOTIFICATION_PERMISSION_ASKED = "notification_permission_asked"
const val PLAYLIST_REPLACE = "playlist_replace"
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/SleepTimerDialog.kt b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/SleepTimerDialog.kt
index cf69929a09..f4113b204a 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/SleepTimerDialog.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/SleepTimerDialog.kt
@@ -29,6 +29,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.CheckBox
+import org.videolan.tools.SLEEP_TIMER_RESET_INTERACTION
import org.videolan.tools.SLEEP_TIMER_WAIT
import org.videolan.tools.Settings
import org.videolan.tools.putSingle
@@ -55,11 +56,15 @@ class SleepTimerDialog : PickTimeFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.timPicWaitCheckbox.isChecked = settings.getBoolean(SLEEP_TIMER_WAIT, false)
+ binding.timPicResetCheckbox.isChecked = settings.getBoolean(SLEEP_TIMER_RESET_INTERACTION, false)
}
override fun executeAction() {
playlistModel.service?.waitForMediaEnd = binding.timPicWaitCheckbox.isChecked
playlistModel.service?.resetOnInteraction = binding.timPicResetCheckbox.isChecked
+
+ val settings = Settings.getInstance(requireActivity())
+ settings.putSingle(SLEEP_TIMER_RESET_INTERACTION, binding.timPicResetCheckbox.isChecked)
settings.putSingle(SLEEP_TIMER_WAIT, binding.timPicWaitCheckbox.isChecked)
val hours = if (hours != "") java.lang.Long.parseLong(hours) * HOURS_IN_MICROS else 0L
More information about the Android
mailing list