mirror of
https://github.com/SimpleMobileTools/Simple-Clock.git
synced 2025-03-05 20:18:16 +01:00
Moved stuff from one line
This commit is contained in:
parent
7af2a25fa8
commit
1b39d7a892
@ -145,7 +145,11 @@ fun Context.setupAlarmClock(alarm: Alarm, triggerInSeconds: Int) {
|
|||||||
AlarmManagerCompat.setAlarmClock(alarmManager, targetMS, getOpenAlarmTabIntent(), getAlarmIntent(alarm))
|
AlarmManagerCompat.setAlarmClock(alarmManager, targetMS, getOpenAlarmTabIntent(), getAlarmIntent(alarm))
|
||||||
|
|
||||||
// Trigger a notification to dismiss the alarm 5 minutes before the alarm if the screen is on
|
// Trigger a notification to dismiss the alarm 5 minutes before the alarm if the screen is on
|
||||||
val dismissalTriggerTime = if (targetMS - System.currentTimeMillis() < (5.minutes.inWholeMilliseconds))(System.currentTimeMillis() + 500) else targetMS - (5.minutes.inWholeMilliseconds)
|
val dismissalTriggerTime = if (targetMS - System.currentTimeMillis() < (5.minutes.inWholeMilliseconds)) {
|
||||||
|
(System.currentTimeMillis() + 500)
|
||||||
|
} else {
|
||||||
|
targetMS - (5.minutes.inWholeMilliseconds)
|
||||||
|
}
|
||||||
AlarmManagerCompat.setExactAndAllowWhileIdle(alarmManager, 0, dismissalTriggerTime, getEarlyAlarmDismissalIntent(alarm))
|
AlarmManagerCompat.setExactAndAllowWhileIdle(alarmManager, 0, dismissalTriggerTime, getEarlyAlarmDismissalIntent(alarm))
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
showErrorToast(e)
|
showErrorToast(e)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user