From 4f90fcbe2b49788ebf6d7a903f50fec7403b1ae5 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Thu, 31 Aug 2023 10:34:25 -0300 Subject: [PATCH] Corrected ui dimentions for each media attachment on reply thread --- .../messageholder/HolderBindingExtensions.kt | 31 +++++++++++++++++++ .../sphinx/chat_tribe/ui/ChatTribeFragment.kt | 6 ++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/sphinx/screens/chats/chat-common/chat-common/src/main/java/chat/sphinx/chat_common/ui/viewstate/messageholder/HolderBindingExtensions.kt b/sphinx/screens/chats/chat-common/chat-common/src/main/java/chat/sphinx/chat_common/ui/viewstate/messageholder/HolderBindingExtensions.kt index 665c64233f..1cd44fea8d 100644 --- a/sphinx/screens/chats/chat-common/chat-common/src/main/java/chat/sphinx/chat_common/ui/viewstate/messageholder/HolderBindingExtensions.kt +++ b/sphinx/screens/chats/chat-common/chat-common/src/main/java/chat/sphinx/chat_common/ui/viewstate/messageholder/HolderBindingExtensions.kt @@ -1066,12 +1066,33 @@ internal inline fun LayoutMessageHolderBinding.setBubbleThreadLayout( when (thread.mediaAttachment) { is LayoutState.Bubble.ContainerSecond.ImageAttachment -> { + constraintMediaThreadContainer.visible + + includeMessageTypeImageAttachment.root.visible + includeMessageTypeVideoAttachment.root.gone + includeMessageTypeAudioAttachment.root.gone + includeMessageTypeFileAttachment.root.gone + setBubbleImageAttachment(thread.mediaAttachment, true, lastReplyImage) } is LayoutState.Bubble.ContainerSecond.VideoAttachment -> { + constraintMediaThreadContainer.visible + + includeMessageTypeImageAttachment.root.gone + includeMessageTypeVideoAttachment.root.visible + includeMessageTypeAudioAttachment.root.gone + includeMessageTypeFileAttachment.root.gone + setBubbleVideoAttachment(thread.mediaAttachment, true) } is LayoutState.Bubble.ContainerSecond.AudioAttachment -> { + constraintMediaThreadContainer.visible + + includeMessageTypeImageAttachment.root.gone + includeMessageTypeVideoAttachment.root.gone + includeMessageTypeAudioAttachment.root.visible + includeMessageTypeFileAttachment.root.gone + setBubbleAudioAttachment( thread.mediaAttachment, audioPlayerController, @@ -1081,8 +1102,18 @@ internal inline fun LayoutMessageHolderBinding.setBubbleThreadLayout( true) } is LayoutState.Bubble.ContainerSecond.FileAttachment -> { + constraintMediaThreadContainer.visible + + includeMessageTypeImageAttachment.root.gone + includeMessageTypeVideoAttachment.root.gone + includeMessageTypeAudioAttachment.root.gone + includeMessageTypeFileAttachment.root.visible + setBubbleFileAttachment(thread.mediaAttachment, true) } + else -> { + constraintMediaThreadContainer.gone + } } } } diff --git a/sphinx/screens/chats/chat-tribe/chat-tribe/src/main/java/chat/sphinx/chat_tribe/ui/ChatTribeFragment.kt b/sphinx/screens/chats/chat-tribe/chat-tribe/src/main/java/chat/sphinx/chat_tribe/ui/ChatTribeFragment.kt index b523cd6cf8..29f35626f6 100644 --- a/sphinx/screens/chats/chat-tribe/chat-tribe/src/main/java/chat/sphinx/chat_tribe/ui/ChatTribeFragment.kt +++ b/sphinx/screens/chats/chat-tribe/chat-tribe/src/main/java/chat/sphinx/chat_tribe/ui/ChatTribeFragment.kt @@ -708,7 +708,7 @@ internal class ChatTribeFragment: ChatFragment< ) } - viewState.senderAlias?.let { senderAlias -> + viewState.senderAlias.let { senderAlias -> textViewPinnedBottomBodyUsername.text = senderAlias textViewPinnedBottomBodyUsername.setTextColor( Color.parseColor( @@ -814,7 +814,7 @@ internal class ChatTribeFragment: ChatFragment< it, ImageLoaderOptions.Builder().build() ) - } ?: imageAttachment?.url?.let { + } ?: imageAttachment.url.let { imageLoader.load( imageViewElementPicture, it, @@ -846,12 +846,12 @@ internal class ChatTribeFragment: ChatFragment< threadOriginalMessageBinding?.textViewThreadMessageContent?.text = it.fileName?.value ?: "Unnamed File" } } + viewState.audioAttachment?.let { audioAttachment -> layoutConstraintMediaContainer.visible textViewAttachmentFileIcon.visible textViewAttachmentFileIcon.text = getString(chat.sphinx.chat_common.R.string.material_icon_name_volume_up) threadOriginalMessageBinding?.textViewThreadMessageContent?.text = "Audio Clip" - } } }