From 3f4242650b2f048f91e5b193305238594fa8d453 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 28 Oct 2019 16:20:19 +0100 Subject: [PATCH] fix #452, properly list all groups after opening and closing one --- .../contacts/pro/fragments/MyViewPagerFragment.kt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/fragments/MyViewPagerFragment.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/fragments/MyViewPagerFragment.kt index d5a30aef..d8d41319 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/fragments/MyViewPagerFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/fragments/MyViewPagerFragment.kt @@ -128,19 +128,16 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet) private fun setupContacts(contacts: ArrayList) { 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) { + private fun setupGroupsAdapter(contacts: ArrayList, callback: () -> Unit) { ContactsHelper(activity!!).getStoredGroups { var storedGroups = it contacts.forEach { @@ -180,6 +177,8 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet) updateItems(storedGroups) } } + + callback() } }