From 4ed323e60ec872f879bc7a5a54c7d5b5e8bbd157 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 14 Nov 2018 10:08:47 +0100 Subject: [PATCH] destroy the DB instance on leaving the app --- .../calendar/pro/activities/MainActivity.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt index 54f1185da..ce1b0f4ad 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt @@ -19,6 +19,7 @@ import androidx.core.view.MenuItemCompat import com.simplemobiletools.calendar.pro.BuildConfig import com.simplemobiletools.calendar.pro.R import com.simplemobiletools.calendar.pro.adapters.EventListAdapter +import com.simplemobiletools.calendar.pro.databases.EventsDatabase import com.simplemobiletools.calendar.pro.dialogs.ExportEventsDialog import com.simplemobiletools.calendar.pro.dialogs.FilterEventTypesDialog import com.simplemobiletools.calendar.pro.dialogs.ImportEventsDialog @@ -149,6 +150,13 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { closeSearch() } + override fun onDestroy() { + super.onDestroy() + if (!isChangingConfigurations) { + EventsDatabase.destroyInstance() + } + } + override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.menu_main, menu) menu.apply {