Merge commit '401ae927e62a237f76c7dd1dde83f4ff8f27be91' into kraken * commit '401ae927e62a237f76c7dd1dde83f4ff8f27be91': Store all day events w/ UTC timezone
This commit is contained in:
commit
64bd62f46f
@ -108,6 +108,8 @@ public class CalendarSyncAdapter extends AbstractSyncAdapter {
|
|||||||
|
|
||||||
private static final Object sSyncKeyLock = new Object();
|
private static final Object sSyncKeyLock = new Object();
|
||||||
|
|
||||||
|
private static final TimeZone UTC_TIMEZONE = TimeZone.getTimeZone("UTC");
|
||||||
|
|
||||||
private long mCalendarId = -1;
|
private long mCalendarId = -1;
|
||||||
private String mCalendarIdString;
|
private String mCalendarIdString;
|
||||||
private String[] mCalendarIdArgument;
|
private String[] mCalendarIdArgument;
|
||||||
@ -439,21 +441,32 @@ public class CalendarSyncAdapter extends AbstractSyncAdapter {
|
|||||||
ops.newExtendedProperty("attendees", sb.toString());
|
ops.newExtendedProperty("attendees", sb.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean hasRrule = cv.containsKey(Events.RRULE);
|
||||||
// If there's no recurrence, set DTEND to the end time
|
// If there's no recurrence, set DTEND to the end time
|
||||||
if (!cv.containsKey(Events.RRULE)) {
|
if (!hasRrule) {
|
||||||
cv.put(Events.DTEND, endTime);
|
cv.put(Events.DTEND, endTime);
|
||||||
cv.put(Events.LAST_DATE, endTime);
|
cv.put(Events.LAST_DATE, endTime);
|
||||||
}
|
}
|
||||||
// Set the DURATION using rfc2445
|
// Set the DURATION using rfc2445
|
||||||
// For all day events, make sure hour, minute, and second are zero for DTSTART
|
// For all day events, make sure hour, minute, and second are zero for DTSTART/DTEND
|
||||||
if (allDayEvent != 0) {
|
if (allDayEvent != 0) {
|
||||||
cv.put(Events.DURATION, "P1D");
|
GregorianCalendar cal = new GregorianCalendar(UTC_TIMEZONE);
|
||||||
GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
|
|
||||||
cal.setTimeInMillis(startTime);
|
cal.setTimeInMillis(startTime);
|
||||||
cal.set(GregorianCalendar.HOUR_OF_DAY, 0);
|
cal.set(GregorianCalendar.HOUR_OF_DAY, 0);
|
||||||
cal.set(GregorianCalendar.MINUTE, 0);
|
cal.set(GregorianCalendar.MINUTE, 0);
|
||||||
cal.set(GregorianCalendar.SECOND, 0);
|
cal.set(GregorianCalendar.SECOND, 0);
|
||||||
cv.put(Events.DTSTART, cal.getTimeInMillis());
|
cv.put(Events.DTSTART, cal.getTimeInMillis());
|
||||||
|
// Use DURATION w/ recurrences; otherwise DTEND
|
||||||
|
if (!hasRrule) {
|
||||||
|
cal.setTimeInMillis(endTime);
|
||||||
|
cal.set(GregorianCalendar.HOUR_OF_DAY, 0);
|
||||||
|
cal.set(GregorianCalendar.MINUTE, 0);
|
||||||
|
cal.set(GregorianCalendar.SECOND, 0);
|
||||||
|
cv.put(Events.DTEND, cal.getTimeInMillis());
|
||||||
|
} else {
|
||||||
|
cv.put(Events.DURATION, "P" + ((endTime - startTime) / DAYS) + "D");
|
||||||
|
}
|
||||||
|
cv.put(Events.EVENT_TIMEZONE, UTC_TIMEZONE.getID());
|
||||||
} else {
|
} else {
|
||||||
cv.put(Events.DURATION, "P" + ((endTime - startTime) / MINUTES) + "M");
|
cv.put(Events.DURATION, "P" + ((endTime - startTime) / MINUTES) + "M");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user