Commit dfcda352 authored by Utkarsh Barsaiyan's avatar Utkarsh Barsaiyan

Added text and description fields for Image Attachment

parent 35ed646c
......@@ -28,6 +28,8 @@ class ImageAttachmentViewHolder(
}.build()
image_attachment.controller = controller
file_name.text = data.attachmentTitle
file_description.text = data.attachmentDescription
file_text.text = data.attachmentText
image_attachment.setOnClickListener {
ImageHelper.openImage(
context,
......
......@@ -10,6 +10,8 @@ data class ImageAttachmentUiModel(
override val messageId: String,
override val attachmentUrl: String,
override val attachmentTitle: CharSequence,
val attachmentText: String?,
val attachmentDescription: String?,
override val id: Long,
override var reactions: List<ReactionUiModel>,
override var nextDownStreamMessage: BaseUiModel<*>? = null,
......
......@@ -285,10 +285,12 @@ class UiModelMapper @Inject constructor(
private fun mapFileAttachment(message: Message, attachment: FileAttachment): BaseUiModel<*>? {
val attachmentUrl = attachmentUrl(attachment)
val attachmentTitle = attachmentTitle(attachment)
val attachmentText = attachmentText(attachment)
val attachmentDescription = attachmentDescription(attachment)
val id = attachmentId(message, attachment)
return when (attachment) {
is ImageAttachment -> ImageAttachmentUiModel(message, attachment, message.id,
attachmentUrl, attachmentTitle, id, getReactions(message),
attachmentUrl, attachmentTitle, attachmentText, attachmentDescription, id, getReactions(message),
preview = message.copy(message = context.getString(R.string.msg_preview_photo)))
is VideoAttachment -> VideoAttachmentUiModel(message, attachment, message.id,
attachmentUrl, attachmentTitle, id, getReactions(message),
......@@ -338,6 +340,17 @@ class UiModelMapper @Inject constructor(
}
}
private fun attachmentText(attachment: FileAttachment): String? {
return with(attachment) {
return@with text
}
}
private fun attachmentDescription(attachment: FileAttachment): String? {
return with(attachment) {
return@with description
}
}
private suspend fun mapMessage(message: Message): MessageUiModel = withContext(CommonPool) {
val sender = getSenderName(message)
val time = getTime(message.timestamp)
......
......@@ -10,6 +10,20 @@
android:paddingEnd="@dimen/screen_edge_left_and_right_margins"
android:paddingStart="72dp">
<TextView
android:id="@+id/file_name"
style="@style/Message.TextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Filename.png" />
<TextView
android:id="@+id/file_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Some description" />
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/image_attachment"
android:layout_width="match_parent"
......@@ -34,10 +48,10 @@
</FrameLayout>
<TextView
android:id="@+id/file_name"
android:id="@+id/file_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Filename.png" />
tools:text="Some text" />
<include
layout="@layout/layout_reactions"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment