diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt index 2f0793f99..f213767b8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt @@ -677,12 +677,16 @@ class EventActivity : SimpleActivity() { private fun deleteEvent() { DeleteEventDialog(this, arrayListOf(mEvent.id!!), mEvent.repeatInterval > 0) { - when (it) { - DELETE_SELECTED_OCCURRENCE -> dbHelper.addEventRepeatException(mEvent.id!!, mEventOccurrenceTS, true) - DELETE_FUTURE_OCCURRENCES -> dbHelper.addEventRepeatLimit(mEvent.id!!, mEventOccurrenceTS) - DELETE_ALL_OCCURRENCES -> dbHelper.deleteEvents(arrayOf(mEvent.id.toString()), true) - } - finish() + Thread { + when (it) { + DELETE_SELECTED_OCCURRENCE -> dbHelper.addEventRepeatException(mEvent.id!!, mEventOccurrenceTS, true) + DELETE_FUTURE_OCCURRENCES -> dbHelper.addEventRepeatLimit(mEvent.id!!, mEventOccurrenceTS) + DELETE_ALL_OCCURRENCES -> dbHelper.deleteEvents(arrayOf(mEvent.id.toString()), true) + } + runOnUiThread { + finish() + } + }.start() } } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/DayEventsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/DayEventsAdapter.kt index 416bc2248..52ed3e041 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/DayEventsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/DayEventsAdapter.kt @@ -142,12 +142,16 @@ class DayEventsAdapter(activity: SimpleActivity, val events: ArrayList, r DeleteEventDialog(activity, eventIds, hasRepeatableEvent) { it -> events.removeAll(eventsToDelete) - val nonRepeatingEventIDs = eventsToDelete.asSequence().filter { it.repeatInterval == 0 }.map { it.id.toString() }.toList().toTypedArray() - activity.dbHelper.deleteEvents(nonRepeatingEventIDs, true) + Thread { + val nonRepeatingEventIDs = eventsToDelete.asSequence().filter { it.repeatInterval == 0 }.map { it.id.toString() }.toList().toTypedArray() + activity.dbHelper.deleteEvents(nonRepeatingEventIDs, true) - val repeatingEventIDs = eventsToDelete.asSequence().filter { it.repeatInterval != 0 }.map { it.id!! }.toList() - activity.handleEventDeleting(repeatingEventIDs, timestamps, it) - removeSelectedItems(positions) + val repeatingEventIDs = eventsToDelete.asSequence().filter { it.repeatInterval != 0 }.map { it.id!! }.toList() + activity.handleEventDeleting(repeatingEventIDs, timestamps, it) + activity.runOnUiThread { + removeSelectedItems(positions) + } + }.start() } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/EventListAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/EventListAdapter.kt index 77634f56e..f1c8a7820 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/EventListAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/adapters/EventListAdapter.kt @@ -206,13 +206,17 @@ class EventListAdapter(activity: SimpleActivity, var listItems: ArrayList