From faca82f6e853dff5ab27425292dc542691d42245 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sun, 2 Jan 2022 14:57:39 +0100 Subject: [PATCH] fix bolus timer --- .../main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt | 2 +- app/src/main/java/info/nightscout/androidaps/utils/CarbTimer.kt | 2 +- .../java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt | 2 +- .../src/main/java/info/nightscout/androidaps/utils/TimerUtil.kt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt index 080bebd580..07f066d47c 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt @@ -348,7 +348,7 @@ class CarbsDialog : DialogFragmentWithDate() { }) } if (useAlarm && carbs > 0 && timeOffset > 0) { - carbTimer.scheduleReminder(T.mins(timeOffset.toLong()).secs()) + carbTimer.scheduleReminder(T.mins(timeOffset.toLong()).secs().toInt()) } }, null) } diff --git a/app/src/main/java/info/nightscout/androidaps/utils/CarbTimer.kt b/app/src/main/java/info/nightscout/androidaps/utils/CarbTimer.kt index 4513cb5b61..1db8839916 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/CarbTimer.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/CarbTimer.kt @@ -24,7 +24,7 @@ class CarbTimer @Inject constructor( 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)) fun scheduleEatReminder() { diff --git a/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt b/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt index e3741ec61b..d1f9321746 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt +++ b/app/src/main/java/info/nightscout/androidaps/utils/wizard/BolusWizard.kt @@ -456,7 +456,7 @@ class BolusWizard @Inject constructor( } if (useAlarm && carbs > 0 && carbTime > 0) { - carbTimer.scheduleReminder(T.mins(carbTime.toLong()).secs()) + carbTimer.scheduleReminder(T.mins(carbTime.toLong()).secs().toInt()) } } }) diff --git a/core/src/main/java/info/nightscout/androidaps/utils/TimerUtil.kt b/core/src/main/java/info/nightscout/androidaps/utils/TimerUtil.kt index c3d02f2080..cea0d146de 100644 --- a/core/src/main/java/info/nightscout/androidaps/utils/TimerUtil.kt +++ b/core/src/main/java/info/nightscout/androidaps/utils/TimerUtil.kt @@ -18,7 +18,7 @@ class TimerUtil @Inject constructor( /** * Schedule alarm in @seconds */ - fun scheduleReminder(seconds: Long, text: String) { + fun scheduleReminder(seconds: Int, text: String) { Intent(AlarmClock.ACTION_SET_TIMER).apply { flags = flags or Intent.FLAG_ACTIVITY_NEW_TASK putExtra(AlarmClock.EXTRA_LENGTH, seconds)