Merge pull request #7015 from vector-im/bugfix/eric/recents-bg-color

New Layout - Fixes recents background color not matching app bar
This commit is contained in:
Eric Decanini 2022-09-06 08:25:38 +02:00 committed by GitHub
commit ab989e9ff0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 3 deletions

View File

@ -23,6 +23,8 @@ import com.airbnb.epoxy.CarouselModelBuilder
import com.airbnb.epoxy.EpoxyController import com.airbnb.epoxy.EpoxyController
import com.airbnb.epoxy.EpoxyModel import com.airbnb.epoxy.EpoxyModel
import com.airbnb.epoxy.carousel import com.airbnb.epoxy.carousel
import com.google.android.material.color.MaterialColors
import im.vector.app.R
import im.vector.app.features.home.AvatarRenderer import im.vector.app.features.home.AvatarRenderer
import im.vector.app.features.home.room.list.RoomListListener import im.vector.app.features.home.room.list.RoomListListener
import org.matrix.android.sdk.api.session.room.model.RoomSummary import org.matrix.android.sdk.api.session.room.model.RoomSummary
@ -43,6 +45,12 @@ class RecentRoomCarouselController @Inject constructor(
resources.displayMetrics resources.displayMetrics
).toInt() ).toInt()
private val topPadding = TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP,
12f,
resources.displayMetrics
).toInt()
private val itemSpacing = TypedValue.applyDimension( private val itemSpacing = TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, TypedValue.COMPLEX_UNIT_DIP,
24f, 24f,
@ -61,11 +69,15 @@ class RecentRoomCarouselController @Inject constructor(
id("recents_carousel") id("recents_carousel")
padding(Carousel.Padding( padding(Carousel.Padding(
host.hPadding, host.hPadding,
0, host.topPadding,
host.hPadding, host.hPadding,
0, 0,
host.itemSpacing) host.itemSpacing)
) )
onBind { _, view, _ ->
val colorSurface = MaterialColors.getColor(view, R.attr.vctr_toolbar_background)
view.setBackgroundColor(colorSurface)
}
withModelsFrom(data) { roomSummary -> withModelsFrom(data) { roomSummary ->
val onClick = host.listener?.let { it::onRoomClicked } val onClick = host.listener?.let { it::onRoomClicked }
val onLongClick = host.listener?.let { it::onRoomLongClicked } val onLongClick = host.listener?.let { it::onRoomLongClicked }

View File

@ -50,7 +50,7 @@
android:layout_height="1dp" android:layout_height="1dp"
android:layout_marginStart="22dp" android:layout_marginStart="22dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:background="?vctr_list_separator_system" android:background="?vctr_list_separator"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" /> app:layout_constraintStart_toStartOf="parent" />

View File

@ -5,7 +5,7 @@
android:id="@+id/recentRoot" android:id="@+id/recentRoot"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?android:colorBackground" android:background="?vctr_toolbar_background"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:foreground="?attr/selectableItemBackground" android:foreground="?attr/selectableItemBackground"