From caf0ac1c9f599d5ad0362cc603027807fce8c695 Mon Sep 17 00:00:00 2001 From: Valere Date: Fri, 7 Aug 2020 16:48:30 +0200 Subject: [PATCH] Add event sending indicator for attachment --- .../room/detail/timeline/item/MessageFileItem.kt | 4 ++++ .../detail/timeline/item/MessageImageVideoItem.kt | 7 +++++++ .../res/layout/item_timeline_event_file_stub.xml | 15 ++++++++++++++- .../item_timeline_event_media_message_stub.xml | 9 +++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageFileItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageFileItem.kt index b215fa5dd5..aa07a65c17 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageFileItem.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageFileItem.kt @@ -28,6 +28,7 @@ import com.airbnb.epoxy.EpoxyModelClass import im.vector.app.R import im.vector.app.features.home.room.detail.timeline.helper.ContentDownloadStateTrackerBinder import im.vector.app.features.home.room.detail.timeline.helper.ContentUploadStateTrackerBinder +import im.vector.matrix.android.api.session.room.send.SendState @EpoxyModelClass(layout = R.layout.item_timeline_event_base) abstract class MessageFileItem : AbsMessageItem() { @@ -86,6 +87,8 @@ abstract class MessageFileItem : AbsMessageItem() { holder.fileImageWrapper.setOnClickListener(attributes.itemClickListener) holder.fileImageWrapper.setOnLongClickListener(attributes.itemLongClickListener) holder.filenameView.paintFlags = (holder.filenameView.paintFlags or Paint.UNDERLINE_TEXT_FLAG) + + holder.eventSendingIndicator.isVisible = attributes.informationData.sendState == SendState.SENDING || attributes.informationData.sendState == SendState.ENCRYPTING } override fun unbind(holder: Holder) { @@ -103,6 +106,7 @@ abstract class MessageFileItem : AbsMessageItem() { val fileImageWrapper by bind(R.id.messageFileImageView) val fileDownloadProgress by bind(R.id.messageFileProgressbar) val filenameView by bind(R.id.messageFilenameView) + val eventSendingIndicator by bind(R.id.eventSendingIndicator) } companion object { diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageImageVideoItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageImageVideoItem.kt index e8a840918f..0962aba312 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageImageVideoItem.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageImageVideoItem.kt @@ -19,6 +19,8 @@ package im.vector.app.features.home.room.detail.timeline.item import android.view.View import android.view.ViewGroup import android.widget.ImageView +import android.widget.ProgressBar +import android.widget.TextView import androidx.core.view.ViewCompat import androidx.core.view.isVisible import com.airbnb.epoxy.EpoxyAttribute @@ -27,6 +29,7 @@ import im.vector.app.R import im.vector.app.core.glide.GlideApp import im.vector.app.features.home.room.detail.timeline.helper.ContentUploadStateTrackerBinder import im.vector.app.features.media.ImageContentRenderer +import im.vector.matrix.android.api.session.room.send.SendState @EpoxyModelClass(layout = R.layout.item_timeline_event_base) abstract class MessageImageVideoItem : AbsMessageItem() { @@ -60,6 +63,8 @@ abstract class MessageImageVideoItem : AbsMessageItem(R.id.messageMediaUploadProgressLayout) val imageView by bind(R.id.messageThumbnailView) @@ -79,6 +85,7 @@ abstract class MessageImageVideoItem : AbsMessageItem(R.id.messageContentMedia) val failedToSendIndicator by bind(R.id.messageFailToSendIndicator) + val eventSendingIndicator by bind(R.id.eventSendingIndicator) } companion object { diff --git a/vector/src/main/res/layout/item_timeline_event_file_stub.xml b/vector/src/main/res/layout/item_timeline_event_file_stub.xml index a67d14168b..efd85fc31f 100644 --- a/vector/src/main/res/layout/item_timeline_event_file_stub.xml +++ b/vector/src/main/res/layout/item_timeline_event_file_stub.xml @@ -42,7 +42,9 @@ + + + + +