fix some cover related stuff

This commit is contained in:
jmir1 2021-07-31 00:46:07 +02:00
parent 3ec6c52978
commit b20f9bbae8
3 changed files with 7 additions and 5 deletions

View file

@ -307,9 +307,11 @@ class LocalAnimeSource(private val context: Context) : AnimeCatalogueSource {
}
}
is Format.Anime -> {
if (!anime.thumbnail_url.isNullOrBlank()) {
File(anime.thumbnail_url!!)
} else null
val entry = format.file.listFiles()
?.sortedWith { f1, f2 -> f1.name.compareToCaseInsensitiveNaturalOrder(f2.name) }
?.find { !it.isDirectory && ImageUtil.isImage(it.name) { FileInputStream(it) } }
entry?.let { updateCover(context, anime, it.inputStream()) }
}
}
}

View file

@ -57,7 +57,7 @@ class AnimeSourceComfortableGridHolder(private val view: View, private val adapt
if (it is CrossfadeTransition) it.durationMillis else 0
}
val request = ImageRequest.Builder(view.context)
.data(anime.thumbnail_url)
.data(anime)
.setParameter(AnimeCoverFetcher.USE_CUSTOM_COVER, false)
.target(StateImageViewTarget(binding.thumbnail, binding.progress, crossfadeDuration))
.build()

View file

@ -57,7 +57,7 @@ open class AnimeSourceGridHolder(private val view: View, private val adapter: Fl
if (it is CrossfadeTransition) it.durationMillis else 0
}
val request = ImageRequest.Builder(view.context)
.data(anime.thumbnail_url)
.data(anime)
.setParameter(AnimeCoverFetcher.USE_CUSTOM_COVER, false)
.target(StateImageViewTarget(binding.thumbnail, binding.progress, crossfadeDuration))
.build()