mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-02-21 22:07:44 +01:00
handle select sorting when search is active
This commit is contained in:
parent
b2960c624e
commit
b628a8f626
@ -45,6 +45,7 @@ class MainActivity : SimpleActivity() {
|
||||
private var launchedDialer = false
|
||||
private var searchMenuItem: MenuItem? = null
|
||||
private var storedShowTabs = 0
|
||||
private var searchQuery = ""
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
@ -176,6 +177,7 @@ class MainActivity : SimpleActivity() {
|
||||
|
||||
override fun onQueryTextChange(newText: String): Boolean {
|
||||
if (isSearchOpen) {
|
||||
searchQuery = newText
|
||||
getCurrentFragment()?.onSearchQueryChanged(newText)
|
||||
}
|
||||
return true
|
||||
@ -475,7 +477,16 @@ class MainActivity : SimpleActivity() {
|
||||
|
||||
private fun showSortingDialog() {
|
||||
ChangeSortingDialog(this) {
|
||||
refreshFragments()
|
||||
favorites_fragment?.refreshItems {
|
||||
if (isSearchOpen){
|
||||
getCurrentFragment()?.onSearchQueryChanged(searchQuery)
|
||||
}
|
||||
}
|
||||
contacts_fragment?.refreshItems {
|
||||
if (isSearchOpen){
|
||||
getCurrentFragment()?.onSearchQueryChanged(searchQuery)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ class ContactsFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
|
||||
)
|
||||
}
|
||||
|
||||
override fun refreshItems() {
|
||||
override fun refreshItems(callback: (() -> Unit)?) {
|
||||
val privateCursor = context?.getMyContactsCursor(false, true)
|
||||
SimpleContactsHelper(context).getAvailableContacts(false) { contacts ->
|
||||
allContacts = contacts
|
||||
@ -85,6 +85,7 @@ class ContactsFragment(context: Context, attributeSet: AttributeSet) : MyViewPag
|
||||
|
||||
activity?.runOnUiThread {
|
||||
gotContacts(contacts)
|
||||
callback?.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
|
||||
letter_fastscroller_thumb.thumbColor = properPrimaryColor.getColorStateList()
|
||||
}
|
||||
|
||||
override fun refreshItems() {
|
||||
override fun refreshItems(callback: (() -> Unit)?) {
|
||||
val privateCursor = context?.getMyContactsCursor(true, true)
|
||||
SimpleContactsHelper(context).getAvailableContacts(true) { contacts ->
|
||||
allContacts = contacts
|
||||
@ -59,6 +59,7 @@ class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
|
||||
|
||||
activity?.runOnUiThread {
|
||||
gotContacts(contacts)
|
||||
callback?.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
|
||||
}
|
||||
}
|
||||
|
||||
override fun refreshItems() {
|
||||
override fun refreshItems(callback: (() -> Unit)?) {
|
||||
val privateCursor = context?.getMyContactsCursor(false, true)
|
||||
val groupSubsequentCalls = context?.config?.groupSubsequentCalls ?: false
|
||||
RecentsHelper(context).getRecentCalls(groupSubsequentCalls) { recents ->
|
||||
|
@ -1,5 +1,5 @@
|
||||
package com.simplemobiletools.dialer.interfaces
|
||||
|
||||
interface RefreshItemsListener {
|
||||
fun refreshItems()
|
||||
fun refreshItems(callback: (() -> Unit)? = null)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user