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 1d83a1292c..feb45edf64 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 @@ -369,8 +369,7 @@ class MangaDetailsController : BaseController, fun setPaletteColor() { val view = view ?: return coverColor = null - GlideApp.with(view.context).load(manga) - .diskCacheStrategy(DiskCacheStrategy.RESOURCE) + GlideApp.with(view.context).load(manga).diskCacheStrategy(DiskCacheStrategy.RESOURCE) .signature(ObjectKey(MangaImpl.getLastCoverFetch(manga!!.id!!).toString())) .into(object : CustomTarget() { override fun onResourceReady( @@ -391,13 +390,13 @@ class MangaDetailsController : BaseController, } coverColor = backDropColor getHeader()?.setBackDrop(backDropColor) - getHeader()?.updateCover(presenter.manga, resource) if (toolbarIsColored) { val translucentColor = ColorUtils.setAlphaComponent(backDropColor, 175) (activity as MainActivity).toolbar.setBackgroundColor(translucentColor) activity?.window?.statusBarColor = translucentColor } } + getHeader()?.updateCover(presenter.manga, true) } override fun onLoadCleared(placeholder: Drawable?) {} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt index 6f67080a11..416a26bdf2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaHeaderHolder.kt @@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.ui.manga import android.annotation.SuppressLint import android.content.res.ColorStateList import android.graphics.Color -import android.graphics.drawable.Drawable import android.view.MotionEvent import android.view.View import android.view.ViewGroup @@ -308,14 +307,12 @@ class MangaHeaderHolder( } } - fun updateCover(manga: Manga, cover: Drawable? = null) { - if (adapter.delegate.coverColor() == null) return - GlideApp.with(view.context).load(cover ?: manga) - .diskCacheStrategy(DiskCacheStrategy.RESOURCE) + fun updateCover(manga: Manga, force: Boolean = false) { + if (!manga.initialized || (adapter.delegate.coverColor() == null && manga.favorite && !force)) return + GlideApp.with(view.context).load(manga).diskCacheStrategy(DiskCacheStrategy.RESOURCE) .signature(ObjectKey(MangaImpl.getLastCoverFetch(manga.id!!).toString())) .into(manga_cover) - GlideApp.with(view.context).load(cover ?: manga) - .diskCacheStrategy(DiskCacheStrategy.RESOURCE) + GlideApp.with(view.context).load(manga).diskCacheStrategy(DiskCacheStrategy.RESOURCE) .signature(ObjectKey(MangaImpl.getLastCoverFetch(manga.id!!).toString())).centerCrop() .transition(DrawableTransitionOptions.withCrossFade()).into(backdrop) }