mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
do not spend time fetching data for hidden fragments
This commit is contained in:
@ -86,6 +86,12 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun refreshContacts(contacts: ArrayList<Contact>) {
|
fun refreshContacts(contacts: ArrayList<Contact>) {
|
||||||
|
if ((config.showTabs and CONTACTS_TAB_MASK == 0 && this is ContactsFragment) ||
|
||||||
|
(config.showTabs and FAVORITES_TAB_MASK == 0 && this is FavoritesFragment) ||
|
||||||
|
(config.showTabs and GROUPS_TAB_MASK == 0 && this is GroupsFragment)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (config.lastUsedContactSource.isEmpty()) {
|
if (config.lastUsedContactSource.isEmpty()) {
|
||||||
val grouped = contacts.groupBy { it.source }.maxWith(compareBy { it.value.size })
|
val grouped = contacts.groupBy { it.source }.maxWith(compareBy { it.value.size })
|
||||||
config.lastUsedContactSource = grouped?.key ?: ""
|
config.lastUsedContactSource = grouped?.key ?: ""
|
||||||
|
Reference in New Issue
Block a user