diff --git a/libraries/compound/src/main/kotlin/io/element/android/compound/annotations/CoreColorToken.kt b/libraries/compound/src/main/kotlin/io/element/android/compound/annotations/CoreColorToken.kt index b80b8653ea..a56ecb38a8 100644 --- a/libraries/compound/src/main/kotlin/io/element/android/compound/annotations/CoreColorToken.kt +++ b/libraries/compound/src/main/kotlin/io/element/android/compound/annotations/CoreColorToken.kt @@ -7,7 +7,10 @@ package io.element.android.compound.annotations -@RequiresOptIn("This is a Core color token, which should only be used to declare semantic colors, otherwise it would look the same on both light and dark modes. Only use it as is if you know what you are doing.") +@RequiresOptIn( + message = "This is a Core color token, which should only be used to declare semantic colors, otherwise it" + + " would look the same on both light and dark modes. Only use it as is if you know what you are doing." +) @Retention(AnnotationRetention.BINARY) @Target(AnnotationTarget.PROPERTY, AnnotationTarget.CLASS) annotation class CoreColorToken diff --git a/libraries/compound/src/main/kotlin/io/element/android/compound/previews/CompoundIconsPreview.kt b/libraries/compound/src/main/kotlin/io/element/android/compound/previews/CompoundIconsPreview.kt index 6e7b8ea825..0ee0546ca4 100644 --- a/libraries/compound/src/main/kotlin/io/element/android/compound/previews/CompoundIconsPreview.kt +++ b/libraries/compound/src/main/kotlin/io/element/android/compound/previews/CompoundIconsPreview.kt @@ -38,6 +38,8 @@ import androidx.compose.ui.unit.LayoutDirection import androidx.compose.ui.unit.dp import io.element.android.compound.theme.ElementTheme import io.element.android.compound.tokens.generated.CompoundIcons +import kotlinx.collections.immutable.ImmutableList +import kotlinx.collections.immutable.toImmutableList @Preview(widthDp = 730, heightDp = 1800) @Composable @@ -90,14 +92,14 @@ private fun IconsCompoundPreview( } IconsPreview( title = title, - content = content.toList(), + content = content.toImmutableList(), ) } @Composable internal fun IconsPreview( title: String, - content: List<@Composable ColumnScope.() -> Unit>, + content: ImmutableList<@Composable ColumnScope.() -> Unit>, ) = Surface { Column( modifier = Modifier @@ -138,4 +140,4 @@ internal fun IconsPreview( } } } -} \ No newline at end of file +} diff --git a/libraries/compound/src/main/kotlin/io/element/android/compound/previews/Typography.kt b/libraries/compound/src/main/kotlin/io/element/android/compound/previews/Typography.kt index 2fc93aeef0..5d5f31f203 100644 --- a/libraries/compound/src/main/kotlin/io/element/android/compound/previews/Typography.kt +++ b/libraries/compound/src/main/kotlin/io/element/android/compound/previews/Typography.kt @@ -19,7 +19,7 @@ import io.element.android.compound.theme.ElementTheme @Preview @Composable -fun TypographyPreview() = ElementTheme { +internal fun TypographyPreview() = ElementTheme { Surface { Column(verticalArrangement = Arrangement.spacedBy(8.dp)) { with(ElementTheme.materialTypography) { diff --git a/libraries/compound/src/main/kotlin/io/element/android/compound/theme/AvatarColors.kt b/libraries/compound/src/main/kotlin/io/element/android/compound/theme/AvatarColors.kt index 9b2ea07376..506e1c8063 100644 --- a/libraries/compound/src/main/kotlin/io/element/android/compound/theme/AvatarColors.kt +++ b/libraries/compound/src/main/kotlin/io/element/android/compound/theme/AvatarColors.kt @@ -20,6 +20,8 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import kotlinx.collections.immutable.ImmutableList +import kotlinx.collections.immutable.toImmutableList /** * Data class to hold avatar colors. @@ -53,7 +55,7 @@ internal fun AvatarColorsPreviewLight() { val chunks = avatarColors().chunked(4) Column(verticalArrangement = Arrangement.spacedBy(8.dp)) { for (chunk in chunks) { - AvatarColorRow(chunk) + AvatarColorRow(chunk.toImmutableList()) } } } @@ -66,14 +68,14 @@ internal fun AvatarColorsPreviewDark() { val chunks = avatarColors().chunked(4) Column(verticalArrangement = Arrangement.spacedBy(8.dp)) { for (chunk in chunks) { - AvatarColorRow(chunk) + AvatarColorRow(chunk.toImmutableList()) } } } } @Composable -private fun AvatarColorRow(colors: List) { +private fun AvatarColorRow(colors: ImmutableList) { Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) { colors.forEach { color -> Box( @@ -88,4 +90,4 @@ private fun AvatarColorRow(colors: List) { } } } -} \ No newline at end of file +} diff --git a/libraries/compound/src/main/kotlin/io/element/android/compound/theme/ElementTheme.kt b/libraries/compound/src/main/kotlin/io/element/android/compound/theme/ElementTheme.kt index 63994f24e9..08c30cf917 100644 --- a/libraries/compound/src/main/kotlin/io/element/android/compound/theme/ElementTheme.kt +++ b/libraries/compound/src/main/kotlin/io/element/android/compound/theme/ElementTheme.kt @@ -77,7 +77,7 @@ object ElementTheme { get() = LocalCompoundColors.current.isLight } -/* Global variables (application level) */ +// Global variables (application level) internal val LocalCompoundColors = staticCompositionLocalOf { compoundColorsLight } /** @@ -100,7 +100,8 @@ fun ElementTheme( darkTheme: Boolean = isSystemInDarkTheme(), applySystemBarsUpdate: Boolean = true, lightStatusBar: Boolean = !darkTheme, - dynamicColor: Boolean = false, /* true to enable MaterialYou */ + // true to enable MaterialYou + dynamicColor: Boolean = false, compoundLight: SemanticColors = compoundColorsLight, compoundDark: SemanticColors = compoundColorsDark, materialColorsLight: ColorScheme = compoundLight.toMaterialColorScheme(), diff --git a/libraries/compound/src/main/kotlin/io/element/android/compound/theme/MaterialTextPreview.kt b/libraries/compound/src/main/kotlin/io/element/android/compound/theme/MaterialTextPreview.kt index 12f4cd18f8..724d440161 100644 --- a/libraries/compound/src/main/kotlin/io/element/android/compound/theme/MaterialTextPreview.kt +++ b/libraries/compound/src/main/kotlin/io/element/android/compound/theme/MaterialTextPreview.kt @@ -119,7 +119,6 @@ private fun MaterialPreview( } } - @Composable private fun TextPreview( name: String, diff --git a/libraries/compound/src/main/kotlin/io/element/android/compound/theme/Theme.kt b/libraries/compound/src/main/kotlin/io/element/android/compound/theme/Theme.kt index 03ca5c598f..c6e9b47eb7 100644 --- a/libraries/compound/src/main/kotlin/io/element/android/compound/theme/Theme.kt +++ b/libraries/compound/src/main/kotlin/io/element/android/compound/theme/Theme.kt @@ -15,7 +15,7 @@ import kotlinx.coroutines.flow.map enum class Theme { System, Dark, - Light; + Light, } val themes = listOf(Theme.System, Theme.Dark, Theme.Light)