clear the stored Account Name at disabling google sync

This commit is contained in:
tibbi 2017-07-23 20:41:14 +02:00
parent 84d710dd6d
commit 038d00ed0a
2 changed files with 5 additions and 2 deletions

View File

@ -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()
}
}

View File

@ -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<String>, grantResults: IntArray) {