Skip to content

Commit

Permalink
Merge pull request #5826 from vector-im/bugfix/eric/missing-suggested…
Browse files Browse the repository at this point in the history
…-tag

Adds Suggested Tag in Explore Space
  • Loading branch information
ericdecanini authored Apr 27, 2022
2 parents 942bc13 + 039c9c6 commit 5ac0555
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelog.d/5826.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Adds missing suggested tag for rooms in Explore Space
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import im.vector.app.features.home.AvatarRenderer
import im.vector.app.features.home.room.list.spaceChildInfoItem
import im.vector.lib.core.utils.epoxy.charsequence.toEpoxyCharSequence
import me.gujun.android.span.span
import org.matrix.android.sdk.api.extensions.orFalse
import org.matrix.android.sdk.api.failure.Failure
import org.matrix.android.sdk.api.failure.MatrixError.Companion.M_UNRECOGNIZED
import org.matrix.android.sdk.api.session.room.members.ChangeMembershipState
Expand Down Expand Up @@ -145,6 +146,7 @@ class SpaceDirectoryController @Inject constructor(
matrixItem(matrixItem)
avatarRenderer(host.avatarRenderer)
topic(info.topic)
suggested(info.suggested.orFalse())
errorLabel(
error?.let {
host.stringProvider.getString(R.string.error_failed_to_join_room, host.errorFormatter.toHumanReadable(it))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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" />

Expand Down

0 comments on commit 5ac0555

Please sign in to comment.