mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-23 17:40:37 +03:00
Fix displayname color by power level in reply composer
Change-Id: Iae7f4018c4c467493f240265b75abcea4e01898c
This commit is contained in:
parent
0c7cc81830
commit
65602e89c4
2 changed files with 14 additions and 1 deletions
|
@ -1058,6 +1058,17 @@ class RoomDetailFragment @Inject constructor(
|
|||
views.composerLayout.views.sendButton.contentDescription = getString(R.string.send)
|
||||
}
|
||||
|
||||
private fun getMemberNameColor(matrixItem: MatrixItem) = matrixItemColorProvider.getColor(
|
||||
matrixItem,
|
||||
withState(roomDetailViewModel) {
|
||||
MatrixItemColorProvider.UserInRoomInformation(
|
||||
it.isDm(),
|
||||
it.isPublic(),
|
||||
it.powerLevelsHelper?.getUserPowerLevelValue(matrixItem.id)
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
private fun renderSpecialMode(event: TimelineEvent,
|
||||
@DrawableRes iconRes: Int,
|
||||
@StringRes descriptionRes: Int,
|
||||
|
@ -1066,7 +1077,7 @@ class RoomDetailFragment @Inject constructor(
|
|||
// switch to expanded bar
|
||||
views.composerLayout.views.composerRelatedMessageTitle.apply {
|
||||
text = event.senderInfo.disambiguatedDisplayName
|
||||
setTextColor(matrixItemColorProvider.getColor(MatrixItem.UserItem(event.root.senderId ?: "@")))
|
||||
setTextColor(getMemberNameColor(MatrixItem.UserItem(event.root.senderId ?: "@")))
|
||||
}
|
||||
|
||||
val messageContent: MessageContent? = event.getLastMessageContent()
|
||||
|
|
|
@ -86,4 +86,6 @@ data class RoomDetailViewState(
|
|||
fun hasActiveJitsiWidget() = activeRoomWidgets()?.any { it.type == WidgetType.Jitsi && it.isActive }.orFalse()
|
||||
|
||||
fun isDm() = asyncRoomSummary()?.isDirect == true
|
||||
|
||||
fun isPublic() = asyncRoomSummary()?.isPublic == true
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue