From a1a25730473e2f29354a33b67403faead51e82ec Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 3 Jan 2018 12:11:25 +0100 Subject: [PATCH] fix #28, make the contacts beginning with the search string appear first --- .../contacts/fragments/MyViewPagerFragment.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/fragments/MyViewPagerFragment.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/fragments/MyViewPagerFragment.kt index 85405c36..cb6fd847 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/fragments/MyViewPagerFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/fragments/MyViewPagerFragment.kt @@ -163,6 +163,11 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet) it.phoneNumbers.any { it.value.contains(text, true) } || it.emails.any { it.value.contains(text, true) } } as ArrayList + + Contact.sorting = config.sorting + filtered.sort() + filtered.sortBy { !it.getFullName(startNameWithSurname).startsWith(text, true) } + updateItems(filtered) } }