App is now fully converted to Kotlin

This commit is contained in:
Deniz Düzgören
2019-05-26 18:40:02 +02:00
parent 44269a7def
commit abc3309acd
46 changed files with 266 additions and 3170 deletions
@@ -0,0 +1,30 @@
package com.denizd.substitutionplan
import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
@Database(entities = [Subst::class], version = 3, exportSchema = false)
public abstract class SubstDatabase : RoomDatabase() {
abstract fun substDao(): SubstDao
companion object {
private var instance: SubstDatabase? = null
fun getInstance(context: Context): SubstDatabase? {
if (instance == null) {
synchronized (SubstDatabase::class) {
instance = Room.databaseBuilder(context.applicationContext,
SubstDatabase::class.java,
"subst_database")
.fallbackToDestructiveMigration()
.build()
}
}
return instance
}
}
}