fix EditQuickWizardDialog

This commit is contained in:
Milos Kozak 2021-11-07 21:57:10 +01:00
parent 22eb524556
commit 2b20aa3e38
2 changed files with 5 additions and 5 deletions

View file

@ -100,19 +100,19 @@ class EditQuickWizardDialog : DaggerDialogFragment(), View.OnClickListener {
val toTimeSetListener = TimePickerDialog.OnTimeSetListener { _, hour, minute -> val toTimeSetListener = TimePickerDialog.OnTimeSetListener { _, hour, minute ->
toSeconds = (T.hours(hour.toLong()).secs() + T.mins(minute.toLong()).secs()).toInt() toSeconds = (T.hours(hour.toLong()).secs() + T.mins(minute.toLong()).secs()).toInt()
binding.from.text = dateUtil.timeString(dateUtil.secondsOfTheDayToMilliseconds(toSeconds)) binding.to.text = dateUtil.timeString(dateUtil.secondsOfTheDayToMilliseconds(toSeconds))
} }
binding.to.setOnClickListener { binding.to.setOnClickListener {
context?.let { context?.let {
TimePickerDialog(it, toTimeSetListener, TimePickerDialog(it, toTimeSetListener,
T.secs(fromSeconds.toLong()).hours().toInt(), T.secs(toSeconds.toLong()).hours().toInt(),
T.secs((fromSeconds % 3600).toLong()).mins().toInt(), T.secs((toSeconds % 3600).toLong()).mins().toInt(),
DateFormat.is24HourFormat(context) DateFormat.is24HourFormat(context)
).show() ).show()
} }
} }
toSeconds = entry.validFrom() toSeconds = entry.validTo()
binding.to.text = dateUtil.timeString(dateUtil.secondsOfTheDayToMilliseconds(toSeconds)) binding.to.text = dateUtil.timeString(dateUtil.secondsOfTheDayToMilliseconds(toSeconds))
binding.buttonEdit.setText(entry.buttonText()) binding.buttonEdit.setText(entry.buttonText())

View file

@ -132,7 +132,7 @@ class QuickWizardEntry @Inject constructor(private val injector: HasAndroidInjec
fun validFrom(): Int = safeGetInt(storage, "validFrom") fun validFrom(): Int = safeGetInt(storage, "validFrom")
private fun validTo(): Int = safeGetInt(storage, "validTo") fun validTo(): Int = safeGetInt(storage, "validTo")
fun useBG(): Int = safeGetInt(storage, "useBG", YES) fun useBG(): Int = safeGetInt(storage, "useBG", YES)