mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-04-13 01:32:03 +02:00
fix #91, try sorting search results smarter
This commit is contained in:
parent
5c89288f6b
commit
30c178e803
@ -137,6 +137,8 @@ class ContactsFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
|
|||||||
it.name.contains(text, true) ||
|
it.name.contains(text, true) ||
|
||||||
it.name.normalizeString().contains(text, true) ||
|
it.name.normalizeString().contains(text, true) ||
|
||||||
it.name.contains(text.normalizeString(), true)
|
it.name.contains(text.normalizeString(), true)
|
||||||
|
}.sortedByDescending {
|
||||||
|
it.name.startsWith(text, true)
|
||||||
}.toMutableList() as ArrayList<SimpleContact>
|
}.toMutableList() as ArrayList<SimpleContact>
|
||||||
|
|
||||||
fragment_placeholder.beVisibleIf(contacts.isEmpty())
|
fragment_placeholder.beVisibleIf(contacts.isEmpty())
|
||||||
|
@ -115,6 +115,8 @@ class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
|
|||||||
override fun onSearchQueryChanged(text: String) {
|
override fun onSearchQueryChanged(text: String) {
|
||||||
val contacts = allContacts.filter {
|
val contacts = allContacts.filter {
|
||||||
it.name.contains(text, true) || it.doesContainPhoneNumber(text)
|
it.name.contains(text, true) || it.doesContainPhoneNumber(text)
|
||||||
|
}.sortedByDescending {
|
||||||
|
it.name.startsWith(text, true)
|
||||||
}.toMutableList() as ArrayList<SimpleContact>
|
}.toMutableList() as ArrayList<SimpleContact>
|
||||||
|
|
||||||
fragment_placeholder.beVisibleIf(contacts.isEmpty())
|
fragment_placeholder.beVisibleIf(contacts.isEmpty())
|
||||||
|
@ -124,6 +124,8 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
|
|||||||
override fun onSearchQueryChanged(text: String) {
|
override fun onSearchQueryChanged(text: String) {
|
||||||
val recentCalls = allRecentCalls.filter {
|
val recentCalls = allRecentCalls.filter {
|
||||||
it.name.contains(text, true) || it.doesContainPhoneNumber(text)
|
it.name.contains(text, true) || it.doesContainPhoneNumber(text)
|
||||||
|
}.sortedByDescending {
|
||||||
|
it.name.startsWith(text, true)
|
||||||
}.toMutableList() as ArrayList<RecentCall>
|
}.toMutableList() as ArrayList<RecentCall>
|
||||||
|
|
||||||
recents_placeholder.beVisibleIf(recentCalls.isEmpty())
|
recents_placeholder.beVisibleIf(recentCalls.isEmpty())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user