mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-27 12:00:03 +03:00
Adds user id and canonical alias to search result subtitles
This commit is contained in:
parent
9e53e6cc8f
commit
70cded2733
3 changed files with 18 additions and 8 deletions
|
@ -59,7 +59,7 @@ abstract class RoomSummaryItem : VectorEpoxyModel<RoomSummaryItem.Holder>() {
|
|||
var displayMode: RoomListDisplayMode = RoomListDisplayMode.PEOPLE
|
||||
|
||||
@EpoxyAttribute
|
||||
var spaceName: String? = null
|
||||
lateinit var subtitle: String
|
||||
|
||||
@EpoxyAttribute
|
||||
lateinit var lastFormattedEvent: EpoxyCharSequence
|
||||
|
@ -112,7 +112,7 @@ abstract class RoomSummaryItem : VectorEpoxyModel<RoomSummaryItem.Holder>() {
|
|||
}
|
||||
holder.titleView.text = matrixItem.getBestName()
|
||||
holder.lastEventTimeView.text = lastEventTime
|
||||
holder.lastEventView.text = getTextForLastEventView()
|
||||
holder.subtitleView.text = getTextForLastEventView()
|
||||
holder.unreadCounterBadgeView.render(UnreadCounterBadgeView.State(unreadNotificationCount, showHighlighted))
|
||||
holder.unreadIndentIndicator.isVisible = hasUnreadMessage
|
||||
holder.draftView.isVisible = hasDraft
|
||||
|
@ -122,13 +122,13 @@ abstract class RoomSummaryItem : VectorEpoxyModel<RoomSummaryItem.Holder>() {
|
|||
holder.roomAvatarFailSendingImageView.isVisible = hasFailedSending
|
||||
renderSelection(holder, showSelected)
|
||||
holder.typingView.setTextOrHide(typingMessage)
|
||||
holder.lastEventView.isInvisible = holder.typingView.isVisible
|
||||
holder.subtitleView.isInvisible = holder.typingView.isVisible
|
||||
holder.roomAvatarPresenceImageView.render(showPresence, userPresence)
|
||||
}
|
||||
|
||||
private fun getTextForLastEventView(): CharSequence {
|
||||
return if (displayMode == RoomListDisplayMode.FILTERED) {
|
||||
spaceName.orEmpty() // TODO: handle other cases
|
||||
subtitle
|
||||
} else {
|
||||
lastFormattedEvent.charSequence
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ abstract class RoomSummaryItem : VectorEpoxyModel<RoomSummaryItem.Holder>() {
|
|||
val titleView by bind<TextView>(R.id.roomNameView)
|
||||
val unreadCounterBadgeView by bind<UnreadCounterBadgeView>(R.id.roomUnreadCounterBadgeView)
|
||||
val unreadIndentIndicator by bind<View>(R.id.roomUnreadIndicator)
|
||||
val lastEventView by bind<TextView>(R.id.roomLastEventView)
|
||||
val subtitleView by bind<TextView>(R.id.subtitleView)
|
||||
val typingView by bind<TextView>(R.id.roomTypingView)
|
||||
val draftView by bind<ImageView>(R.id.roomDraftBadge)
|
||||
val lastEventTimeView by bind<TextView>(R.id.roomLastEventTimeView)
|
||||
|
|
|
@ -111,6 +111,7 @@ class RoomSummaryItemFactory @Inject constructor(private val displayableEventFor
|
|||
onClick: ((RoomSummary) -> Unit)?,
|
||||
onLongClick: ((RoomSummary) -> Boolean)?
|
||||
): VectorEpoxyModel<*> {
|
||||
val subtitle = getSearchResultSubtitle(roomSummary)
|
||||
val unreadCount = roomSummary.notificationCount
|
||||
val showHighlighted = roomSummary.highlightCount > 0
|
||||
val showSelected = selectedRoomIds.contains(roomSummary.roomId)
|
||||
|
@ -121,6 +122,7 @@ class RoomSummaryItemFactory @Inject constructor(private val displayableEventFor
|
|||
latestFormattedEvent = displayableEventFormatter.format(latestEvent, roomSummary.isDirect, roomSummary.isDirect.not())
|
||||
latestEventTime = dateFormatter.format(latestEvent.root.originServerTs, DateFormatKind.ROOM_LIST)
|
||||
}
|
||||
|
||||
val typingMessage = typingHelper.getTypingMessage(roomSummary.typingUsers)
|
||||
return RoomSummaryItem_()
|
||||
.id(roomSummary.roomId)
|
||||
|
@ -128,7 +130,7 @@ class RoomSummaryItemFactory @Inject constructor(private val displayableEventFor
|
|||
// We do not display shield in the room list anymore
|
||||
// .encryptionTrustLevel(roomSummary.roomEncryptionTrustLevel)
|
||||
.displayMode(displayMode)
|
||||
.spaceName(roomSummary.spaceParents?.firstOrNull()?.roomSummary?.name.orEmpty())
|
||||
.subtitle(subtitle)
|
||||
.isPublic(roomSummary.isPublic)
|
||||
.showPresence(roomSummary.isDirect)
|
||||
.userPresence(roomSummary.directUserPresence)
|
||||
|
@ -147,4 +149,12 @@ class RoomSummaryItemFactory @Inject constructor(private val displayableEventFor
|
|||
}
|
||||
.itemClickListener { onClick?.invoke(roomSummary) }
|
||||
}
|
||||
|
||||
private fun getSearchResultSubtitle(roomSummary: RoomSummary): String {
|
||||
val spaceName = roomSummary.spaceParents?.firstOrNull()?.roomSummary?.name
|
||||
val userId = roomSummary.directUserId
|
||||
val canonicalAlias = roomSummary.canonicalAlias
|
||||
|
||||
return (spaceName ?: userId ?: canonicalAlias).orEmpty()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@
|
|||
tools:text="@tools:sample/date/hhmm" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/roomLastEventView"
|
||||
android:id="@+id/subtitleView"
|
||||
style="@style/Widget.Vector.TextView.Body"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -222,7 +222,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="7dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/roomLastEventView"
|
||||
app:layout_constraintTop_toBottomOf="@id/subtitleView"
|
||||
tools:layout_marginStart="120dp" />
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
|
|
Loading…
Reference in a new issue