diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/DbOpenCallback.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/DbOpenCallback.kt index 9f4df849e7..7fbd7089a2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/DbOpenCallback.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/DbOpenCallback.kt @@ -69,6 +69,9 @@ class DbOpenCallback : SupportSQLiteOpenHelper.Callback(DATABASE_VERSION) { db.execSQL(MangaTable.createLibraryIndexQuery) db.execSQL(ChapterTable.createUnreadChaptersIndexQuery) } + if (oldVersion < 9) { + db.execSQL(MangaTable.addHideTitle) + } if (oldVersion < 10) { db.execSQL(CategoryTable.addMangaOrder) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/mappers/MangaTypeMapping.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/mappers/MangaTypeMapping.kt index fdfbab61f7..73dfa7f0f0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/mappers/MangaTypeMapping.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/mappers/MangaTypeMapping.kt @@ -18,6 +18,7 @@ import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_DATE_ADDED import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_DESCRIPTION import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_FAVORITE import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_GENRE +import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_HIDE_TITLE import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_ID import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_INITIALIZED import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_LAST_UPDATE @@ -62,6 +63,7 @@ class MangaPutResolver : DefaultPutResolver() { put(COL_LAST_UPDATE, obj.last_update) put(COL_INITIALIZED, obj.initialized) put(COL_VIEWER, obj.viewer) + put(COL_HIDE_TITLE, obj.hide_title) put(COL_CHAPTER_FLAGS, obj.chapter_flags) put(COL_DATE_ADDED, obj.date_added) } @@ -84,6 +86,7 @@ interface BaseMangaGetResolver { initialized = cursor.getInt(cursor.getColumnIndex(COL_INITIALIZED)) == 1 viewer = cursor.getInt(cursor.getColumnIndex(COL_VIEWER)) chapter_flags = cursor.getInt(cursor.getColumnIndex(COL_CHAPTER_FLAGS)) + hide_title = cursor.getInt(cursor.getColumnIndex(COL_HIDE_TITLE)) == 1 date_added = cursor.getLong(cursor.getColumnIndex(COL_DATE_ADDED)) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Manga.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Manga.kt index e5e44b1ecd..947622ba9b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Manga.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Manga.kt @@ -25,6 +25,8 @@ interface Manga : SManga { var chapter_flags: Int + var hide_title: Boolean + fun setChapterOrder(order: Int) { setFlags(order, SORT_MASK) setFlags(SORT_LOCAL, SORT_SELF_MASK) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaImpl.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaImpl.kt index e0f87ed1fa..82dfcefd36 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaImpl.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/MangaImpl.kt @@ -38,6 +38,8 @@ open class MangaImpl : Manga { override var chapter_flags: Int = 0 + override var hide_title: Boolean = false + override var date_added: Long = 0 override fun copyFrom(other: SManga) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/tables/MangaTable.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/tables/MangaTable.kt index f992088a19..2ea04b2379 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/tables/MangaTable.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/tables/MangaTable.kt @@ -38,6 +38,8 @@ object MangaTable { const val COL_CATEGORY = "category" + const val COL_HIDE_TITLE = "hideTitle" + const val COL_DATE_ADDED = "date_added" val createTableQuery: String @@ -56,6 +58,7 @@ object MangaTable { $COL_LAST_UPDATE LONG, $COL_INITIALIZED BOOLEAN NOT NULL, $COL_VIEWER INTEGER NOT NULL, + $COL_HIDE_TITLE INTEGER NOT NULL, $COL_CHAPTER_FLAGS INTEGER NOT NULL, $COL_DATE_ADDED LONG @@ -68,6 +71,9 @@ object MangaTable { get() = "CREATE INDEX library_${COL_FAVORITE}_index ON $TABLE($COL_FAVORITE) " + "WHERE $COL_FAVORITE = 1" + val addHideTitle: String + get() = "ALTER TABLE $TABLE ADD COLUMN $COL_HIDE_TITLE INTEGER DEFAULT 0" + val addDateAddedCol: String - get() = "ALTER TABLE ${MangaTable.TABLE} ADD COLUMN ${MangaTable.COL_DATE_ADDED} LONG DEFAULT 0" + get() = "ALTER TABLE $TABLE ADD COLUMN $COL_DATE_ADDED LONG DEFAULT 0" }