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 e76ca0d09..64c0fa298 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 @@ -167,7 +167,7 @@ class EventActivity : SimpleActivity() { override fun onOptionsItemSelected(item: MenuItem): Boolean { when (item.itemId) { - R.id.save -> saveEvent() + R.id.save -> saveCurrentEvent() R.id.delete -> deleteEvent() R.id.duplicate -> duplicateEvent() R.id.share -> shareEvent() @@ -647,17 +647,21 @@ class EventActivity : SimpleActivity() { } else { event_caldav_calendar_email.text = currentCalendar.accountName - val calendarColor = dbHelper.getEventTypeWithCalDAVCalendarId(currentCalendar.id)?.color ?: currentCalendar.color - event_caldav_calendar_color.setFillWithStroke(calendarColor, config.backgroundColor) + Thread { + val calendarColor = dbHelper.getEventTypeWithCalDAVCalendarId(currentCalendar.id)?.color ?: currentCalendar.color + runOnUiThread { + event_caldav_calendar_color.setFillWithStroke(calendarColor, config.backgroundColor) - event_caldav_calendar_name.apply { - text = currentCalendar.displayName - setPadding(paddingLeft, paddingTop, paddingRight, resources.getDimension(R.dimen.tiny_margin).toInt()) - } + event_caldav_calendar_name.apply { + text = currentCalendar.displayName + setPadding(paddingLeft, paddingTop, paddingRight, resources.getDimension(R.dimen.tiny_margin).toInt()) + } - event_caldav_calendar_holder.apply { - setPadding(paddingLeft, 0, paddingRight, 0) - } + event_caldav_calendar_holder.apply { + setPadding(paddingLeft, 0, paddingRight, 0) + } + } + }.start() } } @@ -692,6 +696,12 @@ class EventActivity : SimpleActivity() { finish() } + private fun saveCurrentEvent() { + Thread { + saveEvent() + }.start() + } + private fun saveEvent() { val newTitle = event_title.value if (newTitle.isEmpty()) { @@ -765,9 +775,7 @@ class EventActivity : SimpleActivity() { mEvent.id = 0 } - Thread { - storeEvent(wasRepeatable) - }.start() + storeEvent(wasRepeatable) } private fun storeEvent(wasRepeatable: Boolean) { diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/dialogs/SelectEventCalendarDialog.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/dialogs/SelectEventCalendarDialog.kt index 7ea673d7a..7c27909a7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/dialogs/SelectEventCalendarDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/dialogs/SelectEventCalendarDialog.kt @@ -27,13 +27,15 @@ class SelectEventCalendarDialog(val activity: Activity, val calendars: List