Update room description style

This commit is contained in:
Florian Renaud 2022-07-01 00:19:41 +02:00
parent c7db89613c
commit 7415623c2f
1 changed files with 13 additions and 11 deletions

View File

@ -27,6 +27,7 @@ import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.core.view.updateLayoutParams import androidx.core.view.updateLayoutParams
import androidx.core.widget.TextViewCompat
import com.airbnb.epoxy.EpoxyAttribute import com.airbnb.epoxy.EpoxyAttribute
import com.airbnb.epoxy.EpoxyModelClass import com.airbnb.epoxy.EpoxyModelClass
import im.vector.app.R import im.vector.app.R
@ -37,6 +38,7 @@ import im.vector.app.features.home.AvatarRenderer
import im.vector.app.features.home.room.detail.RoomDetailAction import im.vector.app.features.home.room.detail.RoomDetailAction
import im.vector.app.features.home.room.detail.timeline.TimelineEventController import im.vector.app.features.home.room.detail.timeline.TimelineEventController
import im.vector.app.features.home.room.detail.timeline.tools.linkify import im.vector.app.features.home.room.detail.timeline.tools.linkify
import im.vector.app.features.themes.ThemeUtils
import me.gujun.android.span.span import me.gujun.android.span.span
import org.matrix.android.sdk.api.session.room.model.RoomSummary import org.matrix.android.sdk.api.session.room.model.RoomSummary
import org.matrix.android.sdk.api.session.room.model.localecho.RoomLocalEcho import org.matrix.android.sdk.api.session.room.model.localecho.RoomLocalEcho
@ -201,27 +203,27 @@ abstract class MergedRoomCreationItem : BasedMergedItem<MergedRoomCreationItem.H
private fun renderRoomDescription(holder: Holder) { private fun renderRoomDescription(holder: Holder) {
val roomDisplayName = roomSummary?.displayName val roomDisplayName = roomSummary?.displayName
when { val resources = holder.roomDescriptionText.resources
val description = when {
isDirectRoom -> { isDirectRoom -> {
if (attributes.isLocalRoom) { if (attributes.isLocalRoom) {
holder.roomDescriptionText.text = holder.view.resources.getString( resources.getString(R.string.send_your_first_msg_to_invite, roomSummary?.displayName.orEmpty())
R.string.send_your_first_msg_to_invite,
roomSummary?.displayName.orEmpty()
)
} else { } else {
holder.roomDescriptionText.text = holder.view.resources.getString( resources.getString(R.string.this_is_the_beginning_of_dm, roomSummary?.displayName.orEmpty())
R.string.this_is_the_beginning_of_dm,
roomSummary?.displayName.orEmpty()
)
} }
} }
roomDisplayName.isNullOrBlank() || roomSummary?.name.isNullOrBlank() -> { roomDisplayName.isNullOrBlank() || roomSummary?.name.isNullOrBlank() -> {
holder.roomDescriptionText.text = holder.view.resources.getString(R.string.this_is_the_beginning_of_room_no_name) holder.view.resources.getString(R.string.this_is_the_beginning_of_room_no_name)
} }
else -> { else -> {
holder.roomDescriptionText.text = holder.view.resources.getString(R.string.this_is_the_beginning_of_room, roomDisplayName) holder.view.resources.getString(R.string.this_is_the_beginning_of_room, roomDisplayName)
} }
} }
holder.roomDescriptionText.text = description
if (isDirectRoom && attributes.isLocalRoom) {
TextViewCompat.setTextAppearance(holder.roomDescriptionText, R.style.TextAppearance_Vector_Subtitle)
holder.roomDescriptionText.setTextColor(ThemeUtils.getColor(holder.roomDescriptionText.context, R.attr.vctr_content_primary))
}
} }
private fun renderRoomTopic(holder: Holder) { private fun renderRoomTopic(holder: Holder) {