mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-12 21:35:18 +01:00
Fixed cover being fetched multiple times on update
Should fix bad caching of images as well
This commit is contained in:
parent
e20ea71403
commit
927700f4e2
@ -81,7 +81,7 @@ class LibraryGridHolder(
|
||||
private fun setCover(manga: Manga, id: Long) {
|
||||
if ((adapter.recyclerView.context as? Activity)?.isDestroyed == true) return
|
||||
GlideApp.with(adapter.recyclerView.context).load(manga)
|
||||
.diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
|
||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
||||
.signature(ObjectKey(MangaImpl.getLastCoverFetch(id).toString()))
|
||||
.apply {
|
||||
if (fixedSize) centerCrop()
|
||||
|
@ -368,8 +368,9 @@ class MangaDetailsController : BaseController,
|
||||
/** Get the color of the manga cover based on the current theme */
|
||||
fun setPaletteColor() {
|
||||
val view = view ?: return
|
||||
coverColor = null
|
||||
GlideApp.with(view.context).load(manga)
|
||||
.diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
|
||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
||||
.signature(ObjectKey(MangaImpl.getLastCoverFetch(manga!!.id!!).toString()))
|
||||
.into(object : CustomTarget<Drawable>() {
|
||||
override fun onResourceReady(
|
||||
@ -390,6 +391,7 @@ 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)
|
||||
|
@ -3,6 +3,7 @@ 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
|
||||
@ -255,12 +256,7 @@ class MangaHeaderHolder(
|
||||
}
|
||||
|
||||
if (!manga.initialized) return
|
||||
GlideApp.with(view.context).load(manga).diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
|
||||
.signature(ObjectKey(MangaImpl.getLastCoverFetch(manga.id!!).toString()))
|
||||
.into(manga_cover)
|
||||
GlideApp.with(view.context).load(manga).diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
|
||||
.signature(ObjectKey(MangaImpl.getLastCoverFetch(manga.id!!).toString())).centerCrop()
|
||||
.transition(DrawableTransitionOptions.withCrossFade()).into(backdrop)
|
||||
updateCover(manga)
|
||||
}
|
||||
|
||||
private fun MaterialButton.checked(checked: Boolean) {
|
||||
@ -312,6 +308,18 @@ 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)
|
||||
.signature(ObjectKey(MangaImpl.getLastCoverFetch(manga.id!!).toString()))
|
||||
.into(manga_cover)
|
||||
GlideApp.with(view.context).load(cover ?: manga)
|
||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
||||
.signature(ObjectKey(MangaImpl.getLastCoverFetch(manga.id!!).toString())).centerCrop()
|
||||
.transition(DrawableTransitionOptions.withCrossFade()).into(backdrop)
|
||||
}
|
||||
|
||||
fun expand() {
|
||||
sub_item_group.visible()
|
||||
if (!showMoreButton) more_button_group.gone()
|
||||
|
@ -71,7 +71,7 @@ class RecentMangaHolder(
|
||||
)
|
||||
}
|
||||
GlideApp.with(itemView.context).load(item.mch.manga).diskCacheStrategy(DiskCacheStrategy
|
||||
.AUTOMATIC)
|
||||
.RESOURCE)
|
||||
.signature(ObjectKey(MangaImpl.getLastCoverFetch(item.mch.manga.id!!).toString())).into(cover_thumbnail)
|
||||
notifyStatus(
|
||||
if (adapter.isSelected(adapterPosition)) Download.CHECKED else item.status,
|
||||
|
Loading…
Reference in New Issue
Block a user