Fixed covers (espicially gif covers) while browsing

This commit is contained in:
Jay 2020-05-09 14:52:10 -04:00
parent d511638861
commit 892edd2b92
2 changed files with 6 additions and 10 deletions

View File

@ -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<Drawable>() {
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?) {}

View File

@ -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)
}