calendar trigger
This commit is contained in:
parent
b6bf31589a
commit
9b28aeef8b
@ -622,7 +622,7 @@ public class Trigger
|
||||
try
|
||||
{
|
||||
String[] conditions = this.getTriggerParameter2().split(Trigger.triggerParameter2Split);
|
||||
List<CalendarReceiver.CalendarEvent> calendarEvents = CalendarReceiver.readCalendarEvents(AutomationService.getInstance());
|
||||
List<CalendarReceiver.CalendarEvent> calendarEvents = CalendarReceiver.readCalendarEvents(AutomationService.getInstance(), false);
|
||||
|
||||
/*
|
||||
0 = titleDirection
|
||||
|
@ -107,7 +107,7 @@ public class CalendarReceiver extends BroadcastReceiver implements AutomationLis
|
||||
}
|
||||
}
|
||||
|
||||
public static List<CalendarEvent> readCalendarEvents(Context context)
|
||||
public static List<CalendarEvent> readCalendarEvents(Context context, boolean includePastEvents)
|
||||
{
|
||||
Cursor cursor;
|
||||
|
||||
@ -128,6 +128,8 @@ public class CalendarReceiver extends BroadcastReceiver implements AutomationLis
|
||||
|
||||
List<CalendarEvent> eventlist = new ArrayList<>();
|
||||
|
||||
Calendar now = Calendar.getInstance();
|
||||
|
||||
for (int i = 0; i < CNames.length; i++)
|
||||
{
|
||||
try
|
||||
@ -142,7 +144,9 @@ public class CalendarReceiver extends BroadcastReceiver implements AutomationLis
|
||||
event.end = Miscellaneous.calendarFromLong(Long.parseLong(cursor.getString(6)));
|
||||
event.location = cursor.getString(7);
|
||||
event.availability = cursor.getString(8);
|
||||
eventlist.add(event);
|
||||
|
||||
if(includePastEvents || event.end.getTimeInMillis() > now.getTimeInMillis())
|
||||
eventlist.add(event);
|
||||
}
|
||||
catch (Exception e)
|
||||
{}
|
||||
|
Loading…
Reference in New Issue
Block a user