diff --git a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt
index 49ba7cf37..0c0573fbb 100644
--- a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt
+++ b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt
@@ -122,6 +122,7 @@ import com.nextcloud.talk.adapters.messages.OutcomingPreviewMessageViewHolder
import com.nextcloud.talk.adapters.messages.OutcomingTextMessageViewHolder
import com.nextcloud.talk.adapters.messages.OutcomingVoiceMessageViewHolder
import com.nextcloud.talk.adapters.messages.PreviewMessageInterface
+import com.nextcloud.talk.adapters.messages.PreviewMessageViewHolder
import com.nextcloud.talk.adapters.messages.SystemMessageViewHolder
import com.nextcloud.talk.adapters.messages.TalkMessagesListAdapter
import com.nextcloud.talk.adapters.messages.UnreadNoticeMessageViewHolder
@@ -173,6 +174,7 @@ import com.nextcloud.talk.utils.DateConstants
import com.nextcloud.talk.utils.DateUtils
import com.nextcloud.talk.utils.DisplayUtils
import com.nextcloud.talk.utils.FileUtils
+import com.nextcloud.talk.utils.FileViewerUtils
import com.nextcloud.talk.utils.ImageEmojiEditText
import com.nextcloud.talk.utils.MagicCharPolicy
import com.nextcloud.talk.utils.NotificationUtils
@@ -3455,6 +3457,13 @@ class ChatActivity :
startActivity(intent)
}
+ fun openInFilesApp(message: ChatMessage) {
+ val keyID = message.selectedIndividualHashMap!![PreviewMessageViewHolder.KEY_ID]
+ val link = message.selectedIndividualHashMap!!["link"]
+ val fileViewerUtils = FileViewerUtils(this, message.activeUser!!)
+ fileViewerUtils.openFileInFilesApp(link!!, keyID!!)
+ }
+
private fun hasVisibleItems(message: ChatMessage): Boolean {
return !message.isDeleted || // copy message
message.replyable || // reply to
diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt
index 87384a286..565bb8c76 100644
--- a/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt
+++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt
@@ -111,6 +111,9 @@ class MessageActionsDialog(
message.previousMessageId > NO_PREVIOUS_MESSAGE_ID &&
ChatMessage.MessageType.SYSTEM_MESSAGE != message.getCalculateMessageType()
)
+ initMenuItemOpenNcApp(
+ ChatMessage.MessageType.SINGLE_NC_ATTACHMENT_MESSAGE == message.getCalculateMessageType()
+ )
}
override fun onStart() {
@@ -314,6 +317,17 @@ class MessageActionsDialog(
dialogMessageActionsBinding.menuTranslateMessage.visibility = getVisibility(visible)
}
+ private fun initMenuItemOpenNcApp(visible: Boolean) {
+ if (visible) {
+ dialogMessageActionsBinding.menuOpenInNcApp.setOnClickListener {
+ chatActivity.openInFilesApp(message)
+ dismiss()
+ }
+ }
+
+ dialogMessageActionsBinding.menuOpenInNcApp.visibility = getVisibility(visible)
+ }
+
private fun getVisibility(visible: Boolean): Int {
return if (visible) {
View.VISIBLE
diff --git a/app/src/main/res/layout/dialog_message_actions.xml b/app/src/main/res/layout/dialog_message_actions.xml
index ebbf99827..9610f8048 100644
--- a/app/src/main/res/layout/dialog_message_actions.xml
+++ b/app/src/main/res/layout/dialog_message_actions.xml
@@ -320,6 +320,39 @@
+
+
+
+
+
+
+
+