avoid fetching event attendees on the main thread

This commit is contained in:
tibbi 2020-11-03 17:36:30 +01:00
parent 499cf50c4c
commit 711a26dbfc

View file

@ -528,11 +528,9 @@ class EventActivity : SimpleActivity() {
private fun checkAttendees() {
ensureBackgroundThread {
fillAvailableContacts()
runOnUiThread {
updateAttendees()
}
}
}
private fun handleNotificationAvailability(callback: () -> Unit) {
if (NotificationManagerCompat.from(applicationContext).areNotificationsEnabled()) {
@ -1357,6 +1355,7 @@ class EventActivity : SimpleActivity() {
{ it.status })
mAttendees.reverse()
runOnUiThread {
mAttendees.forEach {
val attendee = it
val deviceContact = mAvailableContacts.firstOrNull { it.email.isNotEmpty() && it.email == attendee.email && it.photoUri.isNotEmpty() }
@ -1376,6 +1375,7 @@ class EventActivity : SimpleActivity() {
}
}
}
}
private fun addAttendee(attendee: Attendee? = null) {
val attendeeHolder = layoutInflater.inflate(R.layout.item_attendee, event_attendees_holder, false) as RelativeLayout