From f63db1cc2c108e7857a479e201b8df41ff24879f Mon Sep 17 00:00:00 2001 From: Jay Date: Wed, 6 Nov 2019 20:56:50 -0800 Subject: [PATCH] Fixes to notifactions icons and loading reader --- .../tachiyomi/data/database/queries/ChapterQueries.kt | 8 ++++++++ .../kanade/tachiyomi/data/library/LibraryUpdateService.kt | 3 ++- .../java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt | 2 +- .../java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/ChapterQueries.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/ChapterQueries.kt index b6cb58670d..c10d0b9367 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/ChapterQueries.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/queries/ChapterQueries.kt @@ -52,6 +52,14 @@ interface ChapterQueries : DbProvider { .build()) .prepare() + fun getChapter(url: String, mangaId: Long) = db.get() + .`object`(Chapter::class.java) + .withQuery(Query.builder() + .table(ChapterTable.TABLE) + .where("${ChapterTable.COL_URL} = ? AND ${ChapterTable.COL_MANGA_ID} = ?") + .whereArgs(url, mangaId) + .build()) + .prepare() fun insertChapter(chapter: Chapter) = db.put().`object`(chapter).prepare() diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt index 0dab6ac0b5..8b74506fa6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt @@ -456,7 +456,8 @@ class LibraryUpdateService( setSmallIcon(R.drawable.ic_book_white_24dp) try { val icon = GlideApp.with(this@LibraryUpdateService) - .asBitmap().load(manga).centerCrop().circleCrop().submit().get() + .asBitmap().load(manga).dontTransform().centerCrop().circleCrop() + .override(256, 256).submit().get() setLargeIcon(icon) } catch (e: Exception) { } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index 0165ff919f..ffad71a392 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -153,7 +153,7 @@ class ReaderActivity : BaseRxActivity(), return } - if (chapterUrl.isEmpty()) presenter.init(manga, chapter) + if (chapter > -1) presenter.init(manga, chapter) else presenter.init(manga, chapterUrl) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt index 4b391f3c2d..77877d52a9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt @@ -189,7 +189,7 @@ class ReaderPresenter( if (!needsInit()) return val context = Injekt.get() val db = DatabaseHelper(context) - val chapterId = db.getChapter(chapterUrl).executeAsBlocking()?.id + val chapterId = db.getChapter(chapterUrl, mangaId).executeAsBlocking()?.id if (chapterId != null) init(mangaId, chapterId) }