mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-06-05 21:49:22 +02:00
at search results prioritize names that start with the search string
This commit is contained in:
@ -52,6 +52,7 @@ class NewMessageActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filteredContacts.sortWith(compareBy { !it.name.startsWith(searchString, true) })
|
||||||
setupAdapter(filteredContacts)
|
setupAdapter(filteredContacts)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,10 +54,7 @@ class AutoCompleteTextViewAdapter(val activity: SimpleActivity, val contacts: Ar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resultList.sortWith(compareBy<Contact>
|
resultList.sortWith(compareBy { !it.name.startsWith(searchString, true) })
|
||||||
{ it.name.startsWith(searchString, true) }.thenBy
|
|
||||||
{ it.name.contains(searchString, true) })
|
|
||||||
resultList.reverse()
|
|
||||||
|
|
||||||
filterResults.values = resultList
|
filterResults.values = resultList
|
||||||
filterResults.count = resultList.size
|
filterResults.count = resultList.size
|
||||||
|
Reference in New Issue
Block a user