destroy the DB instance on leaving the app

This commit is contained in:
tibbi 2018-11-14 10:08:47 +01:00
parent b532c7852e
commit 4ed323e60e

View File

@ -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 {