Improve rendering of "All chats" regarding fontScale. (#984)
This commit is contained in:
parent
94c6223be2
commit
3c1f764bee
2 changed files with 15 additions and 1 deletions
|
|
@ -43,6 +43,8 @@ import io.element.android.libraries.designsystem.components.avatar.Avatar
|
|||
import io.element.android.libraries.designsystem.components.avatar.AvatarSize
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
|
||||
import io.element.android.libraries.designsystem.text.scaleMax
|
||||
import io.element.android.libraries.designsystem.text.toSp
|
||||
import io.element.android.libraries.designsystem.theme.aliasScreenTitle
|
||||
import io.element.android.libraries.designsystem.theme.components.DropdownMenu
|
||||
import io.element.android.libraries.designsystem.theme.components.DropdownMenuItem
|
||||
|
|
@ -114,7 +116,11 @@ private fun DefaultRoomListTopBar(
|
|||
val fontStyle = if (scrollBehavior.state.collapsedFraction > 0.5)
|
||||
ElementTheme.typography.aliasScreenTitle
|
||||
else
|
||||
ElementTheme.typography.fontHeadingLgBold
|
||||
ElementTheme.typography.fontHeadingLgBold.copy(
|
||||
// Due to a limitation of MediumTopAppBar, and to avoid the text to be truncated,
|
||||
// limit the size to 28.dp instead of 28.sp
|
||||
fontSize = 28.dp.scaleMax().toSp()
|
||||
)
|
||||
Text(
|
||||
style = fontStyle,
|
||||
text = stringResource(id = R.string.screen_roomlist_main_space_title)
|
||||
|
|
|
|||
|
|
@ -52,3 +52,11 @@ fun Dp.toPx(): Float = with(LocalDensity.current) { toPx() }
|
|||
*/
|
||||
@Composable
|
||||
fun Dp.roundToPx(): Int = with(LocalDensity.current) { roundToPx() }
|
||||
|
||||
/**
|
||||
* Return the maximum value between the receiver value and the value with fonScale applied.
|
||||
*/
|
||||
@Composable
|
||||
fun Dp.scaleMax(): Dp = with(LocalDensity.current) {
|
||||
return this@scaleMax * fontScale.coerceAtMost(1f)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue