Fix app crash on the first use

This commit is contained in:
Zakhar Timoshenko
2021-08-21 20:25:43 +03:00
committed by Koitharu
parent c42d913d4c
commit be0718acf4
2 changed files with 4 additions and 3 deletions

View File

@@ -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)
)
}
}

View File

@@ -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" />