make sure we show our status first

This commit is contained in:
tibbi 2019-03-19 23:30:38 +01:00
parent 660278ce61
commit 66df18e849
1 changed files with 9 additions and 6 deletions

View File

@ -1153,22 +1153,25 @@ class EventActivity : SimpleActivity() {
} }
private fun updateAttendees() { private fun updateAttendees() {
val currentCalendar = calDAVHelper.getCalDAVCalendars("", true).firstOrNull { it.id == mEventCalendarId }
mAttendees.forEach {
if (it.email == currentCalendar?.accountName) {
it.name = ATTENDEE_ME
}
}
mAttendees.sortWith(compareBy<Attendee> mAttendees.sortWith(compareBy<Attendee>
{ it.name == ATTENDEE_ME }.thenBy
{ it.status == CalendarContract.Attendees.ATTENDEE_STATUS_ACCEPTED }.thenBy { it.status == CalendarContract.Attendees.ATTENDEE_STATUS_ACCEPTED }.thenBy
{ it.status == CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED }.thenBy { it.status == CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED }.thenBy
{ it.status == CalendarContract.Attendees.ATTENDEE_STATUS_TENTATIVE }.thenBy { it.status == CalendarContract.Attendees.ATTENDEE_STATUS_TENTATIVE }.thenBy
{ it.status }) { it.status })
mAttendees.reverse() mAttendees.reverse()
val currentCalendar = calDAVHelper.getCalDAVCalendars("", true).firstOrNull { it.id == mEventCalendarId }
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() }
if (attendee.email == currentCalendar?.accountName) {
attendee.name = ATTENDEE_ME
}
if (deviceContact != null) { if (deviceContact != null) {
attendee.photoUri = deviceContact.photoUri attendee.photoUri = deviceContact.photoUri
} }