sort attendees by status in a specific way

This commit is contained in:
tibbi 2019-03-19 15:01:59 +01:00
parent 7d0e46705f
commit ed7e90e17d
1 changed files with 7 additions and 0 deletions

View File

@ -1148,6 +1148,13 @@ class EventActivity : SimpleActivity() {
} }
private fun updateAttendees() { private fun updateAttendees() {
mAttendees.sortWith(compareBy<Attendee>
{ it.status == CalendarContract.Attendees.ATTENDEE_STATUS_ACCEPTED }.thenBy
{ it.status == CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED }.thenBy
{ it.status == CalendarContract.Attendees.ATTENDEE_STATUS_TENTATIVE }.thenBy
{ it.status })
mAttendees.reverse()
mAttendees.forEach { mAttendees.forEach {
val attendee = it val attendee = it
val deviceContact = mAvailableContacts.firstOrNull { it.email.isNotEmpty() && it.email == attendee.email && it.photoUri.isNotEmpty() } val deviceContact = mAvailableContacts.firstOrNull { it.email.isNotEmpty() && it.email == attendee.email && it.photoUri.isNotEmpty() }