From 439029467ad0c65d28ed8df1fb1f4a4e5f14e4cc Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 1 Dec 2020 17:37:06 +0100 Subject: [PATCH] Attachment preview also for Gif files --- .idea/dictionaries/bmarty.xml | 2 ++ .../vector/app/features/attachments/ContentAttachmentData.kt | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.idea/dictionaries/bmarty.xml b/.idea/dictionaries/bmarty.xml index 5ad39614b7..16cc35cebe 100644 --- a/.idea/dictionaries/bmarty.xml +++ b/.idea/dictionaries/bmarty.xml @@ -24,6 +24,8 @@ pbkdf pids pkcs + previewable + previewables riotx signin signout diff --git a/vector/src/main/java/im/vector/app/features/attachments/ContentAttachmentData.kt b/vector/src/main/java/im/vector/app/features/attachments/ContentAttachmentData.kt index bd13c0dac4..3ca4f1b13e 100644 --- a/vector/src/main/java/im/vector/app/features/attachments/ContentAttachmentData.kt +++ b/vector/src/main/java/im/vector/app/features/attachments/ContentAttachmentData.kt @@ -18,10 +18,12 @@ package im.vector.app.features.attachments import org.matrix.android.sdk.api.session.content.ContentAttachmentData +private val listOfPreviewableMimeTypes = listOf("image/jpeg", "image/png", "image/jpg", "image/gif") + fun ContentAttachmentData.isPreviewable(): Boolean { // For now the preview only supports still image return type == ContentAttachmentData.Type.IMAGE - && listOf("image/jpeg", "image/png", "image/jpg").contains(getSafeMimeType() ?: "") + && listOfPreviewableMimeTypes.contains(getSafeMimeType() ?: "") } data class GroupedContentAttachmentData(