Merge pull request #5945 from element-hq/feature/bma/listItemFont
Use only font from compound
This commit is contained in:
commit
46ae4b9f6b
10 changed files with 42 additions and 58 deletions
|
|
@ -231,7 +231,7 @@ private fun ImageOptimizationSelector(state: MediaOptimizationSelectorState) {
|
||||||
Text(
|
Text(
|
||||||
modifier = Modifier.weight(1f).align(Alignment.CenterVertically),
|
modifier = Modifier.weight(1f).align(Alignment.CenterVertically),
|
||||||
text = stringResource(R.string.screen_media_upload_preview_optimize_image_quality_title),
|
text = stringResource(R.string.screen_media_upload_preview_optimize_image_quality_title),
|
||||||
style = ElementTheme.materialTypography.bodyLarge,
|
style = ElementTheme.typography.fontBodyLgRegular,
|
||||||
)
|
)
|
||||||
Switch(
|
Switch(
|
||||||
modifier = Modifier.height(32.dp),
|
modifier = Modifier.height(32.dp),
|
||||||
|
|
@ -337,7 +337,7 @@ private fun VideoQualitySelectorDialog(
|
||||||
supportingContent = {
|
supportingContent = {
|
||||||
Text(
|
Text(
|
||||||
text = preset.subtitle(),
|
text = preset.subtitle(),
|
||||||
style = ElementTheme.materialTypography.bodyMedium,
|
style = ElementTheme.typography.fontBodyMdRegular,
|
||||||
color = ElementTheme.colors.textSecondary,
|
color = ElementTheme.colors.textSecondary,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,7 @@ private fun VideoQualitySelectorDialog(
|
||||||
supportingContent = {
|
supportingContent = {
|
||||||
Text(
|
Text(
|
||||||
text = subtitle,
|
text = subtitle,
|
||||||
style = ElementTheme.materialTypography.bodyMedium,
|
style = ElementTheme.typography.fontBodyMdRegular,
|
||||||
color = ElementTheme.colors.textSecondary,
|
color = ElementTheme.colors.textSecondary,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:ac84a7175c4a4897aa28eddcf722b7997c6576f612eb38fa09ffabcf7be11e00
|
oid sha256:32b12d0b26cd016a632a4cb87b71d5efcb2c0d816bf565bc90aee9963ce2d5df
|
||||||
size 119496
|
size 134117
|
||||||
|
|
|
||||||
|
|
@ -17,13 +17,14 @@ import androidx.compose.ui.text.TextStyle
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import io.element.android.compound.theme.ElementTheme
|
import io.element.android.compound.theme.ElementTheme
|
||||||
|
import io.element.android.compound.tokens.compoundTypography
|
||||||
|
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
internal fun TypographyPreview() = ElementTheme {
|
internal fun TypographyPreview() = ElementTheme {
|
||||||
Surface {
|
Surface {
|
||||||
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||||
with(ElementTheme.materialTypography) {
|
with(compoundTypography) {
|
||||||
TypographyTokenPreview(displayLarge, "Display large")
|
TypographyTokenPreview(displayLarge, "Display large")
|
||||||
TypographyTokenPreview(displayMedium, "Display medium")
|
TypographyTokenPreview(displayMedium, "Display medium")
|
||||||
TypographyTokenPreview(displaySmall, "Display small")
|
TypographyTokenPreview(displaySmall, "Display small")
|
||||||
|
|
@ -44,6 +45,33 @@ internal fun TypographyPreview() = ElementTheme {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
internal fun CompoundTypographyPreview() = ElementTheme {
|
||||||
|
Surface {
|
||||||
|
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||||
|
with(ElementTheme.typography) {
|
||||||
|
TypographyTokenPreview(fontHeadingXlBold, "fontHeadingXlBold")
|
||||||
|
TypographyTokenPreview(fontHeadingXlRegular, "fontHeadingXlRegular")
|
||||||
|
TypographyTokenPreview(fontHeadingLgBold, "fontHeadingLgBold")
|
||||||
|
TypographyTokenPreview(fontHeadingLgRegular, "fontHeadingLgRegular")
|
||||||
|
TypographyTokenPreview(fontHeadingMdBold, "fontHeadingMdBold")
|
||||||
|
TypographyTokenPreview(fontHeadingMdRegular, "fontHeadingMdRegular")
|
||||||
|
TypographyTokenPreview(fontHeadingSmMedium, "fontHeadingSmMedium")
|
||||||
|
TypographyTokenPreview(fontHeadingSmRegular, "fontHeadingSmRegular")
|
||||||
|
TypographyTokenPreview(fontBodyLgMedium, "fontBodyLgMedium")
|
||||||
|
TypographyTokenPreview(fontBodyLgRegular, "fontBodyLgRegular")
|
||||||
|
TypographyTokenPreview(fontBodyMdMedium, "fontBodyMdMedium")
|
||||||
|
TypographyTokenPreview(fontBodyMdRegular, "fontBodyMdRegular")
|
||||||
|
TypographyTokenPreview(fontBodySmMedium, "fontBodySmMedium")
|
||||||
|
TypographyTokenPreview(fontBodySmRegular, "fontBodySmRegular")
|
||||||
|
TypographyTokenPreview(fontBodyXsMedium, "fontBodyXsMedium")
|
||||||
|
TypographyTokenPreview(fontBodyXsRegular, "fontBodyXsRegular")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun TypographyTokenPreview(style: TextStyle, text: String) {
|
private fun TypographyTokenPreview(style: TextStyle, text: String) {
|
||||||
Text(text = text, style = style)
|
Text(text = text, style = style)
|
||||||
|
|
|
||||||
|
|
@ -62,14 +62,6 @@ object ElementTheme {
|
||||||
*/
|
*/
|
||||||
val typography: TypographyTokens = TypographyTokens
|
val typography: TypographyTokens = TypographyTokens
|
||||||
|
|
||||||
/**
|
|
||||||
* Material 3 [Typography] tokens. In Figma, these have the `M3 Typography/` prefix.
|
|
||||||
*/
|
|
||||||
val materialTypography: Typography
|
|
||||||
@Composable
|
|
||||||
@ReadOnlyComposable
|
|
||||||
get() = MaterialTheme.typography
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the theme version used is the light or the dark one.
|
* Returns whether the theme version used is the light or the dark one.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -8,18 +8,10 @@
|
||||||
|
|
||||||
package io.element.android.compound.screenshot
|
package io.element.android.compound.screenshot
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.material3.Surface
|
|
||||||
import androidx.compose.material3.Text
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.text.TextStyle
|
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
import com.github.takahirom.roborazzi.captureRoboImage
|
import com.github.takahirom.roborazzi.captureRoboImage
|
||||||
|
import io.element.android.compound.previews.CompoundTypographyPreview
|
||||||
import io.element.android.compound.screenshot.utils.screenshotFile
|
import io.element.android.compound.screenshot.utils.screenshotFile
|
||||||
import io.element.android.compound.theme.ElementTheme
|
|
||||||
import io.element.android.compound.tokens.generated.TypographyTokens
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.robolectric.annotation.Config
|
import org.robolectric.annotation.Config
|
||||||
|
|
@ -32,35 +24,7 @@ class CompoundTypographyTest {
|
||||||
@Config(sdk = [35], qualifiers = "h2048dp-xxhdpi")
|
@Config(sdk = [35], qualifiers = "h2048dp-xxhdpi")
|
||||||
fun screenshots() {
|
fun screenshots() {
|
||||||
captureRoboImage(file = screenshotFile("Compound Typography.png")) {
|
captureRoboImage(file = screenshotFile("Compound Typography.png")) {
|
||||||
ElementTheme {
|
CompoundTypographyPreview()
|
||||||
Surface {
|
|
||||||
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
|
||||||
with(TypographyTokens) {
|
|
||||||
TypographyTokenPreview(fontHeadingXlBold, "Heading XL Bold")
|
|
||||||
TypographyTokenPreview(fontHeadingXlRegular, "Heading XL Regular")
|
|
||||||
TypographyTokenPreview(fontHeadingLgBold, "Heading LG Bold")
|
|
||||||
TypographyTokenPreview(fontHeadingLgRegular, "Heading LG Regular")
|
|
||||||
TypographyTokenPreview(fontHeadingMdBold, "Heading MD Bold")
|
|
||||||
TypographyTokenPreview(fontHeadingMdRegular, "Heading MD Regular")
|
|
||||||
TypographyTokenPreview(fontHeadingSmMedium, "Heading SM Medium")
|
|
||||||
TypographyTokenPreview(fontHeadingSmRegular, "Heading SM Regular")
|
|
||||||
TypographyTokenPreview(fontBodyLgMedium, "Body LG Medium")
|
|
||||||
TypographyTokenPreview(fontBodyLgRegular, "Body LG Regular")
|
|
||||||
TypographyTokenPreview(fontBodyMdMedium, "Body MD Medium")
|
|
||||||
TypographyTokenPreview(fontBodyMdRegular, "Body MD Regular")
|
|
||||||
TypographyTokenPreview(fontBodySmMedium, "Body SM Medium")
|
|
||||||
TypographyTokenPreview(fontBodySmRegular, "Body SM Regular")
|
|
||||||
TypographyTokenPreview(fontBodyXsMedium, "Body XS Medium")
|
|
||||||
TypographyTokenPreview(fontBodyXsRegular, "Body XS Regular")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
|
||||||
private fun TypographyTokenPreview(style: TextStyle, text: String) {
|
|
||||||
Text(text = text, style = style)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,14 +57,14 @@ fun ErrorDialogWithDoNotShowAgain(
|
||||||
Column {
|
Column {
|
||||||
Text(
|
Text(
|
||||||
text = content,
|
text = content,
|
||||||
style = ElementTheme.materialTypography.bodyMedium,
|
style = ElementTheme.typography.fontBodyMdRegular,
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
Checkbox(checked = doNotShowAgain, onCheckedChange = { doNotShowAgain = it })
|
Checkbox(checked = doNotShowAgain, onCheckedChange = { doNotShowAgain = it })
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(id = CommonStrings.common_do_not_show_this_again),
|
text = stringResource(id = CommonStrings.common_do_not_show_this_again),
|
||||||
style = ElementTheme.materialTypography.bodyMedium,
|
style = ElementTheme.typography.fontBodyMdRegular,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ fun TextFieldDialog(
|
||||||
item {
|
item {
|
||||||
Text(
|
Text(
|
||||||
text = content,
|
text = content,
|
||||||
style = ElementTheme.materialTypography.bodyMedium,
|
style = ElementTheme.typography.fontBodyMdRegular,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ internal fun SimpleAlertDialogContent(
|
||||||
content = {
|
content = {
|
||||||
Text(
|
Text(
|
||||||
text = content,
|
text = content,
|
||||||
style = ElementTheme.materialTypography.bodyMedium,
|
style = ElementTheme.typography.fontBodyMdRegular,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
submitText = submitText,
|
submitText = submitText,
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ fun ListItem(
|
||||||
|
|
||||||
val decoratedHeadlineContent: @Composable () -> Unit = {
|
val decoratedHeadlineContent: @Composable () -> Unit = {
|
||||||
CompositionLocalProvider(
|
CompositionLocalProvider(
|
||||||
LocalTextStyle provides ElementTheme.materialTypography.bodyLarge,
|
LocalTextStyle provides ElementTheme.typography.fontBodyLgRegular,
|
||||||
LocalContentColor provides headlineColor,
|
LocalContentColor provides headlineColor,
|
||||||
) {
|
) {
|
||||||
headlineContent()
|
headlineContent()
|
||||||
|
|
@ -123,7 +123,7 @@ fun ListItem(
|
||||||
val decoratedSupportingContent: (@Composable () -> Unit)? = supportingContent?.let { content ->
|
val decoratedSupportingContent: (@Composable () -> Unit)? = supportingContent?.let { content ->
|
||||||
{
|
{
|
||||||
CompositionLocalProvider(
|
CompositionLocalProvider(
|
||||||
LocalTextStyle provides ElementTheme.materialTypography.bodyMedium,
|
LocalTextStyle provides ElementTheme.typography.fontBodyMdRegular,
|
||||||
LocalContentColor provides supportingColor,
|
LocalContentColor provides supportingColor,
|
||||||
) {
|
) {
|
||||||
content()
|
content()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue