Calendar trigger

This commit is contained in:
Jens 2024-01-09 22:56:42 +01:00
parent 6e566c664d
commit b38ca31df5
2 changed files with 7 additions and 7 deletions

View File

@ -46,7 +46,7 @@ public class CalendarReceiver extends BroadcastReceiver implements AutomationLis
static TimerTask timerTask = null;
static Calendar nextWakeup = null;
static AlarmManager alarmManager = null;
static boolean wakeupNeedsToBeScheduled = false;
static boolean wakeupNeedsToBeScheduledOrRescheduled = false;
public static class RuleEventPair
{
@ -94,8 +94,7 @@ public class CalendarReceiver extends BroadcastReceiver implements AutomationLis
calendarEventsCache = null;
calendarEventsReoccurringCache = null;
checkForRules(context);
armOrRearmTimer();
routineAtAlarm();
}
else if(intent.getAction().equalsIgnoreCase(calendarAlarmAction))
{
@ -466,7 +465,7 @@ public class CalendarReceiver extends BroadcastReceiver implements AutomationLis
}
// If it's now filled, go on
if(nextWakeup != null && wakeupNeedsToBeScheduled)
if(nextWakeup != null && wakeupNeedsToBeScheduledOrRescheduled)
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
{
@ -482,7 +481,7 @@ public class CalendarReceiver extends BroadcastReceiver implements AutomationLis
}
Miscellaneous.logEvent("i", "armOrRearmTimer()", "Scheduling wakeup for calendar at " + Miscellaneous.formatDate(nextWakeup.getTime()), 4);
alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, nextWakeup.getTimeInMillis(), pi);
wakeupNeedsToBeScheduled = false;
wakeupNeedsToBeScheduledOrRescheduled = false;
}
}
else
@ -543,8 +542,8 @@ public class CalendarReceiver extends BroadcastReceiver implements AutomationLis
else
Miscellaneous.logEvent("i", "calculateNextWakeupForCalendar()", "Chose " + Miscellaneous.formatDate(newAlarm.getTime()) + " as next wakeup for calendar triggers. Old was " + Miscellaneous.formatDate(nextWakeup.getTime()), 4);
nextWakeup = newAlarm;
if (!wakeupNeedsToBeScheduled)
wakeupNeedsToBeScheduled = true;
if (!wakeupNeedsToBeScheduledOrRescheduled)
wakeupNeedsToBeScheduledOrRescheduled = true;
}
else
Miscellaneous.logEvent("i", "calculateNextWakeupForCalendar()", "Alarm " + Miscellaneous.formatDate(nextWakeup.getTime()) + " has been selected as next wakeup, but not rescheduling since this was not a change.", 4);

View File

@ -180,6 +180,7 @@
android:id="@+id/rbNotificationDismissSimple"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/simplyDismissNotification" />
<RadioButton