From 038d00ed0a204defb3435619dba4dbb450261703 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 23 Jul 2017 20:41:14 +0200 Subject: [PATCH] clear the stored Account Name at disabling google sync --- .../simplemobiletools/calendar/activities/MainActivity.kt | 2 +- .../calendar/activities/SettingsActivity.kt | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt index 8d0aad7aa..34891f13b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/MainActivity.kt @@ -90,7 +90,7 @@ class MainActivity : SimpleActivity(), NavigationListener { config.googleSync = false } - if (config.syncAccountName.isNotEmpty()) { + if (config.syncAccountName.isNotEmpty() && config.googleSync) { FetchGoogleEventsTask(this, googleSyncListener).execute() } } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt index 760d938cc..911cadddf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt @@ -134,6 +134,8 @@ class SettingsActivity : SimpleActivity() { if (settings_google_sync.isChecked) { tryEnablingSync() + } else { + disableGoogleSync() } } @@ -346,8 +348,9 @@ class SettingsActivity : SimpleActivity() { } private fun disableGoogleSync() { - settings_google_sync.toggle() + settings_google_sync.isChecked = false config.googleSync = false + config.syncAccountName = "" } override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) {