Fix issue previewing GIF files

This commit is contained in:
Naveen 2022-11-05 00:54:17 +05:30
parent cd2c94ccee
commit 1c48352432
3 changed files with 8 additions and 6 deletions

View File

@ -933,7 +933,7 @@ class ThreadActivity : SimpleActivity() {
uri = uri, uri = uri,
mimetype = mimeType, mimetype = mimeType,
filename = getFilenameFromUri(uri), filename = getFilenameFromUri(uri),
isPending = mimeType.isImageMimeType() isPending = mimeType.isImageMimeType() && !mimeType.isGifMimeType()
) )
adapter.addAttachment(attachment) adapter.addAttachment(attachment)

View File

@ -20,10 +20,7 @@ import com.bumptech.glide.request.target.Target
import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.smsmessenger.activities.VCardViewerActivity import com.simplemobiletools.smsmessenger.activities.VCardViewerActivity
import com.simplemobiletools.smsmessenger.extensions.config import com.simplemobiletools.smsmessenger.extensions.*
import com.simplemobiletools.smsmessenger.extensions.isImageMimeType
import com.simplemobiletools.smsmessenger.extensions.isVideoMimeType
import com.simplemobiletools.smsmessenger.extensions.launchViewIntent
import com.simplemobiletools.smsmessenger.helpers.* import com.simplemobiletools.smsmessenger.helpers.*
import com.simplemobiletools.smsmessenger.models.AttachmentSelection import com.simplemobiletools.smsmessenger.models.AttachmentSelection
import kotlinx.android.synthetic.main.item_attachment_media_preview.view.* import kotlinx.android.synthetic.main.item_attachment_media_preview.view.*
@ -129,7 +126,8 @@ class AttachmentsAdapter(
} }
} }
if (attachment.mimetype.isImageMimeType() && attachment.isPending && config.mmsFileSizeLimit != FILE_SIZE_NONE) { val compressImage = attachment.mimetype.isImageMimeType() && !attachment.mimetype.isGifMimeType()
if (compressImage && attachment.isPending && config.mmsFileSizeLimit != FILE_SIZE_NONE) {
thumbnail.beGone() thumbnail.beGone()
compression_progress.beVisible() compression_progress.beVisible()

View File

@ -15,6 +15,10 @@ fun String.isImageMimeType(): Boolean {
return lowercase().startsWith("image") return lowercase().startsWith("image")
} }
fun String.isGifMimeType(): Boolean {
return lowercase().endsWith("gif")
}
fun String.isVideoMimeType(): Boolean { fun String.isVideoMimeType(): Boolean {
return lowercase().startsWith("video") return lowercase().startsWith("video")
} }