From 3d32bd9d5845dbe6c4ff8ab925e4d156c93649f5 Mon Sep 17 00:00:00 2001 From: Koitharu Date: Wed, 25 Oct 2023 15:39:36 +0300 Subject: [PATCH] Fix warnings --- .../kotatsu/bookmarks/ui/BookmarksActivity.kt | 4 +- .../core/db/migrations/Migration10To11.kt | 10 ++--- .../core/db/migrations/Migration11To12.kt | 8 ++-- .../core/db/migrations/Migration12To13.kt | 8 ++-- .../core/db/migrations/Migration13To14.kt | 12 ++--- .../core/db/migrations/Migration14To15.kt | 2 +- .../core/db/migrations/Migration15To16.kt | 4 +- .../core/db/migrations/Migration16To17.kt | 8 ++-- .../core/db/migrations/Migration1To2.kt | 44 +++++++++---------- .../core/db/migrations/Migration2To3.kt | 6 +-- .../core/db/migrations/Migration3To4.kt | 6 +-- .../core/db/migrations/Migration4To5.kt | 6 +-- .../core/db/migrations/Migration5To6.kt | 8 ++-- .../core/db/migrations/Migration6To7.kt | 6 +-- .../core/db/migrations/Migration7To8.kt | 10 ++--- .../core/db/migrations/Migration8To9.kt | 6 +-- .../core/db/migrations/Migration9To10.kt | 6 +-- .../koitharu/kotatsu/core/ui/BaseActivity.kt | 3 +- .../adapter/SearchSuggestionQueryHintAD.kt | 2 +- .../suggestions/ui/SuggestionsActivity.kt | 3 +- .../kotatsu/tracker/data/TracksDao.kt | 5 +-- 21 files changed, 83 insertions(+), 84 deletions(-) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/bookmarks/ui/BookmarksActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/bookmarks/ui/BookmarksActivity.kt index 5f2f952bd..444ad0485 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/bookmarks/ui/BookmarksActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/bookmarks/ui/BookmarksActivity.kt @@ -34,8 +34,8 @@ class BookmarksActivity : val fm = supportFragmentManager if (fm.findFragmentById(R.id.container) == null) { fm.commit { - val fragment = BookmarksFragment.newInstance() - replace(R.id.container, fragment) + setReorderingAllowed(true) + replace(R.id.container, BookmarksFragment::class.java, null) } } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration10To11.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration10To11.kt index 5d80708fe..2d9cd4fa3 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration10To11.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration10To11.kt @@ -5,8 +5,8 @@ import androidx.sqlite.db.SupportSQLiteDatabase class Migration10To11 : Migration(10, 11) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL( + override fun migrate(db: SupportSQLiteDatabase) { + db.execSQL( """ CREATE TABLE IF NOT EXISTS `bookmarks` ( `manga_id` INTEGER NOT NULL, @@ -20,7 +20,7 @@ class Migration10To11 : Migration(10, 11) { FOREIGN KEY(`manga_id`) REFERENCES `manga`(`manga_id`) ON UPDATE NO ACTION ON DELETE CASCADE ) """.trimIndent() ) - database.execSQL("CREATE INDEX IF NOT EXISTS `index_bookmarks_manga_id` ON `bookmarks` (`manga_id`)") - database.execSQL("CREATE INDEX IF NOT EXISTS `index_bookmarks_page_id` ON `bookmarks` (`page_id`)") + db.execSQL("CREATE INDEX IF NOT EXISTS `index_bookmarks_manga_id` ON `bookmarks` (`manga_id`)") + db.execSQL("CREATE INDEX IF NOT EXISTS `index_bookmarks_page_id` ON `bookmarks` (`page_id`)") } -} \ No newline at end of file +} diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration11To12.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration11To12.kt index ae82764b2..6af773d5a 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration11To12.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration11To12.kt @@ -5,8 +5,8 @@ import androidx.sqlite.db.SupportSQLiteDatabase class Migration11To12 : Migration(11, 12) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL( + override fun migrate(db: SupportSQLiteDatabase) { + db.execSQL( """ CREATE TABLE IF NOT EXISTS `scrobblings` ( `scrobbler` INTEGER NOT NULL, @@ -21,7 +21,7 @@ class Migration11To12 : Migration(11, 12) { ) """.trimIndent() ) - database.execSQL("ALTER TABLE history ADD COLUMN `percent` REAL NOT NULL DEFAULT -1") - database.execSQL("ALTER TABLE bookmarks ADD COLUMN `percent` REAL NOT NULL DEFAULT -1") + db.execSQL("ALTER TABLE history ADD COLUMN `percent` REAL NOT NULL DEFAULT -1") + db.execSQL("ALTER TABLE bookmarks ADD COLUMN `percent` REAL NOT NULL DEFAULT -1") } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration12To13.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration12To13.kt index 9f8fa723a..228e1b181 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration12To13.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration12To13.kt @@ -5,8 +5,8 @@ import androidx.sqlite.db.SupportSQLiteDatabase class Migration12To13 : Migration(12, 13) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("ALTER TABLE favourite_categories ADD COLUMN `show_in_lib` INTEGER NOT NULL DEFAULT 1") - database.execSQL("ALTER TABLE favourites ADD COLUMN `sort_key` INTEGER NOT NULL DEFAULT 0") + override fun migrate(db: SupportSQLiteDatabase) { + db.execSQL("ALTER TABLE favourite_categories ADD COLUMN `show_in_lib` INTEGER NOT NULL DEFAULT 1") + db.execSQL("ALTER TABLE favourites ADD COLUMN `sort_key` INTEGER NOT NULL DEFAULT 0") } -} \ No newline at end of file +} diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration13To14.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration13To14.kt index 9bd66a08e..11c961ec3 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration13To14.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration13To14.kt @@ -5,11 +5,11 @@ import androidx.sqlite.db.SupportSQLiteDatabase class Migration13To14 : Migration(13, 14) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("ALTER TABLE favourite_categories ADD COLUMN `deleted_at` INTEGER NOT NULL DEFAULT 0") - database.execSQL("ALTER TABLE favourites ADD COLUMN `deleted_at` INTEGER NOT NULL DEFAULT 0") - database.execSQL("ALTER TABLE history ADD COLUMN `deleted_at` INTEGER NOT NULL DEFAULT 0") - database.execSQL("ALTER TABLE preferences ADD COLUMN `cf_brightness` REAL NOT NULL DEFAULT 0") - database.execSQL("ALTER TABLE preferences ADD COLUMN `cf_contrast` REAL NOT NULL DEFAULT 0") + override fun migrate(db: SupportSQLiteDatabase) { + db.execSQL("ALTER TABLE favourite_categories ADD COLUMN `deleted_at` INTEGER NOT NULL DEFAULT 0") + db.execSQL("ALTER TABLE favourites ADD COLUMN `deleted_at` INTEGER NOT NULL DEFAULT 0") + db.execSQL("ALTER TABLE history ADD COLUMN `deleted_at` INTEGER NOT NULL DEFAULT 0") + db.execSQL("ALTER TABLE preferences ADD COLUMN `cf_brightness` REAL NOT NULL DEFAULT 0") + db.execSQL("ALTER TABLE preferences ADD COLUMN `cf_contrast` REAL NOT NULL DEFAULT 0") } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration14To15.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration14To15.kt index 7007851d0..3089222f5 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration14To15.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration14To15.kt @@ -5,5 +5,5 @@ import androidx.sqlite.db.SupportSQLiteDatabase class Migration14To15 : Migration(14, 15) { - override fun migrate(database: SupportSQLiteDatabase) = Unit + override fun migrate(db: SupportSQLiteDatabase) = Unit } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration15To16.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration15To16.kt index aba52e885..3e6783460 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration15To16.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration15To16.kt @@ -5,7 +5,7 @@ import androidx.sqlite.db.SupportSQLiteDatabase class Migration15To16 : Migration(15, 16) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("ALTER TABLE preferences ADD COLUMN `cf_invert` INTEGER NOT NULL DEFAULT 0") + override fun migrate(db: SupportSQLiteDatabase) { + db.execSQL("ALTER TABLE preferences ADD COLUMN `cf_invert` INTEGER NOT NULL DEFAULT 0") } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration16To17.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration16To17.kt index cccbdd9e8..e49a9b1ee 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration16To17.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration16To17.kt @@ -10,9 +10,9 @@ class Migration16To17(context: Context) : Migration(16, 17) { private val prefs = PreferenceManager.getDefaultSharedPreferences(context) - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("CREATE TABLE `sources` (`source` TEXT NOT NULL, `enabled` INTEGER NOT NULL, `sort_key` INTEGER NOT NULL, PRIMARY KEY(`source`))") - database.execSQL("CREATE INDEX `index_sources_sort_key` ON `sources` (`sort_key`)") + override fun migrate(db: SupportSQLiteDatabase) { + db.execSQL("CREATE TABLE `sources` (`source` TEXT NOT NULL, `enabled` INTEGER NOT NULL, `sort_key` INTEGER NOT NULL, PRIMARY KEY(`source`))") + db.execSQL("CREATE INDEX `index_sources_sort_key` ON `sources` (`sort_key`)") val hiddenSources = prefs.getStringSet("sources_hidden", null).orEmpty() val order = prefs.getString("sources_order_2", null)?.split('|').orEmpty() val sources = MangaSource.entries @@ -30,7 +30,7 @@ class Migration16To17(context: Context) : Migration(16, 17) { continue } } - database.execSQL( + db.execSQL( "INSERT INTO `sources` (`source`, `enabled`, `sort_key`) VALUES (?, ?, ?)", arrayOf(name, (!isHidden).toInt(), sortKey), ) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration1To2.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration1To2.kt index 8e99a65a3..56cc534fd 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration1To2.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration1To2.kt @@ -7,48 +7,48 @@ class Migration1To2 : Migration(1, 2) { /** * Adding foreign keys */ - override fun migrate(database: SupportSQLiteDatabase) { + override fun migrate(db: SupportSQLiteDatabase) { /* manga_tags */ - database.execSQL( + db.execSQL( "CREATE TABLE IF NOT EXISTS manga_tags_tmp (manga_id INTEGER NOT NULL, tag_id INTEGER NOT NULL, " + "PRIMARY KEY(manga_id, tag_id), " + "FOREIGN KEY(manga_id) REFERENCES manga(manga_id) ON UPDATE NO ACTION ON DELETE CASCADE, " + "FOREIGN KEY(tag_id) REFERENCES tags(tag_id) ON UPDATE NO ACTION ON DELETE CASCADE )" ) - database.execSQL("CREATE INDEX IF NOT EXISTS index_manga_tags_manga_id ON manga_tags_tmp (manga_id)") - database.execSQL("CREATE INDEX IF NOT EXISTS index_manga_tags_tag_id ON manga_tags_tmp (tag_id)") - database.execSQL("INSERT INTO manga_tags_tmp (manga_id, tag_id) SELECT manga_id, tag_id FROM manga_tags") - database.execSQL("DROP TABLE manga_tags") - database.execSQL("ALTER TABLE manga_tags_tmp RENAME TO manga_tags") + db.execSQL("CREATE INDEX IF NOT EXISTS index_manga_tags_manga_id ON manga_tags_tmp (manga_id)") + db.execSQL("CREATE INDEX IF NOT EXISTS index_manga_tags_tag_id ON manga_tags_tmp (tag_id)") + db.execSQL("INSERT INTO manga_tags_tmp (manga_id, tag_id) SELECT manga_id, tag_id FROM manga_tags") + db.execSQL("DROP TABLE manga_tags") + db.execSQL("ALTER TABLE manga_tags_tmp RENAME TO manga_tags") /* favourites */ - database.execSQL( + db.execSQL( "CREATE TABLE IF NOT EXISTS favourites_tmp (manga_id INTEGER NOT NULL, category_id INTEGER NOT NULL, created_at INTEGER NOT NULL, " + "PRIMARY KEY(manga_id, category_id), " + "FOREIGN KEY(manga_id) REFERENCES manga(manga_id) ON UPDATE NO ACTION ON DELETE CASCADE , " + "FOREIGN KEY(category_id) REFERENCES favourite_categories(category_id) ON UPDATE NO ACTION ON DELETE CASCADE )" ) - database.execSQL("CREATE INDEX IF NOT EXISTS index_favourites_manga_id ON favourites_tmp (manga_id)") - database.execSQL("CREATE INDEX IF NOT EXISTS index_favourites_category_id ON favourites_tmp (category_id)") - database.execSQL("INSERT INTO favourites_tmp (manga_id, category_id, created_at) SELECT manga_id, category_id, created_at FROM favourites") - database.execSQL("DROP TABLE favourites") - database.execSQL("ALTER TABLE favourites_tmp RENAME TO favourites") + db.execSQL("CREATE INDEX IF NOT EXISTS index_favourites_manga_id ON favourites_tmp (manga_id)") + db.execSQL("CREATE INDEX IF NOT EXISTS index_favourites_category_id ON favourites_tmp (category_id)") + db.execSQL("INSERT INTO favourites_tmp (manga_id, category_id, created_at) SELECT manga_id, category_id, created_at FROM favourites") + db.execSQL("DROP TABLE favourites") + db.execSQL("ALTER TABLE favourites_tmp RENAME TO favourites") /* history */ - database.execSQL( + db.execSQL( "CREATE TABLE IF NOT EXISTS history_tmp (manga_id INTEGER NOT NULL, created_at INTEGER NOT NULL, updated_at INTEGER NOT NULL, chapter_id INTEGER NOT NULL, page INTEGER NOT NULL, " + "PRIMARY KEY(manga_id), " + "FOREIGN KEY(manga_id) REFERENCES manga(manga_id) ON UPDATE NO ACTION ON DELETE CASCADE )" ) - database.execSQL("INSERT INTO history_tmp (manga_id, created_at, updated_at, chapter_id, page) SELECT manga_id, created_at, updated_at, chapter_id, page FROM history") - database.execSQL("DROP TABLE history") - database.execSQL("ALTER TABLE history_tmp RENAME TO history") + db.execSQL("INSERT INTO history_tmp (manga_id, created_at, updated_at, chapter_id, page) SELECT manga_id, created_at, updated_at, chapter_id, page FROM history") + db.execSQL("DROP TABLE history") + db.execSQL("ALTER TABLE history_tmp RENAME TO history") /* preferences */ - database.execSQL( + db.execSQL( "CREATE TABLE IF NOT EXISTS preferences_tmp (manga_id INTEGER NOT NULL, mode INTEGER NOT NULL," + " PRIMARY KEY(manga_id), " + "FOREIGN KEY(manga_id) REFERENCES manga(manga_id) ON UPDATE NO ACTION ON DELETE CASCADE )" ) - database.execSQL("INSERT INTO preferences_tmp (manga_id, mode) SELECT manga_id, mode FROM preferences") - database.execSQL("DROP TABLE preferences") - database.execSQL("ALTER TABLE preferences_tmp RENAME TO preferences") + db.execSQL("INSERT INTO preferences_tmp (manga_id, mode) SELECT manga_id, mode FROM preferences") + db.execSQL("DROP TABLE preferences") + db.execSQL("ALTER TABLE preferences_tmp RENAME TO preferences") } -} \ No newline at end of file +} diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration2To3.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration2To3.kt index 018f186a4..b5a36173d 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration2To3.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration2To3.kt @@ -5,7 +5,7 @@ import androidx.sqlite.db.SupportSQLiteDatabase class Migration2To3 : Migration(2, 3) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("ALTER TABLE history ADD COLUMN scroll REAL NOT NULL DEFAULT 0") + override fun migrate(db: SupportSQLiteDatabase) { + db.execSQL("ALTER TABLE history ADD COLUMN scroll REAL NOT NULL DEFAULT 0") } -} \ No newline at end of file +} diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration3To4.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration3To4.kt index 47fca3fce..139e27191 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration3To4.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration3To4.kt @@ -5,7 +5,7 @@ import androidx.sqlite.db.SupportSQLiteDatabase class Migration3To4 : Migration(3, 4) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("CREATE TABLE IF NOT EXISTS tracks (manga_id INTEGER NOT NULL, chapters_total INTEGER NOT NULL, last_chapter_id INTEGER NOT NULL, chapters_new INTEGER NOT NULL, last_check INTEGER NOT NULL, last_notified_id INTEGER NOT NULL, PRIMARY KEY(manga_id), FOREIGN KEY(manga_id) REFERENCES manga(manga_id) ON UPDATE NO ACTION ON DELETE CASCADE )") + override fun migrate(db: SupportSQLiteDatabase) { + db.execSQL("CREATE TABLE IF NOT EXISTS tracks (manga_id INTEGER NOT NULL, chapters_total INTEGER NOT NULL, last_chapter_id INTEGER NOT NULL, chapters_new INTEGER NOT NULL, last_check INTEGER NOT NULL, last_notified_id INTEGER NOT NULL, PRIMARY KEY(manga_id), FOREIGN KEY(manga_id) REFERENCES manga(manga_id) ON UPDATE NO ACTION ON DELETE CASCADE )") } -} \ No newline at end of file +} diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration4To5.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration4To5.kt index a2445ef01..b4144da5f 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration4To5.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration4To5.kt @@ -5,7 +5,7 @@ import androidx.sqlite.db.SupportSQLiteDatabase class Migration4To5 : Migration(4, 5) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("ALTER TABLE favourite_categories ADD COLUMN sort_key INTEGER NOT NULL DEFAULT 0") + override fun migrate(db: SupportSQLiteDatabase) { + db.execSQL("ALTER TABLE favourite_categories ADD COLUMN sort_key INTEGER NOT NULL DEFAULT 0") } -} \ No newline at end of file +} diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration5To6.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration5To6.kt index 4541bf6bb..aeb7acc18 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration5To6.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration5To6.kt @@ -5,8 +5,8 @@ import androidx.sqlite.db.SupportSQLiteDatabase class Migration5To6 : Migration(5, 6) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("CREATE TABLE IF NOT EXISTS track_logs (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, manga_id INTEGER NOT NULL, chapters TEXT NOT NULL, created_at INTEGER NOT NULL, FOREIGN KEY(manga_id) REFERENCES manga(manga_id) ON UPDATE NO ACTION ON DELETE CASCADE)") - database.execSQL("CREATE INDEX IF NOT EXISTS index_track_logs_manga_id ON track_logs (manga_id)") + override fun migrate(db: SupportSQLiteDatabase) { + db.execSQL("CREATE TABLE IF NOT EXISTS track_logs (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, manga_id INTEGER NOT NULL, chapters TEXT NOT NULL, created_at INTEGER NOT NULL, FOREIGN KEY(manga_id) REFERENCES manga(manga_id) ON UPDATE NO ACTION ON DELETE CASCADE)") + db.execSQL("CREATE INDEX IF NOT EXISTS index_track_logs_manga_id ON track_logs (manga_id)") } -} \ No newline at end of file +} diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration6To7.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration6To7.kt index 08c742853..5651c5297 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration6To7.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration6To7.kt @@ -5,7 +5,7 @@ import androidx.sqlite.db.SupportSQLiteDatabase class Migration6To7 : Migration(6, 7) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("ALTER TABLE manga ADD COLUMN public_url TEXT NOT NULL DEFAULT ''") + override fun migrate(db: SupportSQLiteDatabase) { + db.execSQL("ALTER TABLE manga ADD COLUMN public_url TEXT NOT NULL DEFAULT ''") } -} \ No newline at end of file +} diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration7To8.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration7To8.kt index 4a4e781f2..c4471960b 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration7To8.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration7To8.kt @@ -5,9 +5,9 @@ import androidx.sqlite.db.SupportSQLiteDatabase class Migration7To8 : Migration(7, 8) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("ALTER TABLE manga ADD COLUMN nsfw INTEGER NOT NULL DEFAULT 0") - database.execSQL("CREATE TABLE IF NOT EXISTS suggestions (manga_id INTEGER NOT NULL, relevance REAL NOT NULL, created_at INTEGER NOT NULL, PRIMARY KEY(manga_id), FOREIGN KEY(manga_id) REFERENCES manga(manga_id) ON UPDATE NO ACTION ON DELETE CASCADE )") - database.execSQL("CREATE INDEX IF NOT EXISTS index_suggestions_manga_id ON suggestions (manga_id)") + override fun migrate(db: SupportSQLiteDatabase) { + db.execSQL("ALTER TABLE manga ADD COLUMN nsfw INTEGER NOT NULL DEFAULT 0") + db.execSQL("CREATE TABLE IF NOT EXISTS suggestions (manga_id INTEGER NOT NULL, relevance REAL NOT NULL, created_at INTEGER NOT NULL, PRIMARY KEY(manga_id), FOREIGN KEY(manga_id) REFERENCES manga(manga_id) ON UPDATE NO ACTION ON DELETE CASCADE )") + db.execSQL("CREATE INDEX IF NOT EXISTS index_suggestions_manga_id ON suggestions (manga_id)") } -} \ No newline at end of file +} diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration8To9.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration8To9.kt index 768acf7d4..891761001 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration8To9.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration8To9.kt @@ -6,7 +6,7 @@ import org.koitharu.kotatsu.parsers.model.SortOrder class Migration8To9 : Migration(8, 9) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("ALTER TABLE favourite_categories ADD COLUMN `order` TEXT NOT NULL DEFAULT ${SortOrder.NEWEST.name}") + override fun migrate(db: SupportSQLiteDatabase) { + db.execSQL("ALTER TABLE favourite_categories ADD COLUMN `order` TEXT NOT NULL DEFAULT ${SortOrder.NEWEST.name}") } -} \ No newline at end of file +} diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration9To10.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration9To10.kt index 59cba96ef..6aa1dbbf1 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration9To10.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/migrations/Migration9To10.kt @@ -5,7 +5,7 @@ import androidx.sqlite.db.SupportSQLiteDatabase class Migration9To10 : Migration(9, 10) { - override fun migrate(database: SupportSQLiteDatabase) { - database.execSQL("ALTER TABLE favourite_categories ADD COLUMN `track` INTEGER NOT NULL DEFAULT 1") + override fun migrate(db: SupportSQLiteDatabase) { + db.execSQL("ALTER TABLE favourite_categories ADD COLUMN `track` INTEGER NOT NULL DEFAULT 1") } -} \ No newline at end of file +} diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/BaseActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/BaseActivity.kt index 36e45667b..8e4765c9b 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/BaseActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/BaseActivity.kt @@ -97,7 +97,8 @@ abstract class BaseActivity : } override fun onOptionsItemSelected(item: MenuItem) = if (item.itemId == android.R.id.home) { - onBackPressed() + onBackPressedDispatcher.onBackPressed() + // TODO: navigateUpTo true } else super.onOptionsItemSelected(item) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/suggestion/adapter/SearchSuggestionQueryHintAD.kt b/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/suggestion/adapter/SearchSuggestionQueryHintAD.kt index 72df703f7..ede12ed52 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/suggestion/adapter/SearchSuggestionQueryHintAD.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/suggestion/adapter/SearchSuggestionQueryHintAD.kt @@ -12,7 +12,7 @@ fun searchSuggestionQueryHintAD( { inflater, parent -> ItemSearchSuggestionQueryHintBinding.inflate(inflater, parent, false) }, ) { - val viewClickListener = View.OnClickListener { v -> + val viewClickListener = View.OnClickListener { _ -> listener.onQueryClick(item.query, true) } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/suggestions/ui/SuggestionsActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/suggestions/ui/SuggestionsActivity.kt index 9c38cf50c..207091960 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/suggestions/ui/SuggestionsActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/suggestions/ui/SuggestionsActivity.kt @@ -29,8 +29,7 @@ class SuggestionsActivity : if (fm.findFragmentById(R.id.container) == null) { fm.commit { setReorderingAllowed(true) - val fragment = SuggestionsFragment.newInstance() - replace(R.id.container, fragment) + replace(R.id.container, SuggestionsFragment::class.java, null) } } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/tracker/data/TracksDao.kt b/app/src/main/kotlin/org/koitharu/kotatsu/tracker/data/TracksDao.kt index 357a98c57..d0c8267f2 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/tracker/data/TracksDao.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/tracker/data/TracksDao.kt @@ -1,7 +1,7 @@ package org.koitharu.kotatsu.tracker.data import androidx.room.Dao -import androidx.room.MapInfo +import androidx.room.MapColumn import androidx.room.Query import androidx.room.Transaction import androidx.room.Upsert @@ -23,9 +23,8 @@ abstract class TracksDao { @Query("SELECT chapters_new FROM tracks WHERE manga_id = :mangaId") abstract suspend fun findNewChapters(mangaId: Long): Int? - @MapInfo(keyColumn = "manga_id", valueColumn = "chapters_new") @Query("SELECT manga_id, chapters_new FROM tracks") - abstract fun observeNewChaptersMap(): Flow> + abstract fun observeNewChaptersMap(): Flow> @Query("SELECT chapters_new FROM tracks") abstract fun observeNewChapters(): Flow>