From 6e898e43b8813759946f79f712876b184eb5c2ed Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 13 May 2018 23:02:31 +0200 Subject: [PATCH] renaming the database variable --- .../gallery/databases/GalleryDataBase.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/databases/GalleryDataBase.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/databases/GalleryDataBase.kt index cd3d82570..8bf970ccd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/databases/GalleryDataBase.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/databases/GalleryDataBase.kt @@ -17,21 +17,21 @@ abstract class GalleryDataBase : RoomDatabase() { abstract fun MediumDao(): MediumDao companion object { - private var INSTANCE: GalleryDataBase? = null + private var db: GalleryDataBase? = null fun getInstance(context: Context): GalleryDataBase { - if (INSTANCE == null) { + if (db == null) { synchronized(GalleryDataBase::class) { - INSTANCE = Room.databaseBuilder(context.applicationContext, GalleryDataBase::class.java, "gallery.db") + db = Room.databaseBuilder(context.applicationContext, GalleryDataBase::class.java, "gallery.db") .fallbackToDestructiveMigration() .build() } } - return INSTANCE!! + return db!! } fun destroyInstance() { - INSTANCE = null + db = null } } }