sort attendee suggestions in a specific order

This commit is contained in:
tibbi 2019-03-14 09:58:11 +01:00
parent 62bea960e3
commit aca2f1b163
1 changed files with 8 additions and 0 deletions

View File

@ -37,6 +37,14 @@ class AutoCompleteTextViewAdapter(val activity: SimpleActivity, val contacts: Ar
resultList.add(it)
}
}
resultList.sortWith(compareBy<Attendee>
{ it.name.startsWith(searchString, true) }.thenBy
{ it.email.startsWith(searchString, true) }.thenBy
{ it.name.contains(searchString, true) }.thenBy
{ it.email.contains(searchString, true) })
resultList.reverse()
filterResults.values = resultList
filterResults.count = resultList.size
}