mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-02-01 18:06:51 +01:00
show video MMS attachments too
This commit is contained in:
parent
0749c0bb9d
commit
0984449a76
@ -172,7 +172,8 @@ class ThreadAdapter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (message.attachment != null) {
|
if (message.attachment != null) {
|
||||||
if (message.attachment.type.startsWith("image/")) {
|
val type = message.attachment.type
|
||||||
|
if (type.startsWith("image/") || type.startsWith("video/")) {
|
||||||
val uri = message.attachment.uri
|
val uri = message.attachment.uri
|
||||||
val options = RequestOptions()
|
val options = RequestOptions()
|
||||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||||
@ -187,7 +188,7 @@ class ThreadAdapter(
|
|||||||
thread_message_image.setOnClickListener {
|
thread_message_image.setOnClickListener {
|
||||||
Intent().apply {
|
Intent().apply {
|
||||||
action = Intent.ACTION_VIEW
|
action = Intent.ACTION_VIEW
|
||||||
setDataAndType(uri, "image/jpeg")
|
setDataAndType(uri, type)
|
||||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||||
activity.startActivity(this)
|
activity.startActivity(this)
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,8 @@ import com.simplemobiletools.commons.helpers.isMarshmallowPlus
|
|||||||
import com.simplemobiletools.commons.helpers.isQPlus
|
import com.simplemobiletools.commons.helpers.isQPlus
|
||||||
import com.simplemobiletools.smsmessenger.helpers.Config
|
import com.simplemobiletools.smsmessenger.helpers.Config
|
||||||
import com.simplemobiletools.smsmessenger.models.Contact
|
import com.simplemobiletools.smsmessenger.models.Contact
|
||||||
import com.simplemobiletools.smsmessenger.models.MessageAttachment
|
|
||||||
import com.simplemobiletools.smsmessenger.models.Message
|
import com.simplemobiletools.smsmessenger.models.Message
|
||||||
|
import com.simplemobiletools.smsmessenger.models.MessageAttachment
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.collections.ArrayList
|
import kotlin.collections.ArrayList
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ fun Context.getMmsAttachment(id: Int): MessageAttachment? {
|
|||||||
val type = cursor.getStringValue(Mms.Part.CONTENT_TYPE)
|
val type = cursor.getStringValue(Mms.Part.CONTENT_TYPE)
|
||||||
if (type == "text/plain") {
|
if (type == "text/plain") {
|
||||||
attachment.text = cursor.getStringValue(Mms.Part.TEXT) ?: ""
|
attachment.text = cursor.getStringValue(Mms.Part.TEXT) ?: ""
|
||||||
} else if (type.startsWith("image/")) {
|
} else if (type.startsWith("image/") || type.startsWith("video/")) {
|
||||||
attachment.uri = Uri.withAppendedPath(uri, partId)
|
attachment.uri = Uri.withAppendedPath(uri, partId)
|
||||||
attachment.type = type
|
attachment.type = type
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user