From 9b9a6a16cd382516b9af84f3626ad968d014baf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20G=C3=B6ransson?= Date: Tue, 16 Apr 2024 11:29:17 +0200 Subject: [PATCH] Fix overflow & max lines for custom list name --- .../mullvadvpn/compose/cell/NavigationComposeCell.kt | 5 ++++- .../mullvad/mullvadvpn/compose/cell/RelayLocationCell.kt | 5 ++++- .../net/mullvad/mullvadvpn/compose/cell/TwoRowCell.kt | 9 +++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/NavigationComposeCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/NavigationComposeCell.kt index 27b74227cae7..7fbc4bdda380 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/NavigationComposeCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/NavigationComposeCell.kt @@ -15,6 +15,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import net.mullvad.mullvadvpn.R import net.mullvad.mullvadvpn.lib.theme.AppTheme @@ -99,7 +100,9 @@ internal fun NavigationTitleView( text = title, style = MaterialTheme.typography.titleMedium, color = MaterialTheme.colorScheme.onPrimary, - modifier = modifier + modifier = modifier, + maxLines = 1, + overflow = TextOverflow.Ellipsis ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/RelayLocationCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/RelayLocationCell.kt index 032695be8895..0342a0f5e7af 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/RelayLocationCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/RelayLocationCell.kt @@ -30,6 +30,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Dp import net.mullvad.mullvadvpn.R @@ -296,7 +297,9 @@ private fun Name(modifier: Modifier = Modifier, relay: RelayItem) { AlphaInactive } ) - .padding(horizontal = Dimens.smallPadding, vertical = Dimens.mediumPadding) + .padding(horizontal = Dimens.smallPadding, vertical = Dimens.mediumPadding), + maxLines = 1, + overflow = TextOverflow.Ellipsis ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/TwoRowCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/TwoRowCell.kt index 0b1f36d21d95..17eb5d315a34 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/TwoRowCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/TwoRowCell.kt @@ -7,6 +7,7 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import net.mullvad.mullvadvpn.lib.theme.AppTheme import net.mullvad.mullvadvpn.lib.theme.Dimens @@ -33,13 +34,17 @@ fun TwoRowCell( modifier = Modifier.fillMaxWidth(), text = titleText, style = MaterialTheme.typography.labelLarge, - color = titleColor + color = titleColor, + maxLines = 1, + overflow = TextOverflow.Ellipsis ) Text( modifier = Modifier.fillMaxWidth(), text = subtitleText, style = MaterialTheme.typography.labelLarge, - color = subtitleColor + color = subtitleColor, + maxLines = 1, + overflow = TextOverflow.Ellipsis ) } },