diff --git a/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/RoomDetailFragment.kt b/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/RoomDetailFragment.kt index 1cabc032d7..3bf3453411 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/RoomDetailFragment.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/RoomDetailFragment.kt @@ -542,6 +542,10 @@ class RoomDetailFragment : roomDetailViewModel.process(RoomDetailActions.EventDisplayed(event)) } + override fun onEncryptedMessageClicked(informationData: MessageInformationData, view: View) { + vectorBaseActivity.notImplemented("encrypted message click") + } + override fun onImageMessageClicked(messageImageContent: MessageImageContent, mediaData: ImageContentRenderer.Data, view: View) { val intent = ImageMediaViewerActivity.newIntent(vectorBaseActivity, mediaData) startActivity(intent) @@ -576,7 +580,7 @@ class RoomDetailFragment : } override fun onAvatarClicked(informationData: MessageInformationData) { - vectorBaseActivity.notImplemented() + vectorBaseActivity.notImplemented("Click on user avatar") } @SuppressLint("SetTextI18n") diff --git a/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/TimelineEventController.kt b/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/TimelineEventController.kt index 5b325c4ae9..1b06088334 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/TimelineEventController.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/TimelineEventController.kt @@ -49,6 +49,7 @@ class TimelineEventController(private val dateFormatter: TimelineDateFormatter, interface Callback : ReactionPillCallback, AvatarCallback, BaseCallback { fun onEventVisible(event: TimelineEvent) fun onUrlClicked(url: String) + fun onEncryptedMessageClicked(informationData: MessageInformationData, view: View) fun onImageMessageClicked(messageImageContent: MessageImageContent, mediaData: ImageContentRenderer.Data, view: View) fun onVideoMessageClicked(messageVideoContent: MessageVideoContent, mediaData: VideoContentRenderer.Data, view: View) fun onFileMessageClicked(messageFileContent: MessageFileContent) diff --git a/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/factory/EncryptedItemFactory.kt b/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/factory/EncryptedItemFactory.kt index 92294f198c..7f2aca512e 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/factory/EncryptedItemFactory.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/factory/EncryptedItemFactory.kt @@ -16,6 +16,7 @@ package im.vector.riotredesign.features.home.room.detail.timeline.factory +import android.view.View import im.vector.matrix.android.api.session.crypto.MXCryptoError import im.vector.matrix.android.api.session.events.model.EventType import im.vector.matrix.android.api.session.room.timeline.TimelineEvent @@ -23,6 +24,8 @@ import im.vector.riotredesign.R import im.vector.riotredesign.core.epoxy.VectorEpoxyModel import im.vector.riotredesign.core.resources.ColorProvider import im.vector.riotredesign.core.resources.StringProvider +import im.vector.riotredesign.core.utils.DebouncedClickListener +import im.vector.riotredesign.features.home.room.detail.timeline.TimelineEventController import im.vector.riotredesign.features.home.room.detail.timeline.item.MessageTextItem_ import im.vector.riotredesign.features.home.room.detail.timeline.util.MessageInformationDataFactory import me.gujun.android.span.span @@ -32,7 +35,9 @@ class EncryptedItemFactory(private val messageInformationDataFactory: MessageInf private val colorProvider: ColorProvider, private val stringProvider: StringProvider) { - fun create(event: TimelineEvent, nextEvent: TimelineEvent?): VectorEpoxyModel<*>? { + fun create(event: TimelineEvent, + nextEvent: TimelineEvent?, + callback: TimelineEventController.Callback?): VectorEpoxyModel<*>? { event.root.eventId ?: return null return when { @@ -57,8 +62,15 @@ class EncryptedItemFactory(private val messageInformationDataFactory: MessageInf return MessageTextItem_() .message(spannableStr) .informationData(informationData) - - // TODO Handle click on this event + .avatarCallback(callback) + .cellClickListener( + DebouncedClickListener(View.OnClickListener { view -> + callback?.onEncryptedMessageClicked(informationData, view) + })) + .longClickListener { view -> + return@longClickListener callback?.onEventLongClicked(informationData, null, view) + ?: false + } } else -> null } diff --git a/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/factory/TimelineItemFactory.kt b/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/factory/TimelineItemFactory.kt index a39998f3d9..d47fc9e133 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/factory/TimelineItemFactory.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/home/room/detail/timeline/factory/TimelineItemFactory.kt @@ -53,7 +53,7 @@ class TimelineItemFactory(private val messageItemFactory: MessageItemFactory, // Crypto EventType.ENCRYPTION -> encryptionItemFactory.create(event) - EventType.ENCRYPTED -> encryptedItemFactory.create(event, nextEvent) + EventType.ENCRYPTED -> encryptedItemFactory.create(event, nextEvent, callback) // Unhandled event types (yet) EventType.STATE_ROOM_THIRD_PARTY_INVITE,