mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 16:11:51 +01:00
Fixed logic on fetching cached images in manga details
This commit is contained in:
parent
f046f12311
commit
821f068728
@ -53,7 +53,7 @@ class MangaDetailsPresenter(
|
||||
val manga: Manga,
|
||||
val source: Source,
|
||||
val preferences: PreferencesHelper = Injekt.get(),
|
||||
private val coverCache: CoverCache = Injekt.get(),
|
||||
val coverCache: CoverCache = Injekt.get(),
|
||||
private val db: DatabaseHelper = Injekt.get(),
|
||||
private val downloadManager: DownloadManager = Injekt.get()
|
||||
) : DownloadQueue.DownloadListener, LibraryServiceListener {
|
||||
|
@ -308,7 +308,7 @@ class MangaHeaderHolder(
|
||||
}
|
||||
|
||||
fun updateCover(manga: Manga, force: Boolean = false) {
|
||||
if (!manga.initialized || (adapter.delegate.coverColor() == null && manga.favorite && !force)) return
|
||||
if (!isCached(manga)) return
|
||||
GlideApp.with(view.context).load(manga).diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
||||
.signature(ObjectKey(MangaImpl.getLastCoverFetch(manga.id!!).toString()))
|
||||
.into(manga_cover)
|
||||
@ -317,6 +317,15 @@ class MangaHeaderHolder(
|
||||
.transition(DrawableTransitionOptions.withCrossFade()).into(backdrop)
|
||||
}
|
||||
|
||||
private fun isCached(manga: Manga): Boolean {
|
||||
val coverCache = adapter.delegate.mangaPresenter().coverCache
|
||||
manga.thumbnail_url?.let {
|
||||
return if (manga.favorite) coverCache.getCoverFile(it).exists()
|
||||
else true
|
||||
}
|
||||
return manga.initialized
|
||||
}
|
||||
|
||||
fun expand() {
|
||||
sub_item_group.visible()
|
||||
if (!showMoreButton) more_button_group.gone()
|
||||
|
Loading…
Reference in New Issue
Block a user