at search results prioritize names that start with the search string
This commit is contained in:
parent
ec5c49ce1e
commit
2a36a23782
|
@ -52,6 +52,7 @@ class NewMessageActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
filteredContacts.sortWith(compareBy { !it.name.startsWith(searchString, true) })
|
||||
setupAdapter(filteredContacts)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,10 +54,7 @@ class AutoCompleteTextViewAdapter(val activity: SimpleActivity, val contacts: Ar
|
|||
}
|
||||
}
|
||||
|
||||
resultList.sortWith(compareBy<Contact>
|
||||
{ it.name.startsWith(searchString, true) }.thenBy
|
||||
{ it.name.contains(searchString, true) })
|
||||
resultList.reverse()
|
||||
resultList.sortWith(compareBy { !it.name.startsWith(searchString, true) })
|
||||
|
||||
filterResults.values = resultList
|
||||
filterResults.count = resultList.size
|
||||
|
|
Loading…
Reference in New Issue