Add a picto for ignored users in the room member list screen (#5764)
This commit is contained in:
parent
e58677a104
commit
09abab6ce3
|
@ -0,0 +1 @@
|
|||
Add a picto for ignored users in the room member list screen
|
|
@ -32,6 +32,7 @@ abstract class ProfileMatrixItem : BaseProfileMatrixItem<ProfileMatrixItem.Holde
|
|||
open class Holder : VectorEpoxyHolder() {
|
||||
val titleView by bind<TextView>(R.id.matrixItemTitle)
|
||||
val subtitleView by bind<TextView>(R.id.matrixItemSubtitle)
|
||||
val ignoredUserView by bind<ImageView>(R.id.matrixItemIgnored)
|
||||
val powerLabel by bind<TextView>(R.id.matrixItemPowerLevelLabel)
|
||||
val presenceImageView by bind<PresenceStateImageView>(R.id.matrixItemPresenceImageView)
|
||||
val avatarImageView by bind<ImageView>(R.id.matrixItemAvatar)
|
||||
|
|
|
@ -26,11 +26,13 @@ import im.vector.app.core.extensions.setTextOrHide
|
|||
@EpoxyModelClass(layout = R.layout.item_profile_matrix_item)
|
||||
abstract class ProfileMatrixItemWithPowerLevel : ProfileMatrixItem() {
|
||||
|
||||
@EpoxyAttribute var ignoredUser: Boolean = false
|
||||
@EpoxyAttribute var powerLevelLabel: CharSequence? = null
|
||||
|
||||
override fun bind(holder: Holder) {
|
||||
super.bind(holder)
|
||||
holder.editableView.isVisible = false
|
||||
holder.ignoredUserView.isVisible = ignoredUser
|
||||
holder.powerLabel.setTextOrHide(powerLevelLabel)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,6 +133,7 @@ class RoomMemberListController @Inject constructor(
|
|||
}
|
||||
showPresence(true)
|
||||
userPresence(roomMember.userPresence)
|
||||
ignoredUser(roomMember.userId in data.ignoredUserIds)
|
||||
powerLevelLabel(
|
||||
span {
|
||||
span(powerLabel) {
|
||||
|
|
|
@ -69,6 +69,7 @@ class RoomMemberListViewModel @AssistedInject constructor(@Assisted initialState
|
|||
observeThirdPartyInvites()
|
||||
observeRoomSummary()
|
||||
observePowerLevel()
|
||||
observeIgnoredUsers()
|
||||
}
|
||||
|
||||
private fun observeRoomMemberSummaries() {
|
||||
|
@ -148,6 +149,16 @@ class RoomMemberListViewModel @AssistedInject constructor(@Assisted initialState
|
|||
}
|
||||
}
|
||||
|
||||
private fun observeIgnoredUsers() {
|
||||
session.flow()
|
||||
.liveIgnoredUsers()
|
||||
.execute { async ->
|
||||
copy(
|
||||
ignoredUserIds = async.invoke().orEmpty().map { it.userId }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun buildRoomMemberSummaries(powerLevelsContent: PowerLevelsContent, roomMembers: List<RoomMemberSummary>): RoomMemberSummaries {
|
||||
val admins = ArrayList<RoomMemberSummary>()
|
||||
val moderators = ArrayList<RoomMemberSummary>()
|
||||
|
|
|
@ -32,6 +32,7 @@ data class RoomMemberListViewState(
|
|||
val roomId: String,
|
||||
val roomSummary: Async<RoomSummary> = Uninitialized,
|
||||
val roomMemberSummaries: Async<RoomMemberSummaries> = Uninitialized,
|
||||
val ignoredUserIds: List<String> = emptyList(),
|
||||
val filter: String = "",
|
||||
val threePidInvites: Async<List<Event>> = Uninitialized,
|
||||
val trustLevelMap: Async<Map<String, RoomEncryptionTrustLevel?>> = Uninitialized,
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
android:textColor="?vctr_content_primary"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintBottom_toTopOf="@id/matrixItemSubtitle"
|
||||
app:layout_constraintEnd_toStartOf="@id/matrixItemPowerLevelLabel"
|
||||
app:layout_constraintEnd_toStartOf="@id/matrixItemIgnored"
|
||||
app:layout_constraintStart_toEndOf="@id/matrixItemAvatarDecoration"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_goneMarginEnd="80dp"
|
||||
|
@ -83,12 +83,26 @@
|
|||
android:textColor="?vctr_content_secondary"
|
||||
app:layout_constrainedWidth="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/matrixItemPowerLevelLabel"
|
||||
app:layout_constraintEnd_toStartOf="@id/matrixItemIgnored"
|
||||
app:layout_constraintStart_toEndOf="@id/matrixItemAvatar"
|
||||
app:layout_constraintTop_toBottomOf="@id/matrixItemTitle"
|
||||
app:layout_goneMarginEnd="8dp"
|
||||
tools:text="@sample/users.json/data/id" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/matrixItemIgnored"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:src="@drawable/ic_settings_root_ignored_users"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/matrixItemPowerLevelLabel"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:tint="?colorError"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/matrixItemPowerLevelLabel"
|
||||
style="@style/Widget.Vector.TextView.Caption"
|
||||
|
|
Loading…
Reference in New Issue