From e3decbe1b615ba377d94d67ffd376ed985192dec Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 11 Nov 2018 22:42:32 +0100 Subject: [PATCH] use a background thread for deleting CalDAV events after disabling sync --- .../calendar/pro/activities/SettingsActivity.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt index 8249e94b8..b996a37ac 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt @@ -182,10 +182,13 @@ class SettingsActivity : SimpleActivity() { config.caldavSync = false settings_manage_synced_calendars_holder.beGone() settings_caldav_pull_to_refresh_holder.beGone() - config.getSyncedCalendarIdsAsList().forEach { - CalDAVHandler(applicationContext).deleteCalDAVCalendarEvents(it.toLong()) - } - dbHelper.deleteEventTypesWithCalendarId(config.caldavSyncedCalendarIDs) + + Thread { + config.getSyncedCalendarIdsAsList().forEach { + CalDAVHandler(applicationContext).deleteCalDAVCalendarEvents(it.toLong()) + } + dbHelper.deleteEventTypesWithCalendarId(config.caldavSyncedCalendarIDs) + }.start() } }