Skip to content
Snippets Groups Projects
Commit e865f10c authored by Nicolas Pomepuy's avatar Nicolas Pomepuy
Browse files

Save and restore the sleep timer reset interaction checkbox state

parent 7e0a7294
No related branches found
No related tags found
1 merge request!1909Time picker
......@@ -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"
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment