stop caldav update listener if CalDAV sync is turned off

This commit is contained in:
tibbi 2019-11-17 13:40:08 +01:00
parent 5ee263f3b6
commit 05e593e781
1 changed files with 10 additions and 0 deletions

View File

@ -163,6 +163,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
super.onDestroy()
if (!isChangingConfigurations) {
EventsDatabase.destroyInstance()
stopCalDAVUpdateListener()
}
}
@ -290,6 +291,15 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
}
}
private fun stopCalDAVUpdateListener() {
if (isNougatPlus()) {
if (!config.caldavSync) {
val updateListener = CalDAVUpdateListener()
updateListener.cancelJob(applicationContext)
}
}
}
@SuppressLint("NewApi")
private fun checkShortcuts() {
val appIconColor = config.appIconColor