avoid readding deleted CalDAV synced events

This commit is contained in:
tibbi 2019-06-13 11:15:59 +02:00
parent f7d25a19cc
commit ca89d5fc27
1 changed files with 7 additions and 1 deletions

View File

@ -186,7 +186,8 @@ class CalDAVHelper(val context: Context) {
CalendarContract.Events.RRULE, CalendarContract.Events.RRULE,
CalendarContract.Events.ORIGINAL_ID, CalendarContract.Events.ORIGINAL_ID,
CalendarContract.Events.ORIGINAL_INSTANCE_TIME, CalendarContract.Events.ORIGINAL_INSTANCE_TIME,
CalendarContract.Events.EVENT_LOCATION) CalendarContract.Events.EVENT_LOCATION,
CalendarContract.Events.DELETED)
val selection = "${CalendarContract.Events.CALENDAR_ID} = $calendarId" val selection = "${CalendarContract.Events.CALENDAR_ID} = $calendarId"
var cursor: Cursor? = null var cursor: Cursor? = null
@ -194,6 +195,11 @@ class CalDAVHelper(val context: Context) {
cursor = context.contentResolver.query(uri, projection, selection, null, null) cursor = context.contentResolver.query(uri, projection, selection, null, null)
if (cursor?.moveToFirst() == true) { if (cursor?.moveToFirst() == true) {
do { do {
val deleted = cursor.getIntValue(CalendarContract.Events.DELETED)
if (deleted == 1) {
continue
}
val id = cursor.getLongValue(CalendarContract.Events._ID) val id = cursor.getLongValue(CalendarContract.Events._ID)
val title = cursor.getStringValue(CalendarContract.Events.TITLE) ?: "" val title = cursor.getStringValue(CalendarContract.Events.TITLE) ?: ""
val description = cursor.getStringValue(CalendarContract.Events.DESCRIPTION) ?: "" val description = cursor.getStringValue(CalendarContract.Events.DESCRIPTION) ?: ""