Merge pull request #5125 from vector-im/feature/nfe/space_card_layout

space and room card layout changed in explore rooms, space invite dia…
This commit is contained in:
Benoit Marty 2022-02-02 16:08:24 +01:00 committed by GitHub
commit 2ffc89d863
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 14 deletions

1
changelog.d/4304.misc Normal file
View File

@ -0,0 +1 @@
Changed layout for space card and room card used at "explore room" screen and space/room invite dialogs

View File

@ -41,7 +41,8 @@ class SpaceCardRenderer @Inject constructor(
fun render(spaceSummary: RoomSummary?,
peopleYouKnow: List<User>,
matrixLinkCallback: TimelineEventController.UrlClickCallback?,
inCard: FragmentMatrixToRoomSpaceCardBinding) {
inCard: FragmentMatrixToRoomSpaceCardBinding,
showDescription: Boolean) {
if (spaceSummary == null) {
inCard.matrixToCardContentVisibility.isVisible = false
inCard.matrixToCardButtonLoading.isVisible = true
@ -70,6 +71,8 @@ class SpaceCardRenderer @Inject constructor(
inCard.matrixToMemberPills.isVisible = false
}
inCard.matrixToCardDescText.isVisible = showDescription
renderPeopleYouKnow(inCard, peopleYouKnow.map { it.toMatrixItem() })
}
inCard.matrixToCardDescText.movementMethod = createLinkMovementMethod(object : TimelineEventController.UrlClickCallback {

View File

@ -170,7 +170,7 @@ class SpaceDirectoryFragment @Inject constructor(
?: getString(R.string.space_explore_activity_title)
}
spaceCardRenderer.render(state.currentRootSummary, emptyList(), this, views.spaceCard)
spaceCardRenderer.render(state.currentRootSummary, emptyList(), this, views.spaceCard, showDescription = false)
views.addOrCreateChatRoomButton.isVisible = state.canAddRooms
}

View File

@ -118,7 +118,7 @@ class SpaceInviteBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetIn
views.inviterMxid.isVisible = false
}
spaceCardRenderer.render(summary, state.peopleYouKnow.invoke().orEmpty(), null, views.spaceCard)
spaceCardRenderer.render(summary, state.peopleYouKnow.invoke().orEmpty(), null, views.spaceCard, showDescription = true)
views.spaceCard.matrixToCardMainButton.button.text = getString(R.string.action_accept)
views.spaceCard.matrixToCardSecondaryButton.button.text = getString(R.string.action_decline)

View File

@ -10,7 +10,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="200dp"
android:padding="16dp"
android:padding="@dimen/layout_horizontal_margin"
android:visibility="gone"
tools:visibility="visible">
@ -19,11 +19,9 @@
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginTop="20dp"
android:importantForAccessibility="no"
android:elevation="4dp"
android:importantForAccessibility="no"
android:transitionName="profile"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@sample/room_round_avatars" />
@ -31,21 +29,23 @@
<TextView
android:id="@+id/matrixToCardNameText"
style="@style/Widget.Vector.TextView.Subtitle"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/layout_vertical_margin"
android:layout_marginStart="@dimen/layout_horizontal_margin"
android:maxLines="1"
android:singleLine="true"
android:textAlignment="textStart"
android:textColor="?vctr_content_primary"
android:textStyle="bold"
app:layout_constraintTop_toBottomOf="@id/matrixToCardAvatar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/matrixToCardAvatar"
app:layout_constraintTop_toTopOf="@id/matrixToCardAvatar"
tools:text="@sample/rooms.json/data/name" />
<TextView
android:id="@+id/matrixToCardAliasText"
style="@style/Widget.Vector.TextView.Body"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:maxLines="1"
@ -53,6 +53,8 @@
android:textAlignment="textStart"
android:textColor="?vctr_content_secondary"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@id/matrixToCardNameText"
app:layout_constraintTop_toBottomOf="@id/matrixToCardNameText"
app:layout_goneMarginTop="0dp"
tools:text="@sample/rooms.json/data/alias"
@ -65,7 +67,7 @@
android:importantForAccessibility="no"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/matrixToAccessText"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintStart_toStartOf="@id/matrixToCardNameText"
app:layout_constraintTop_toTopOf="@id/matrixToAccessText"
app:tint="?vctr_content_secondary"
tools:ignore="MissingPrefix"
@ -75,7 +77,7 @@
<TextView
android:id="@+id/matrixToAccessText"
style="@style/Widget.Vector.TextView.Body"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
@ -89,6 +91,13 @@
tools:text="Public Space"
tools:visibility="visible" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/matrixToHeaderBarrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="matrixToAccessText, matrixToCardAvatar" />
<LinearLayout
android:id="@+id/matrixToMemberPills"
android:layout_width="wrap_content"
@ -105,7 +114,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/matrixToAccessText">
app:layout_constraintTop_toBottomOf="@id/matrixToHeaderBarrier">
<ImageView
android:id="@+id/spaceChildMemberCountIcon"