Skip to content

Commit 9d48cea

Browse files
Merge pull request #1390 from session-foundation/fix/qa-feedback
SES-4282 - not all gifs are animated
2 parents 7e47364 + b9ef5a9 commit 9d48cea

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

app/src/main/java/org/thoughtcrime/securesms/util/AnimatedImageUtils.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ object AnimatedImageUtils {
1212
fun isAnimated(context: Context, uri: Uri): Boolean {
1313
val mime = context.contentResolver.getType(uri)
1414
return when (mime) {
15-
"image/gif" -> true
16-
"image/webp" -> isAnimatedWebP(context, uri) // not all WebPs are animated
15+
"image/gif" -> isAnimatedImage(context, uri) // not all gifs are animated
16+
"image/webp" -> isAnimatedImage(context, uri) // not all WebPs are animated
1717
else -> false
1818
}
1919
}
2020

21-
private fun isAnimatedWebP(context: Context, uri: Uri): Boolean {
22-
if (Build.VERSION.SDK_INT < 28) return isAnimatedWebPLegacy(context, uri)
21+
private fun isAnimatedImage(context: Context, uri: Uri): Boolean {
22+
if (Build.VERSION.SDK_INT < 28) return isAnimatedImageLegacy(context, uri)
2323

2424
var animated = false
2525
val source = ImageDecoder.createSource(context.contentResolver, uri)
@@ -31,7 +31,7 @@ object AnimatedImageUtils {
3131
return animated
3232
}
3333

34-
private fun isAnimatedWebPLegacy(context: Context, uri: Uri): Boolean {
34+
private fun isAnimatedImageLegacy(context: Context, uri: Uri): Boolean {
3535
context.contentResolver.openInputStream(uri)?.use { input ->
3636
val header = ByteArray(32)
3737
if (input.read(header) != header.size) return false

0 commit comments

Comments
 (0)