Fix app crash on the first use

pull/61/head
Zakhar Timoshenko 5 years ago committed by Koitharu
parent c42d913d4c
commit be0718acf4

@ -4,13 +4,14 @@ import android.content.res.Resources
import androidx.room.RoomDatabase
import androidx.sqlite.db.SupportSQLiteDatabase
import org.koitharu.kotatsu.R
import org.koitharu.kotatsu.core.model.SortOrder
class DatabasePrePopulateCallback(private val resources: Resources) : RoomDatabase.Callback() {
override fun onCreate(db: SupportSQLiteDatabase) {
db.execSQL(
"INSERT INTO favourite_categories (created_at, sort_key, title) VALUES (?,?,?)",
arrayOf(System.currentTimeMillis(), 1, resources.getString(R.string.read_later))
"INSERT INTO favourite_categories (created_at, sort_key, title, `order`) VALUES (?,?,?,?)",
arrayOf(System.currentTimeMillis(), 1, resources.getString(R.string.read_later), SortOrder.NEWEST.name)
)
}
}

@ -45,7 +45,7 @@
</style>
<style name="AppTheme" parent="Base.AppTheme">
<item name="android:statusBarColor">@color/grey</item>
<item name="android:statusBarColor">@color/nav_bar_scrim</item>
</style>
<style name="AppTheme.AMOLED" parent="Base.AppTheme" />

Loading…
Cancel
Save