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 me.gujun.android.span.span
|
||||||
import org.matrix.android.sdk.api.util.MatrixItem
|
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>() {
|
abstract class SpaceChildInfoItem : VectorEpoxyModel<SpaceChildInfoItem.Holder>() {
|
||||||
|
|
||||||
@EpoxyAttribute lateinit var avatarRenderer: AvatarRenderer
|
@EpoxyAttribute lateinit var avatarRenderer: AvatarRenderer
|
||||||
|
@ -51,6 +51,7 @@ abstract class SpaceChildInfoItem : VectorEpoxyModel<SpaceChildInfoItem.Holder>(
|
||||||
|
|
||||||
@EpoxyAttribute var memberCount: Int = 0
|
@EpoxyAttribute var memberCount: Int = 0
|
||||||
@EpoxyAttribute var loading: Boolean = false
|
@EpoxyAttribute var loading: Boolean = false
|
||||||
|
@EpoxyAttribute var suggested: Boolean = false
|
||||||
|
|
||||||
@EpoxyAttribute var buttonLabel: String? = null
|
@EpoxyAttribute var buttonLabel: String? = null
|
||||||
@EpoxyAttribute var errorLabel: 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
|
holder.joinButton.text = buttonLabel
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
|
@ -121,7 +123,8 @@ abstract class SpaceChildInfoItem : VectorEpoxyModel<SpaceChildInfoItem.Holder>(
|
||||||
val titleView by bind<TextView>(R.id.roomNameView)
|
val titleView by bind<TextView>(R.id.roomNameView)
|
||||||
val joinButton by bind<Button>(R.id.joinSuggestedRoomButton)
|
val joinButton by bind<Button>(R.id.joinSuggestedRoomButton)
|
||||||
val joinButtonLoading by bind<ProgressBar>(R.id.joinSuggestedLoading)
|
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 avatarImageView by bind<ImageView>(R.id.roomAvatarImageView)
|
||||||
val rootView by bind<ViewGroup>(R.id.itemRoomLayout)
|
val rootView by bind<ViewGroup>(R.id.itemRoomLayout)
|
||||||
val errorTextView by bind<TextView>(R.id.inlineErrorText)
|
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()
|
val matrixItem = data?.knownRoomSummaries?.find { it.roomId == info.childRoomId }?.toMatrixItem()
|
||||||
?: info.toMatrixItem()
|
?: info.toMatrixItem()
|
||||||
|
|
||||||
|
|
||||||
spaceChildInfoItem {
|
spaceChildInfoItem {
|
||||||
id(info.childRoomId)
|
id(info.childRoomId)
|
||||||
matrixItem(matrixItem)
|
matrixItem(matrixItem)
|
||||||
avatarRenderer(host.avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
topic(info.topic)
|
topic(info.topic)
|
||||||
|
suggested(info.suggested ?: false)
|
||||||
errorLabel(
|
errorLabel(
|
||||||
error?.let {
|
error?.let {
|
||||||
host.stringProvider.getString(R.string.error_failed_to_join_room, host.errorFormatter.toHumanReadable(it))
|
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" />
|
tools:text="@sample/users.json/data/displayName" />
|
||||||
|
|
||||||
<TextView
|
<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"
|
style="@style/Widget.Vector.TextView.Body"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -69,7 +83,7 @@
|
||||||
android:textColor="?vctr_content_secondary"
|
android:textColor="?vctr_content_secondary"
|
||||||
app:layout_constraintEnd_toStartOf="@id/joinSuggestedRoomButton"
|
app:layout_constraintEnd_toStartOf="@id/joinSuggestedRoomButton"
|
||||||
app:layout_constraintStart_toStartOf="@id/roomNameView"
|
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" />
|
tools:text="@sample/rooms.json/data/topic" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
@ -99,6 +113,7 @@
|
||||||
android:id="@+id/roomBottomBarrier"
|
android:id="@+id/roomBottomBarrier"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
app:barrierMargin="8dp"
|
||||||
app:barrierDirection="bottom"
|
app:barrierDirection="bottom"
|
||||||
app:constraint_referenced_ids="roomAvatarBottomSpace" />
|
app:constraint_referenced_ids="roomAvatarBottomSpace" />
|
||||||
|
|
Loading…
Reference in New Issue