From b187699a86877b9022079e53f1eb0b8c50a55566 Mon Sep 17 00:00:00 2001 From: onurays Date: Thu, 5 Mar 2020 18:44:34 +0100 Subject: [PATCH] Open room member profile from avatar of the room member state event. --- CHANGES.md | 1 + .../home/room/detail/timeline/factory/NoticeItemFactory.kt | 3 ++- .../features/home/room/detail/timeline/item/NoticeItem.kt | 6 +++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index a2c66163e7..5f4e370706 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,7 @@ Improvements 🙌: - Add support for `/plain` command (#12) - Detect spaces in password if user fail to login (#1038) - FTUE: do not display a different color when encrypting message when not in developer mode. + - Open room member profile from avatar of the room member state event (#935) Bugfix 🐛: - Fix crash on attachment preview screen (#1088) diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/NoticeItemFactory.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/NoticeItemFactory.kt index 4ee90f82a9..85118e6a91 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/NoticeItemFactory.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/factory/NoticeItemFactory.kt @@ -44,7 +44,8 @@ class NoticeItemFactory @Inject constructor(private val eventFormatter: NoticeEv itemLongClickListener = View.OnLongClickListener { view -> callback?.onEventLongClicked(informationData, null, view) ?: false }, - readReceiptsCallback = callback + readReceiptsCallback = callback, + avatarClickListener = { callback?.onAvatarClicked(informationData) } ) return NoticeItem_() .leftGuideline(avatarSizeProvider.leftGuideline) diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/NoticeItem.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/NoticeItem.kt index 189c358b48..ec98ea10ed 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/NoticeItem.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/timeline/item/NoticeItem.kt @@ -22,6 +22,8 @@ import android.widget.TextView import com.airbnb.epoxy.EpoxyAttribute import com.airbnb.epoxy.EpoxyModelClass import im.vector.riotx.R +import im.vector.riotx.core.epoxy.ClickListener +import im.vector.riotx.core.epoxy.onClick import im.vector.riotx.core.utils.DebouncedClickListener import im.vector.riotx.features.home.AvatarRenderer import im.vector.riotx.features.home.room.detail.timeline.TimelineEventController @@ -42,6 +44,7 @@ abstract class NoticeItem : BaseEventItem() { attributes.avatarRenderer.render(attributes.informationData.matrixItem, holder.avatarImageView) holder.view.setOnLongClickListener(attributes.itemLongClickListener) holder.readReceiptsView.render(attributes.informationData.readReceipts, attributes.avatarRenderer, _readReceiptsClickListener) + holder.avatarImageView.onClick(attributes.avatarClickListener) } override fun getEventIds(): List { @@ -60,7 +63,8 @@ abstract class NoticeItem : BaseEventItem() { val informationData: MessageInformationData, val noticeText: CharSequence, val itemLongClickListener: View.OnLongClickListener? = null, - val readReceiptsCallback: TimelineEventController.ReadReceiptsCallback? = null + val readReceiptsCallback: TimelineEventController.ReadReceiptsCallback? = null, + val avatarClickListener: ClickListener? = null ) companion object {