mirror of
https://github.com/nextcloud/talk-android
synced 2025-01-31 11:32:00 +00:00
Can now open preview messages in the files app in message actions
Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
This commit is contained in:
parent
fd67eaedf3
commit
fa5e0fb01d
@ -122,6 +122,7 @@ import com.nextcloud.talk.adapters.messages.OutcomingPreviewMessageViewHolder
|
|||||||
import com.nextcloud.talk.adapters.messages.OutcomingTextMessageViewHolder
|
import com.nextcloud.talk.adapters.messages.OutcomingTextMessageViewHolder
|
||||||
import com.nextcloud.talk.adapters.messages.OutcomingVoiceMessageViewHolder
|
import com.nextcloud.talk.adapters.messages.OutcomingVoiceMessageViewHolder
|
||||||
import com.nextcloud.talk.adapters.messages.PreviewMessageInterface
|
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.SystemMessageViewHolder
|
||||||
import com.nextcloud.talk.adapters.messages.TalkMessagesListAdapter
|
import com.nextcloud.talk.adapters.messages.TalkMessagesListAdapter
|
||||||
import com.nextcloud.talk.adapters.messages.UnreadNoticeMessageViewHolder
|
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.DateUtils
|
||||||
import com.nextcloud.talk.utils.DisplayUtils
|
import com.nextcloud.talk.utils.DisplayUtils
|
||||||
import com.nextcloud.talk.utils.FileUtils
|
import com.nextcloud.talk.utils.FileUtils
|
||||||
|
import com.nextcloud.talk.utils.FileViewerUtils
|
||||||
import com.nextcloud.talk.utils.ImageEmojiEditText
|
import com.nextcloud.talk.utils.ImageEmojiEditText
|
||||||
import com.nextcloud.talk.utils.MagicCharPolicy
|
import com.nextcloud.talk.utils.MagicCharPolicy
|
||||||
import com.nextcloud.talk.utils.NotificationUtils
|
import com.nextcloud.talk.utils.NotificationUtils
|
||||||
@ -3455,6 +3457,13 @@ class ChatActivity :
|
|||||||
startActivity(intent)
|
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 {
|
private fun hasVisibleItems(message: ChatMessage): Boolean {
|
||||||
return !message.isDeleted || // copy message
|
return !message.isDeleted || // copy message
|
||||||
message.replyable || // reply to
|
message.replyable || // reply to
|
||||||
|
@ -111,6 +111,9 @@ class MessageActionsDialog(
|
|||||||
message.previousMessageId > NO_PREVIOUS_MESSAGE_ID &&
|
message.previousMessageId > NO_PREVIOUS_MESSAGE_ID &&
|
||||||
ChatMessage.MessageType.SYSTEM_MESSAGE != message.getCalculateMessageType()
|
ChatMessage.MessageType.SYSTEM_MESSAGE != message.getCalculateMessageType()
|
||||||
)
|
)
|
||||||
|
initMenuItemOpenNcApp(
|
||||||
|
ChatMessage.MessageType.SINGLE_NC_ATTACHMENT_MESSAGE == message.getCalculateMessageType()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
@ -314,6 +317,17 @@ class MessageActionsDialog(
|
|||||||
dialogMessageActionsBinding.menuTranslateMessage.visibility = getVisibility(visible)
|
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 {
|
private fun getVisibility(visible: Boolean): Int {
|
||||||
return if (visible) {
|
return if (visible) {
|
||||||
View.VISIBLE
|
View.VISIBLE
|
||||||
|
@ -320,6 +320,39 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/menu_open_in_nc_app"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/bottom_sheet_item_height"
|
||||||
|
android:background="?android:attr/selectableItemBackground"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
tools:ignore="UseCompoundDrawables">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/menu_icon_open_in_nc_app"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:contentDescription="@null"
|
||||||
|
android:paddingStart="@dimen/standard_padding"
|
||||||
|
android:paddingEnd="@dimen/zero"
|
||||||
|
android:src="@drawable/ic_exit_to_app_black_24dp"
|
||||||
|
app:tint="@color/high_emphasis_menu_icon" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/menu_text_open_in_nc_app"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="start|center_vertical"
|
||||||
|
android:paddingStart="@dimen/standard_double_padding"
|
||||||
|
android:paddingEnd="@dimen/standard_padding"
|
||||||
|
android:text="@string/open_in_files_app"
|
||||||
|
android:textAlignment="viewStart"
|
||||||
|
android:textColor="@color/high_emphasis_text"
|
||||||
|
android:textSize="@dimen/bottom_sheet_text_size" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/menu_delete_message"
|
android:id="@+id/menu_delete_message"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
Loading…
Reference in New Issue
Block a user