Adds suggested tag in explore rooms
This commit is contained in:
parent
2839d1467f
commit
43c2b42a82
|
@ -40,7 +40,7 @@ import me.gujun.android.span.image
|
|||
import me.gujun.android.span.span
|
||||
import org.matrix.android.sdk.api.util.MatrixItem
|
||||
|
||||
@EpoxyModelClass(layout = R.layout.item_suggested_room)
|
||||
@EpoxyModelClass(layout = R.layout.item_explore_space_child)
|
||||
abstract class SpaceChildInfoItem : VectorEpoxyModel<SpaceChildInfoItem.Holder>() {
|
||||
|
||||
@EpoxyAttribute lateinit var avatarRenderer: AvatarRenderer
|
||||
|
@ -51,6 +51,7 @@ abstract class SpaceChildInfoItem : VectorEpoxyModel<SpaceChildInfoItem.Holder>(
|
|||
|
||||
@EpoxyAttribute var memberCount: Int = 0
|
||||
@EpoxyAttribute var loading: Boolean = false
|
||||
@EpoxyAttribute var suggested: Boolean = false
|
||||
|
||||
@EpoxyAttribute var buttonLabel: String? = null
|
||||
@EpoxyAttribute var errorLabel: String? = null
|
||||
|
@ -89,6 +90,7 @@ abstract class SpaceChildInfoItem : VectorEpoxyModel<SpaceChildInfoItem.Holder>(
|
|||
}
|
||||
}
|
||||
|
||||
holder.suggestedTag.visibility = if (suggested) View.VISIBLE else View.GONE
|
||||
holder.joinButton.text = buttonLabel
|
||||
|
||||
if (loading) {
|
||||
|
@ -121,7 +123,8 @@ abstract class SpaceChildInfoItem : VectorEpoxyModel<SpaceChildInfoItem.Holder>(
|
|||
val titleView by bind<TextView>(R.id.roomNameView)
|
||||
val joinButton by bind<Button>(R.id.joinSuggestedRoomButton)
|
||||
val joinButtonLoading by bind<ProgressBar>(R.id.joinSuggestedLoading)
|
||||
val descriptionText by bind<TextView>(R.id.suggestedRoomDescription)
|
||||
val descriptionText by bind<TextView>(R.id.roomDescription)
|
||||
val suggestedTag by bind<TextView>(R.id.suggestedTag)
|
||||
val avatarImageView by bind<ImageView>(R.id.roomAvatarImageView)
|
||||
val rootView by bind<ViewGroup>(R.id.itemRoomLayout)
|
||||
val errorTextView by bind<TextView>(R.id.inlineErrorText)
|
||||
|
|
|
@ -140,11 +140,13 @@ class SpaceDirectoryController @Inject constructor(
|
|||
val matrixItem = data?.knownRoomSummaries?.find { it.roomId == info.childRoomId }?.toMatrixItem()
|
||||
?: info.toMatrixItem()
|
||||
|
||||
|
||||
spaceChildInfoItem {
|
||||
id(info.childRoomId)
|
||||
matrixItem(matrixItem)
|
||||
avatarRenderer(host.avatarRenderer)
|
||||
topic(info.topic)
|
||||
suggested(info.suggested ?: false)
|
||||
errorLabel(
|
||||
error?.let {
|
||||
host.stringProvider.getString(R.string.error_failed_to_join_room, host.errorFormatter.toHumanReadable(it))
|
||||
|
|
|
@ -58,7 +58,21 @@
|
|||
tools:text="@sample/users.json/data/displayName" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/suggestedRoomDescription"
|
||||
android:id="@+id/suggestedTag"
|
||||
style="@style/Widget.Vector.TextView.Caption"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:text="@string/space_suggested"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="?vctr_content_secondary"
|
||||
app:layout_constraintStart_toStartOf="@id/roomNameView"
|
||||
app:layout_constraintTop_toBottomOf="@id/roomNameView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/roomDescription"
|
||||
style="@style/Widget.Vector.TextView.Body"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -69,7 +83,7 @@
|
|||
android:textColor="?vctr_content_secondary"
|
||||
app:layout_constraintEnd_toStartOf="@id/joinSuggestedRoomButton"
|
||||
app:layout_constraintStart_toStartOf="@id/roomNameView"
|
||||
app:layout_constraintTop_toBottomOf="@id/roomNameView"
|
||||
app:layout_constraintTop_toBottomOf="@id/suggestedTag"
|
||||
tools:text="@sample/rooms.json/data/topic" />
|
||||
|
||||
<Button
|
||||
|
@ -99,6 +113,7 @@
|
|||
android:id="@+id/roomBottomBarrier"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierMargin="8dp"
|
||||
app:barrierDirection="bottom"
|
||||
app:constraint_referenced_ids="roomAvatarBottomSpace" />
|
||||
|
Loading…
Reference in New Issue