mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-02-20 05:20:56 +01:00
Fix contacts not refreshing when search bar is open
Before, if you opened search bar and went on to add a contact, the new contact wasn't shown. With this change, contacts will be refreshed and previous search query will be reapplied.
This commit is contained in:
parent
76c6871ca8
commit
89ee77575c
@ -52,6 +52,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||||||
|
|
||||||
private var isSearchOpen = false
|
private var isSearchOpen = false
|
||||||
private var searchMenuItem: MenuItem? = null
|
private var searchMenuItem: MenuItem? = null
|
||||||
|
private var searchQuery = ""
|
||||||
private var werePermissionsHandled = false
|
private var werePermissionsHandled = false
|
||||||
private var isFirstResume = true
|
private var isFirstResume = true
|
||||||
private var isGettingContacts = false
|
private var isGettingContacts = false
|
||||||
@ -229,6 +230,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||||||
|
|
||||||
override fun onQueryTextChange(newText: String): Boolean {
|
override fun onQueryTextChange(newText: String): Boolean {
|
||||||
if (isSearchOpen) {
|
if (isSearchOpen) {
|
||||||
|
searchQuery = newText
|
||||||
getCurrentFragment()?.onSearchQueryChanged(newText)
|
getCurrentFragment()?.onSearchQueryChanged(newText)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
@ -540,7 +542,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun refreshContacts(refreshTabsMask: Int) {
|
override fun refreshContacts(refreshTabsMask: Int) {
|
||||||
if (isDestroyed || isFinishing || isGettingContacts || isSearchOpen) {
|
if (isDestroyed || isFinishing || isGettingContacts) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -572,6 +574,10 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||||||
}
|
}
|
||||||
groups_fragment?.refreshContacts(contacts)
|
groups_fragment?.refreshContacts(contacts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isSearchOpen) {
|
||||||
|
getCurrentFragment()?.onSearchQueryChanged(searchQuery)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user