apply search to phone numbers too
This commit is contained in:
parent
5b88de8025
commit
108e72fd10
2 changed files with 8 additions and 1 deletions
|
@ -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…
Reference in a new issue