mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-16 20:10:04 +03:00
Add a picto for ignored users in the room member list screen (#5764)
This commit is contained in:
parent
e58677a104
commit
09abab6ce3
7 changed files with 33 additions and 2 deletions
1
changelog.d/5774.misc
Normal file
1
changelog.d/5774.misc
Normal file
|
@ -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() {
|
open class Holder : VectorEpoxyHolder() {
|
||||||
val titleView by bind<TextView>(R.id.matrixItemTitle)
|
val titleView by bind<TextView>(R.id.matrixItemTitle)
|
||||||
val subtitleView by bind<TextView>(R.id.matrixItemSubtitle)
|
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 powerLabel by bind<TextView>(R.id.matrixItemPowerLevelLabel)
|
||||||
val presenceImageView by bind<PresenceStateImageView>(R.id.matrixItemPresenceImageView)
|
val presenceImageView by bind<PresenceStateImageView>(R.id.matrixItemPresenceImageView)
|
||||||
val avatarImageView by bind<ImageView>(R.id.matrixItemAvatar)
|
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)
|
@EpoxyModelClass(layout = R.layout.item_profile_matrix_item)
|
||||||
abstract class ProfileMatrixItemWithPowerLevel : ProfileMatrixItem() {
|
abstract class ProfileMatrixItemWithPowerLevel : ProfileMatrixItem() {
|
||||||
|
|
||||||
|
@EpoxyAttribute var ignoredUser: Boolean = false
|
||||||
@EpoxyAttribute var powerLevelLabel: CharSequence? = null
|
@EpoxyAttribute var powerLevelLabel: CharSequence? = null
|
||||||
|
|
||||||
override fun bind(holder: Holder) {
|
override fun bind(holder: Holder) {
|
||||||
super.bind(holder)
|
super.bind(holder)
|
||||||
holder.editableView.isVisible = false
|
holder.editableView.isVisible = false
|
||||||
|
holder.ignoredUserView.isVisible = ignoredUser
|
||||||
holder.powerLabel.setTextOrHide(powerLevelLabel)
|
holder.powerLabel.setTextOrHide(powerLevelLabel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,6 +133,7 @@ class RoomMemberListController @Inject constructor(
|
||||||
}
|
}
|
||||||
showPresence(true)
|
showPresence(true)
|
||||||
userPresence(roomMember.userPresence)
|
userPresence(roomMember.userPresence)
|
||||||
|
ignoredUser(roomMember.userId in data.ignoredUserIds)
|
||||||
powerLevelLabel(
|
powerLevelLabel(
|
||||||
span {
|
span {
|
||||||
span(powerLabel) {
|
span(powerLabel) {
|
||||||
|
|
|
@ -69,6 +69,7 @@ class RoomMemberListViewModel @AssistedInject constructor(@Assisted initialState
|
||||||
observeThirdPartyInvites()
|
observeThirdPartyInvites()
|
||||||
observeRoomSummary()
|
observeRoomSummary()
|
||||||
observePowerLevel()
|
observePowerLevel()
|
||||||
|
observeIgnoredUsers()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun observeRoomMemberSummaries() {
|
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 {
|
private fun buildRoomMemberSummaries(powerLevelsContent: PowerLevelsContent, roomMembers: List<RoomMemberSummary>): RoomMemberSummaries {
|
||||||
val admins = ArrayList<RoomMemberSummary>()
|
val admins = ArrayList<RoomMemberSummary>()
|
||||||
val moderators = ArrayList<RoomMemberSummary>()
|
val moderators = ArrayList<RoomMemberSummary>()
|
||||||
|
|
|
@ -32,6 +32,7 @@ data class RoomMemberListViewState(
|
||||||
val roomId: String,
|
val roomId: String,
|
||||||
val roomSummary: Async<RoomSummary> = Uninitialized,
|
val roomSummary: Async<RoomSummary> = Uninitialized,
|
||||||
val roomMemberSummaries: Async<RoomMemberSummaries> = Uninitialized,
|
val roomMemberSummaries: Async<RoomMemberSummaries> = Uninitialized,
|
||||||
|
val ignoredUserIds: List<String> = emptyList(),
|
||||||
val filter: String = "",
|
val filter: String = "",
|
||||||
val threePidInvites: Async<List<Event>> = Uninitialized,
|
val threePidInvites: Async<List<Event>> = Uninitialized,
|
||||||
val trustLevelMap: Async<Map<String, RoomEncryptionTrustLevel?>> = Uninitialized,
|
val trustLevelMap: Async<Map<String, RoomEncryptionTrustLevel?>> = Uninitialized,
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
android:textColor="?vctr_content_primary"
|
android:textColor="?vctr_content_primary"
|
||||||
app:layout_constrainedWidth="true"
|
app:layout_constrainedWidth="true"
|
||||||
app:layout_constraintBottom_toTopOf="@id/matrixItemSubtitle"
|
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_constraintStart_toEndOf="@id/matrixItemAvatarDecoration"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_goneMarginEnd="80dp"
|
app:layout_goneMarginEnd="80dp"
|
||||||
|
@ -83,12 +83,26 @@
|
||||||
android:textColor="?vctr_content_secondary"
|
android:textColor="?vctr_content_secondary"
|
||||||
app:layout_constrainedWidth="true"
|
app:layout_constrainedWidth="true"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
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_constraintStart_toEndOf="@id/matrixItemAvatar"
|
||||||
app:layout_constraintTop_toBottomOf="@id/matrixItemTitle"
|
app:layout_constraintTop_toBottomOf="@id/matrixItemTitle"
|
||||||
app:layout_goneMarginEnd="8dp"
|
app:layout_goneMarginEnd="8dp"
|
||||||
tools:text="@sample/users.json/data/id" />
|
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
|
<TextView
|
||||||
android:id="@+id/matrixItemPowerLevelLabel"
|
android:id="@+id/matrixItemPowerLevelLabel"
|
||||||
style="@style/Widget.Vector.TextView.Caption"
|
style="@style/Widget.Vector.TextView.Caption"
|
||||||
|
|
Loading…
Add table
Reference in a new issue