diff --git a/app/src/main/java/org/koitharu/kotatsu/KotatsuApp.kt b/app/src/main/java/org/koitharu/kotatsu/KotatsuApp.kt index 50f28cec9..af136fb62 100644 --- a/app/src/main/java/org/koitharu/kotatsu/KotatsuApp.kt +++ b/app/src/main/java/org/koitharu/kotatsu/KotatsuApp.kt @@ -14,6 +14,7 @@ import org.koin.android.ext.koin.androidContext import org.koin.android.ext.koin.androidLogger import org.koin.core.context.startKoin import org.koin.dsl.module +import org.koitharu.kotatsu.core.db.DatabasePrePopulateCallback import org.koitharu.kotatsu.core.db.MangaDatabase import org.koitharu.kotatsu.core.db.migrations.Migration1To2 import org.koitharu.kotatsu.core.db.migrations.Migration2To3 @@ -126,4 +127,5 @@ class KotatsuApp : Application() { MangaDatabase::class.java, "kotatsu-db" ).addMigrations(Migration1To2, Migration2To3, Migration3To4, Migration4To5) + .addCallback(DatabasePrePopulateCallback(resources)) } \ No newline at end of file diff --git a/app/src/main/java/org/koitharu/kotatsu/core/db/DatabasePrePopulateCallback.kt b/app/src/main/java/org/koitharu/kotatsu/core/db/DatabasePrePopulateCallback.kt new file mode 100644 index 000000000..ce8749d9d --- /dev/null +++ b/app/src/main/java/org/koitharu/kotatsu/core/db/DatabasePrePopulateCallback.kt @@ -0,0 +1,16 @@ +package org.koitharu.kotatsu.core.db + +import android.content.res.Resources +import androidx.room.RoomDatabase +import androidx.sqlite.db.SupportSQLiteDatabase +import org.koitharu.kotatsu.R + +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)) + ) + } +} \ No newline at end of file diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 0241cf46a..eee8e8e82 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -134,4 +134,5 @@ Готово Всё избранное В этой категории ничего нет + Прочитать позже \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fe78a9a74..04f54363d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -135,4 +135,5 @@ Done All favourites This category is empty + Read later \ No newline at end of file