mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-03-06 12:07:59 +01:00
apply search to phone numbers too
This commit is contained in:
parent
5b88de8025
commit
108e72fd10
@ -174,6 +174,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
||||
}
|
||||
|
||||
override fun onMenuItemActionCollapse(item: MenuItem?): Boolean {
|
||||
getCurrentFragment().onSearchClosed()
|
||||
isSearchOpen = false
|
||||
return true
|
||||
}
|
||||
|
@ -158,7 +158,9 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
||||
|
||||
fun onSearchQueryChanged(text: String) {
|
||||
(fragment_list.adapter as ContactsAdapter).apply {
|
||||
val filtered = contactsIgnoringSearch.filter { it.getFullName(startNameWithSurname).contains(text, true) } as ArrayList
|
||||
val filtered = contactsIgnoringSearch.filter {
|
||||
it.getFullName(startNameWithSurname).contains(text, true) || it.phoneNumbers.any { it.value.contains(text, true) }
|
||||
} as ArrayList
|
||||
updateItems(filtered)
|
||||
}
|
||||
}
|
||||
@ -167,6 +169,10 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
||||
contactsIgnoringSearch = (fragment_list.adapter as ContactsAdapter).contactItems as ArrayList
|
||||
}
|
||||
|
||||
fun onSearchClosed() {
|
||||
(fragment_list.adapter as ContactsAdapter).updateItems(contactsIgnoringSearch)
|
||||
}
|
||||
|
||||
private fun updateViewStuff() {
|
||||
context.updateTextColors(fragment_wrapper)
|
||||
fragment_fastscroller.updateBubbleColors()
|
||||
|
Loading…
x
Reference in New Issue
Block a user