Fix timeout switch

This commit is contained in:
J-Jamet
2021-09-01 18:51:18 +02:00
parent 9102217bc3
commit 9c72b4cc56
2 changed files with 5 additions and 0 deletions

View File

@@ -125,6 +125,7 @@ class DurationDialogFragmentCompat : InputPreferenceDialogFragmentCompat() {
} }
} }
mEnabled = isSwitchActivated()
setSwitchAction({ isChecked -> setSwitchAction({ isChecked ->
mEnabled = isChecked mEnabled = isChecked
}, mDays + mHours + mMinutes + mSeconds > 0) }, mDays + mHours + mMinutes + mSeconds > 0)

View File

@@ -155,6 +155,10 @@ abstract class InputPreferenceDialogFragmentCompat : PreferenceDialogFragmentCom
} }
} }
fun isSwitchActivated(): Boolean {
return switchElementView?.isChecked == true
}
fun activateSwitch() { fun activateSwitch() {
if (switchElementView?.isChecked != true) if (switchElementView?.isChecked != true)
switchElementView?.isChecked = true switchElementView?.isChecked = true