1
0
mirror of https://github.com/etesync/android synced 2025-01-11 16:21:10 +00:00

EXDATE processing

* don't ignore the time zone of EXDATEs (fixes #495)
This commit is contained in:
Ricki Hirner 2015-05-08 17:46:10 +02:00
parent 33958ab548
commit 97633c5204

View File

@ -262,7 +262,7 @@ public class LocalCalendar extends LocalCollection<Event> {
" AND " + Events.ORIGINAL_SYNC_ID + " NOT IN (" + StringUtils.join(sqlFileNames, ",") + ")"; // retain by remote file name " AND " + Events.ORIGINAL_SYNC_ID + " NOT IN (" + StringUtils.join(sqlFileNames, ",") + ")"; // retain by remote file name
pendingOperations.add(ContentProviderOperation pendingOperations.add(ContentProviderOperation
.newDelete(entriesURI()) .newDelete(entriesURI())
.withSelection(where, new String[]{String.valueOf(id)}) .withSelection(where, new String[]{ String.valueOf(id) })
.withYieldAllowed(true) .withYieldAllowed(true)
.build() .build()
); );
@ -275,7 +275,7 @@ public class LocalCalendar extends LocalCollection<Event> {
// delete all exceptions of this event, too // delete all exceptions of this event, too
pendingOperations.add(ContentProviderOperation pendingOperations.add(ContentProviderOperation
.newDelete(entriesURI()) .newDelete(entriesURI())
.withSelection(Events.ORIGINAL_ID + "=?", new String[] { Long.toString(resource.getLocalID()) }) .withSelection(Events.ORIGINAL_ID + "=?", new String[] { String.valueOf(resource.getLocalID()) })
.build() .build()
); );
} }
@ -288,7 +288,7 @@ public class LocalCalendar extends LocalCollection<Event> {
pendingOperations.add(ContentProviderOperation pendingOperations.add(ContentProviderOperation
.newUpdate(entriesURI()) .newUpdate(entriesURI())
.withValue(Events.DIRTY, 0) .withValue(Events.DIRTY, 0)
.withSelection(Events.ORIGINAL_ID + "=?", new String[] { Long.toString(resource.getLocalID()) }) .withSelection(Events.ORIGINAL_ID + "=?", new String[]{ String.valueOf(resource.getLocalID()) })
.build() .build()
); );
} }
@ -561,15 +561,20 @@ public class LocalCalendar extends LocalCollection<Event> {
if (event.getRdate() != null) { if (event.getRdate() != null) {
recurring = true; recurring = true;
RDate rDate = event.getRdate(); RDate rDate = event.getRdate();
String rDateStr = event.getRdate().getValue(); String rDateStr = rDate.getValue();
if (rDate.getTimeZone() != null) if (rDate.getTimeZone() != null)
rDateStr = DateUtils.findAndroidTimezoneID(rDate.getTimeZone().getID()) + ";" + rDateStr; rDateStr = DateUtils.findAndroidTimezoneID(rDate.getTimeZone().getID()) + ";" + rDateStr;
builder = builder.withValue(Events.RDATE, rDateStr); builder = builder.withValue(Events.RDATE, rDateStr);
} }
if (event.getExrule() != null) if (event.getExrule() != null)
builder = builder.withValue(Events.EXRULE, event.getExrule().getValue()); builder = builder.withValue(Events.EXRULE, event.getExrule().getValue());
if (event.getExdate() != null) if (event.getExdate() != null) {
builder = builder.withValue(Events.EXDATE, event.getExdate().getValue()); ExDate exDate = event.getExdate();
String exDateStr = exDate.getValue();
if (exDate.getTimeZone() != null)
exDateStr = DateUtils.findAndroidTimezoneID(exDate.getTimeZone().getID()) + ";" + exDateStr;
builder = builder.withValue(Events.EXDATE, exDateStr);
}
// set either DTEND for single-time events or DURATION for recurring events // set either DTEND for single-time events or DURATION for recurring events
// because that's the way Android likes it (see docs) // because that's the way Android likes it (see docs)