From 8d88d1a73986ef8fdb6d03d36d536dccf6993fc0 Mon Sep 17 00:00:00 2001 From: Jay Date: Mon, 13 Apr 2020 01:07:10 -0400 Subject: [PATCH] Setting cover in reader sets the custom cover flag --- .../eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt | 3 +-- .../eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt | 2 +- .../java/eu/kanade/tachiyomi/ui/reader/ReaderPresenter.kt | 6 +++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt index 5777bcb818..639f4bf6a5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsController.kt @@ -690,13 +690,12 @@ class MangaDetailsController : BaseController, menu.findItem(R.id.action_mark_all_as_read).isVisible = presenter.getNextUnreadChapter() != null && !presenter.isLockedFromSearch menu.findItem(R.id.action_mark_all_as_unread).isVisible = - !presenter.allUnread() && !presenter.isLockedFromSearch + presenter.anyUnread() && !presenter.isLockedFromSearch menu.findItem(R.id.action_remove_downloads).isVisible = presenter.hasDownloads() && !presenter.isLockedFromSearch && manga?.source != LocalSource.ID menu.findItem(R.id.remove_non_bookmarked).isVisible = presenter.hasBookmark() && !presenter.isLockedFromSearch - menu.findItem(R.id.action_mark_all_as_unread).isVisible = presenter.isTracked() menu.findItem(R.id.action_migrate).isVisible = !presenter.isLockedFromSearch && manga?.source != LocalSource.ID && presenter.manga.favorite menu.findItem(R.id.action_migrate).title = view?.context?.getString(R.string.migrate_, diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt index 78e81608af..f2ad380ca4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt @@ -319,7 +319,7 @@ class MangaDetailsPresenter( return chapters.sortedByDescending { it.source_order }.find { !it.read } } - fun allUnread(): Boolean = chapters.none { it.read } + fun anyUnread(): Boolean = chapters.any { !it.read } fun hasBookmark(): Boolean = chapters.any { it.bookmark } fun hasDownloads(): Boolean = chapters.any { it.isDownloaded } 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 6cfe288fc0..dc8064be58 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 @@ -535,7 +535,11 @@ class ReaderPresenter( } else { val thumbUrl = manga.thumbnail_url ?: throw Exception("Image url not found") if (manga.favorite) { - coverCache.copyToCache(thumbUrl, stream()) + if (!manga.hasCustomCover()) { + manga.thumbnail_url = "Custom-${manga.thumbnail_url ?: manga.id!!}" + db.insertManga(manga).executeAsBlocking() + } + coverCache.copyToCache(manga.thumbnail_url!!, stream()) MangaImpl.setLastCoverFetch(manga.id!!, Date().time) SetAsCoverResult.Success } else {