From 87086c434c76a47c15432ecc6a27fd9c3f1367a8 Mon Sep 17 00:00:00 2001 From: Naveen Date: Tue, 16 Apr 2024 19:18:21 +0530 Subject: [PATCH] Always decode non-animated images as bitmap This closes https://github.com/FossifyOrg/Gallery/issues/148 TODO: Animate APNG thumbnails. --- .../main/kotlin/org/fossify/gallery/extensions/Context.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/org/fossify/gallery/extensions/Context.kt b/app/src/main/kotlin/org/fossify/gallery/extensions/Context.kt index 9438687f3..4af68520a 100644 --- a/app/src/main/kotlin/org/fossify/gallery/extensions/Context.kt +++ b/app/src/main/kotlin/org/fossify/gallery/extensions/Context.kt @@ -540,8 +540,9 @@ fun Context.loadImageBase( options.optionalTransform(WebpDrawable::class.java, WebpDrawableTransformation(FitCenter())) } - // animation is only supported without rounded corners - if (animate && roundCorners == ROUNDED_CORNERS_NONE) { + // animation is only supported without rounded corners and the file must be a GIF or WEBP. + // Glide doesn't support animated AVIF: https://bumptech.github.io/glide/int/avif.html + if (animate && roundCorners == ROUNDED_CORNERS_NONE && (path.isGif() || path.isWebP())) { // this is required to make glide cache aware of changes options.decode(Drawable::class.java) } else {