From 6b7ea004d4c42881727c9a6d004fe9413bb0043d Mon Sep 17 00:00:00 2001 From: Agnieszka C <85929121+Aga-C@users.noreply.github.com> Date: Tue, 23 Nov 2021 16:11:17 +0100 Subject: [PATCH] Fixed showing default tab --- .../contacts/pro/activities/MainActivity.kt | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt index 1c0a69eb..012f0bba 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt @@ -154,11 +154,11 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { override fun onPause() { super.onPause() storeStateVariables() + config.lastUsedViewPagerPage = viewpager.currentItem } override fun onDestroy() { super.onDestroy() - config.lastUsedViewPagerPage = viewpager.currentItem if (!isChangingConfigurations) { ContactsDatabase.destroyInstance() } @@ -595,8 +595,20 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { TAB_CONTACTS -> 0 TAB_FAVORITES -> if (showTabsMask and TAB_CONTACTS > 0) 1 else 0 else -> { - if (showTabsMask and TAB_CONTACTS > 0) { - if (showTabsMask and TAB_FAVORITES > 0) 2 else 1 + if (showTabsMask and TAB_GROUPS > 0) { + if (showTabsMask and TAB_CONTACTS > 0) { + if (showTabsMask and TAB_FAVORITES > 0) { + 2 + } else { + 1 + } + } else { + if (showTabsMask and TAB_FAVORITES > 0) { + 1 + } else { + 0 + } + } } else { 0 }