mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-06-05 21:49:23 +02:00
show Search on all tabs
This commit is contained in:
@ -101,8 +101,6 @@ class MainActivity : SimpleActivity() {
|
|||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||||
menuInflater.inflate(R.menu.menu, menu)
|
menuInflater.inflate(R.menu.menu, menu)
|
||||||
menu.findItem(R.id.search).isVisible = viewpager.currentItem == 0
|
|
||||||
|
|
||||||
setupSearch(menu)
|
setupSearch(menu)
|
||||||
updateMenuItemColors(menu)
|
updateMenuItemColors(menu)
|
||||||
return true
|
return true
|
||||||
|
@ -153,12 +153,12 @@ class ContactsFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onSearchClosed() {
|
override fun onSearchClosed() {
|
||||||
(fragment_list.adapter as? ContactsAdapter)?.updateItems(allContacts)
|
(fragment_list.adapter as? ContactsAdapter)?.updateItems(allContacts)
|
||||||
setupLetterFastscroller(allContacts)
|
setupLetterFastscroller(allContacts)
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
}.toMutableList() as ArrayList<SimpleContact>
|
}.toMutableList() as ArrayList<SimpleContact>
|
||||||
|
@ -111,4 +111,12 @@ class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onSearchClosed() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onSearchQueryChanged(text: String) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,4 +34,8 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
|||||||
abstract fun textColorChanged(color: Int)
|
abstract fun textColorChanged(color: Int)
|
||||||
|
|
||||||
abstract fun primaryColorChanged(color: Int)
|
abstract fun primaryColorChanged(color: Int)
|
||||||
|
|
||||||
|
abstract fun onSearchClosed()
|
||||||
|
|
||||||
|
abstract fun onSearchQueryChanged(text: String)
|
||||||
}
|
}
|
||||||
|
@ -109,4 +109,12 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onSearchClosed() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onSearchQueryChanged(text: String) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user