Skip to content

Commit 5ac0555

Browse files
authored
Merge pull request #5826 from vector-im/bugfix/eric/missing-suggested-tag
Adds Suggested Tag in Explore Space
2 parents 942bc13 + 039c9c6 commit 5ac0555

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

changelog.d/5826.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Adds missing suggested tag for rooms in Explore Space

vector/src/main/java/im/vector/app/features/home/room/list/SpaceChildInfoItem.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import me.gujun.android.span.image
4040
import me.gujun.android.span.span
4141
import org.matrix.android.sdk.api.util.MatrixItem
4242

43-
@EpoxyModelClass(layout = R.layout.item_suggested_room)
43+
@EpoxyModelClass(layout = R.layout.item_explore_space_child)
4444
abstract class SpaceChildInfoItem : VectorEpoxyModel<SpaceChildInfoItem.Holder>() {
4545

4646
@EpoxyAttribute lateinit var avatarRenderer: AvatarRenderer
@@ -51,6 +51,7 @@ abstract class SpaceChildInfoItem : VectorEpoxyModel<SpaceChildInfoItem.Holder>(
5151

5252
@EpoxyAttribute var memberCount: Int = 0
5353
@EpoxyAttribute var loading: Boolean = false
54+
@EpoxyAttribute var suggested: Boolean = false
5455

5556
@EpoxyAttribute var buttonLabel: String? = null
5657
@EpoxyAttribute var errorLabel: String? = null
@@ -89,6 +90,7 @@ abstract class SpaceChildInfoItem : VectorEpoxyModel<SpaceChildInfoItem.Holder>(
8990
}
9091
}
9192

93+
holder.suggestedTag.visibility = if (suggested) View.VISIBLE else View.GONE
9294
holder.joinButton.text = buttonLabel
9395

9496
if (loading) {
@@ -121,7 +123,8 @@ abstract class SpaceChildInfoItem : VectorEpoxyModel<SpaceChildInfoItem.Holder>(
121123
val titleView by bind<TextView>(R.id.roomNameView)
122124
val joinButton by bind<Button>(R.id.joinSuggestedRoomButton)
123125
val joinButtonLoading by bind<ProgressBar>(R.id.joinSuggestedLoading)
124-
val descriptionText by bind<TextView>(R.id.suggestedRoomDescription)
126+
val descriptionText by bind<TextView>(R.id.roomDescription)
127+
val suggestedTag by bind<TextView>(R.id.suggestedTag)
125128
val avatarImageView by bind<ImageView>(R.id.roomAvatarImageView)
126129
val rootView by bind<ViewGroup>(R.id.itemRoomLayout)
127130
val errorTextView by bind<TextView>(R.id.inlineErrorText)

vector/src/main/java/im/vector/app/features/spaces/explore/SpaceDirectoryController.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import im.vector.app.features.home.AvatarRenderer
3636
import im.vector.app.features.home.room.list.spaceChildInfoItem
3737
import im.vector.lib.core.utils.epoxy.charsequence.toEpoxyCharSequence
3838
import me.gujun.android.span.span
39+
import org.matrix.android.sdk.api.extensions.orFalse
3940
import org.matrix.android.sdk.api.failure.Failure
4041
import org.matrix.android.sdk.api.failure.MatrixError.Companion.M_UNRECOGNIZED
4142
import org.matrix.android.sdk.api.session.room.members.ChangeMembershipState
@@ -145,6 +146,7 @@ class SpaceDirectoryController @Inject constructor(
145146
matrixItem(matrixItem)
146147
avatarRenderer(host.avatarRenderer)
147148
topic(info.topic)
149+
suggested(info.suggested.orFalse())
148150
errorLabel(
149151
error?.let {
150152
host.stringProvider.getString(R.string.error_failed_to_join_room, host.errorFormatter.toHumanReadable(it))

vector/src/main/res/layout/item_suggested_room.xml renamed to vector/src/main/res/layout/item_explore_space_child.xml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,21 @@
5858
tools:text="@sample/users.json/data/displayName" />
5959

6060
<TextView
61-
android:id="@+id/suggestedRoomDescription"
61+
android:id="@+id/suggestedTag"
62+
style="@style/Widget.Vector.TextView.Caption"
63+
android:layout_width="wrap_content"
64+
android:layout_height="wrap_content"
65+
android:layout_marginTop="3dp"
66+
android:layout_marginEnd="8dp"
67+
android:text="@string/space_suggested"
68+
android:ellipsize="end"
69+
android:maxLines="1"
70+
android:textColor="?vctr_content_secondary"
71+
app:layout_constraintStart_toStartOf="@id/roomNameView"
72+
app:layout_constraintTop_toBottomOf="@id/roomNameView" />
73+
74+
<TextView
75+
android:id="@+id/roomDescription"
6276
style="@style/Widget.Vector.TextView.Body"
6377
android:layout_width="0dp"
6478
android:layout_height="wrap_content"
@@ -69,7 +83,7 @@
6983
android:textColor="?vctr_content_secondary"
7084
app:layout_constraintEnd_toStartOf="@id/joinSuggestedRoomButton"
7185
app:layout_constraintStart_toStartOf="@id/roomNameView"
72-
app:layout_constraintTop_toBottomOf="@id/roomNameView"
86+
app:layout_constraintTop_toBottomOf="@id/suggestedTag"
7387
tools:text="@sample/rooms.json/data/topic" />
7488

7589
<Button
@@ -99,6 +113,7 @@
99113
android:id="@+id/roomBottomBarrier"
100114
android:layout_width="wrap_content"
101115
android:layout_height="wrap_content"
116+
app:barrierMargin="8dp"
102117
app:barrierDirection="bottom"
103118
app:constraint_referenced_ids="roomAvatarBottomSpace" />
104119

0 commit comments

Comments
 (0)