mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
apply search to phone numbers too
This commit is contained in:
@ -174,6 +174,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onMenuItemActionCollapse(item: MenuItem?): Boolean {
|
override fun onMenuItemActionCollapse(item: MenuItem?): Boolean {
|
||||||
|
getCurrentFragment().onSearchClosed()
|
||||||
isSearchOpen = false
|
isSearchOpen = false
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,9 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
|||||||
|
|
||||||
fun onSearchQueryChanged(text: String) {
|
fun onSearchQueryChanged(text: String) {
|
||||||
(fragment_list.adapter as ContactsAdapter).apply {
|
(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)
|
updateItems(filtered)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -167,6 +169,10 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
|||||||
contactsIgnoringSearch = (fragment_list.adapter as ContactsAdapter).contactItems as ArrayList
|
contactsIgnoringSearch = (fragment_list.adapter as ContactsAdapter).contactItems as ArrayList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun onSearchClosed() {
|
||||||
|
(fragment_list.adapter as ContactsAdapter).updateItems(contactsIgnoringSearch)
|
||||||
|
}
|
||||||
|
|
||||||
private fun updateViewStuff() {
|
private fun updateViewStuff() {
|
||||||
context.updateTextColors(fragment_wrapper)
|
context.updateTextColors(fragment_wrapper)
|
||||||
fragment_fastscroller.updateBubbleColors()
|
fragment_fastscroller.updateBubbleColors()
|
||||||
|
Reference in New Issue
Block a user