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 dcb021226..7ff029ce8 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 @@ -765,7 +765,9 @@ class EventActivity : SimpleActivity() { mEvent.id = 0 } - storeEvent(wasRepeatable) + Thread { + storeEvent(wasRepeatable) + }.start() } private fun storeEvent(wasRepeatable: Boolean) { @@ -781,25 +783,8 @@ class EventActivity : SimpleActivity() { } } else { if (mRepeatInterval > 0 && wasRepeatable) { - EditRepeatingEventDialog(this) { - if (it) { - dbHelper.update(mEvent, true, this) { - finish() - } - } else { - dbHelper.addEventRepeatException(mEvent.id!!, mEventOccurrenceTS, true) - mEvent.apply { - parentId = id!!.toLong() - id = null - repeatRule = 0 - repeatInterval = 0 - repeatLimit = 0 - } - - dbHelper.insert(mEvent, true, this) { - finish() - } - } + runOnUiThread { + showEditRepeatingEventDialog() } } else { dbHelper.update(mEvent, true, this) { @@ -809,6 +794,29 @@ class EventActivity : SimpleActivity() { } } + private fun showEditRepeatingEventDialog() { + EditRepeatingEventDialog(this) { + if (it) { + dbHelper.update(mEvent, true, this) { + finish() + } + } else { + dbHelper.addEventRepeatException(mEvent.id!!, mEventOccurrenceTS, true) + mEvent.apply { + parentId = id!!.toLong() + id = null + repeatRule = 0 + repeatInterval = 0 + repeatLimit = 0 + } + + dbHelper.insert(mEvent, true, this) { + finish() + } + } + } + } + private fun updateStartTexts() { updateStartDateText() updateStartTimeText()