Fix bug w/ all day events (hr, min, sec need to be zero in DTSTART)
* For some reason, the recurrence expansion system requires hr, min, and sec to be zero for DTSTART when allDay=1 * Force hr, min, and sec to zero for all day events Bug: 2427658 Change-Id: Ief6b5b571fa6bc6947bcbc9cda02ab2c04f27549
This commit is contained in:
parent
f19a02ac69
commit
e81b2bfe5e
@ -52,6 +52,7 @@ import android.util.Log;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.GregorianCalendar;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
@ -360,10 +361,17 @@ public class CalendarSyncAdapter extends AbstractSyncAdapter {
|
|||||||
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
|
||||||
if (allDayEvent != 0) {
|
if (allDayEvent != 0) {
|
||||||
cv.put(Events.DURATION, "P1D");
|
cv.put(Events.DURATION, "P1D");
|
||||||
|
GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
|
||||||
|
cal.setTimeInMillis(startTime);
|
||||||
|
cal.set(GregorianCalendar.HOUR_OF_DAY, 0);
|
||||||
|
cal.set(GregorianCalendar.MINUTE, 0);
|
||||||
|
cal.set(GregorianCalendar.SECOND, 0);
|
||||||
|
cv.put(Events.DTSTART, cal.getTimeInMillis());
|
||||||
|
cv.put(Events.ORIGINAL_INSTANCE_TIME, cal.getTimeInMillis());
|
||||||
} 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