mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Fix regression from coil3 migration
Fixes #495 Co-authored-by: jobobby04 <17078382+jobobby04@users.noreply.github.com>
This commit is contained in:
parent
ebee275110
commit
59bedb33ff
2 changed files with 10 additions and 8 deletions
|
@ -349,8 +349,9 @@ open class ReaderPageImageView @JvmOverloads constructor(
|
||||||
.diskCachePolicy(CachePolicy.DISABLED)
|
.diskCachePolicy(CachePolicy.DISABLED)
|
||||||
.target(
|
.target(
|
||||||
onSuccess = { result ->
|
onSuccess = { result ->
|
||||||
setImageDrawable(result.asDrawable(context.resources))
|
val drawable = result.asDrawable(context.resources)
|
||||||
(result as? Animatable)?.start()
|
setImageDrawable(drawable)
|
||||||
|
(drawable as? Animatable)?.start()
|
||||||
isVisible = true
|
isVisible = true
|
||||||
this@ReaderPageImageView.onImageLoaded()
|
this@ReaderPageImageView.onImageLoaded()
|
||||||
},
|
},
|
||||||
|
|
|
@ -77,19 +77,20 @@ object ImageUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isAnimatedAndSupported(stream: InputStream): Boolean {
|
fun isAnimatedAndSupported(stream: InputStream): Boolean {
|
||||||
try {
|
return try {
|
||||||
val type = getImageType(stream) ?: return false
|
val type = getImageType(stream) ?: return false
|
||||||
return when (type.format) {
|
|
||||||
Format.Gif -> true
|
|
||||||
// Coil supports animated WebP on Android 9.0+
|
|
||||||
// https://coil-kt.github.io/coil/getting_started/#supported-image-formats
|
// https://coil-kt.github.io/coil/getting_started/#supported-image-formats
|
||||||
|
when (type.format) {
|
||||||
|
Format.Gif -> true
|
||||||
|
// Animated WebP on Android 9+
|
||||||
Format.Webp -> type.isAnimated && Build.VERSION.SDK_INT >= Build.VERSION_CODES.P
|
Format.Webp -> type.isAnimated && Build.VERSION.SDK_INT >= Build.VERSION_CODES.P
|
||||||
|
// Animated Heif on Android 11+
|
||||||
|
Format.Heif -> type.isAnimated && Build.VERSION.SDK_INT >= Build.VERSION_CODES.R
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
/* Do Nothing */
|
false
|
||||||
}
|
}
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getImageType(stream: InputStream): tachiyomi.decoder.ImageType? {
|
private fun getImageType(stream: InputStream): tachiyomi.decoder.ImageType? {
|
||||||
|
|
Loading…
Reference in a new issue