fix bolus timer

This commit is contained in:
Milos Kozak 2022-01-02 14:57:39 +01:00
parent d2339f88c2
commit faca82f6e8
4 changed files with 4 additions and 4 deletions

View file

@ -348,7 +348,7 @@ class CarbsDialog : DialogFragmentWithDate() {
}) })
} }
if (useAlarm && carbs > 0 && timeOffset > 0) { if (useAlarm && carbs > 0 && timeOffset > 0) {
carbTimer.scheduleReminder(T.mins(timeOffset.toLong()).secs()) carbTimer.scheduleReminder(T.mins(timeOffset.toLong()).secs().toInt())
} }
}, null) }, null)
} }

View file

@ -24,7 +24,7 @@ class CarbTimer @Inject constructor(
private val timerUtil: TimerUtil private val timerUtil: TimerUtil
) { ) {
fun scheduleReminder(seconds: Long, text: String? = null) = fun scheduleReminder(seconds: Int, text: String? = null) =
timerUtil.scheduleReminder(seconds, text ?: rh.gs(R.string.timetoeat)) timerUtil.scheduleReminder(seconds, text ?: rh.gs(R.string.timetoeat))
fun scheduleEatReminder() { fun scheduleEatReminder() {

View file

@ -456,7 +456,7 @@ class BolusWizard @Inject constructor(
} }
if (useAlarm && carbs > 0 && carbTime > 0) { if (useAlarm && carbs > 0 && carbTime > 0) {
carbTimer.scheduleReminder(T.mins(carbTime.toLong()).secs()) carbTimer.scheduleReminder(T.mins(carbTime.toLong()).secs().toInt())
} }
} }
}) })

View file

@ -18,7 +18,7 @@ class TimerUtil @Inject constructor(
/** /**
* Schedule alarm in @seconds * Schedule alarm in @seconds
*/ */
fun scheduleReminder(seconds: Long, text: String) { fun scheduleReminder(seconds: Int, text: String) {
Intent(AlarmClock.ACTION_SET_TIMER).apply { Intent(AlarmClock.ACTION_SET_TIMER).apply {
flags = flags or Intent.FLAG_ACTIVITY_NEW_TASK flags = flags or Intent.FLAG_ACTIVITY_NEW_TASK
putExtra(AlarmClock.EXTRA_LENGTH, seconds) putExtra(AlarmClock.EXTRA_LENGTH, seconds)