mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-02-10 00:20:46 +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>) {
|
private fun setupContacts(contacts: ArrayList<Contact>) {
|
||||||
if (this is GroupsFragment) {
|
if (this is GroupsFragment) {
|
||||||
setupGroupsAdapter(contacts)
|
setupGroupsAdapter(contacts) {
|
||||||
|
groupsIgnoringSearch = (fragment_list?.adapter as? GroupsAdapter)?.groups ?: ArrayList()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setupContactsFavoritesAdapter(contacts)
|
setupContactsFavoritesAdapter(contacts)
|
||||||
}
|
|
||||||
|
|
||||||
if (this is ContactsFragment || this is FavoritesFragment) {
|
|
||||||
contactsIgnoringSearch = (fragment_list?.adapter as? ContactsAdapter)?.contactItems ?: ArrayList()
|
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 {
|
ContactsHelper(activity!!).getStoredGroups {
|
||||||
var storedGroups = it
|
var storedGroups = it
|
||||||
contacts.forEach {
|
contacts.forEach {
|
||||||
@ -180,6 +177,8 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
|||||||
updateItems(storedGroups)
|
updateItems(storedGroups)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
callback()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user