handle event fetching at EventActivity on a background thread

This commit is contained in:
tibbi 2018-11-11 23:06:38 +01:00
parent e3decbe1b6
commit 7a6d48d9db
1 changed files with 9 additions and 2 deletions

View File

@ -64,9 +64,16 @@ class EventActivity : SimpleActivity() {
val intent = intent ?: return
mDialogTheme = getDialogTheme()
val eventId = intent.getLongExtra(EVENT_ID, 0)
val event = dbHelper.getEventWithId(eventId)
val eventId = intent.getLongExtra(EVENT_ID, 0L)
Thread {
val event = dbHelper.getEventWithId(eventId)
runOnUiThread {
gotEvent(savedInstanceState, eventId, event)
}
}.start()
}
private fun gotEvent(savedInstanceState: Bundle?, eventId: Long, event: Event?) {
if (eventId != 0L && event == null) {
finish()
return