mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-02-09 08:08:49 +01:00
fix #452, properly list all groups after opening and closing one
This commit is contained in:
parent
b6643a5c34
commit
3f4242650b
@ -128,19 +128,16 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
||||
|
||||
private fun setupContacts(contacts: ArrayList<Contact>) {
|
||||
if (this is GroupsFragment) {
|
||||
setupGroupsAdapter(contacts)
|
||||
setupGroupsAdapter(contacts) {
|
||||
groupsIgnoringSearch = (fragment_list?.adapter as? GroupsAdapter)?.groups ?: ArrayList()
|
||||
}
|
||||
} else {
|
||||
setupContactsFavoritesAdapter(contacts)
|
||||
}
|
||||
|
||||
if (this is ContactsFragment || this is FavoritesFragment) {
|
||||
contactsIgnoringSearch = (fragment_list?.adapter as? ContactsAdapter)?.contactItems ?: ArrayList()
|
||||
} else if (this is GroupsFragment) {
|
||||
groupsIgnoringSearch = (fragment_list?.adapter as? GroupsAdapter)?.groups ?: ArrayList()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupGroupsAdapter(contacts: ArrayList<Contact>) {
|
||||
private fun setupGroupsAdapter(contacts: ArrayList<Contact>, callback: () -> Unit) {
|
||||
ContactsHelper(activity!!).getStoredGroups {
|
||||
var storedGroups = it
|
||||
contacts.forEach {
|
||||
@ -180,6 +177,8 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
||||
updateItems(storedGroups)
|
||||
}
|
||||
}
|
||||
|
||||
callback()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user