Fix quality checks

This commit is contained in:
Benoit Marty 2025-01-02 08:13:05 +01:00
parent 1d34ce8e71
commit 52648d2abf
3 changed files with 35 additions and 32 deletions

View file

@ -29,9 +29,11 @@ import io.element.android.libraries.designsystem.components.avatar.AvatarSize
import io.element.android.libraries.designsystem.preview.ElementPreview import io.element.android.libraries.designsystem.preview.ElementPreview
import io.element.android.libraries.designsystem.preview.PreviewsDayNight import io.element.android.libraries.designsystem.preview.PreviewsDayNight
import io.element.android.libraries.designsystem.text.toPx import io.element.android.libraries.designsystem.text.toPx
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList
/** /**
* Draw a row of avatars (they must all have the same size), from start to end * Draw a row of avatars (they must all have the same size), from start to end.
* @param avatarDataList the avatars to render. Note: they will all be rendered, the caller may * @param avatarDataList the avatars to render. Note: they will all be rendered, the caller may
* want to limit the list size * want to limit the list size
* @param modifier Jetpack Compose modifier * @param modifier Jetpack Compose modifier
@ -40,7 +42,7 @@ import io.element.android.libraries.designsystem.text.toPx
*/ */
@Composable @Composable
fun AvatarRow( fun AvatarRow(
avatarDataList: List<AvatarData>, avatarDataList: ImmutableList<AvatarData>,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
overlapRatio: Float = 0.5f, overlapRatio: Float = 0.5f,
) { ) {
@ -113,15 +115,13 @@ internal fun AvatarRowRtlPreview(@PreviewParameter(OverlapRatioProvider::class)
@Composable @Composable
private fun ContentToPreview(overlapRatio: Float) { private fun ContentToPreview(overlapRatio: Float) {
AvatarRow( AvatarRow(
avatarDataList = listOf( avatarDataList = listOf("A", "B", "C").map {
"A", "B", "C"
).map {
AvatarData( AvatarData(
id = it, id = it,
name = it, name = it,
size = AvatarSize.RoomListItem, size = AvatarSize.RoomListItem,
) )
}, }.toImmutableList(),
overlapRatio = overlapRatio, overlapRatio = overlapRatio,
) )
} }

View file

@ -49,6 +49,7 @@ import io.element.android.libraries.designsystem.theme.components.Surface
import io.element.android.libraries.designsystem.theme.components.Text import io.element.android.libraries.designsystem.theme.components.Text
import io.element.android.libraries.ui.strings.CommonStrings import io.element.android.libraries.ui.strings.CommonStrings
import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList
private const val MAX_AVATAR_COUNT = 3 private const val MAX_AVATAR_COUNT = 3
@ -210,6 +211,7 @@ private fun KnockRequestAvatarListView(
.map { knockRequest -> .map { knockRequest ->
knockRequest.getAvatarData(AvatarSize.KnockRequestBanner) knockRequest.getAvatarData(AvatarSize.KnockRequestBanner)
} }
.toImmutableList()
AvatarRow( AvatarRow(
avatarDataList = avatars, avatarDataList = avatars,
modifier = modifier, modifier = modifier,

View file

@ -50,6 +50,7 @@ class KonsistClassNameTest {
.withAllParentsOf(PreviewParameterProvider::class) .withAllParentsOf(PreviewParameterProvider::class)
.withoutName( .withoutName(
"AspectRatioProvider", "AspectRatioProvider",
"OverlapRatioProvider",
) )
.also { .also {
// Check that classes are actually found // Check that classes are actually found