File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
app/src/main/java/org/thoughtcrime/securesms/util Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -12,14 +12,14 @@ object AnimatedImageUtils {
12
12
fun isAnimated (context : Context , uri : Uri ): Boolean {
13
13
val mime = context.contentResolver.getType(uri)
14
14
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
17
17
else -> false
18
18
}
19
19
}
20
20
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)
23
23
24
24
var animated = false
25
25
val source = ImageDecoder .createSource(context.contentResolver, uri)
@@ -31,7 +31,7 @@ object AnimatedImageUtils {
31
31
return animated
32
32
}
33
33
34
- private fun isAnimatedWebPLegacy (context : Context , uri : Uri ): Boolean {
34
+ private fun isAnimatedImageLegacy (context : Context , uri : Uri ): Boolean {
35
35
context.contentResolver.openInputStream(uri)?.use { input ->
36
36
val header = ByteArray (32 )
37
37
if (input.read(header) != header.size) return false
You can’t perform that action at this time.
0 commit comments