Skip to content

Commit

Permalink
Fix text overflow and max lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawa committed Jun 14, 2024
1 parent 24810d5 commit 0720a4d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import net.mullvad.mullvadvpn.R
import net.mullvad.mullvadvpn.lib.model.ActionAfterDisconnect
Expand Down Expand Up @@ -58,6 +59,8 @@ private fun DisconnectedText(modifier: Modifier) {
text = textResource(id = R.string.unsecured_connection),
color = MaterialTheme.colorScheme.error,
style = MaterialTheme.typography.connectionStatus,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = modifier
)
}
Expand All @@ -73,6 +76,8 @@ private fun ConnectingText(isQuantumResistant: Boolean, modifier: Modifier) {
),
color = MaterialTheme.colorScheme.onPrimary,
style = MaterialTheme.typography.connectionStatus,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = modifier
)
}
Expand All @@ -88,6 +93,8 @@ private fun ConnectedText(isQuantumResistant: Boolean, modifier: Modifier) {
),
color = MaterialTheme.colorScheme.surface,
style = MaterialTheme.typography.connectionStatus,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = modifier
)
}
Expand All @@ -103,6 +110,8 @@ private fun ErrorText(isBlocking: Boolean, modifier: Modifier) {
if (isBlocking) MaterialTheme.colorScheme.onPrimary
else MaterialTheme.colorScheme.error,
style = MaterialTheme.typography.connectionStatus,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = modifier
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.compose.collectAsStateWithLifecycle
Expand Down Expand Up @@ -352,12 +353,16 @@ private fun ConnectionInfo(state: ConnectUiState) {
text = state.location?.country ?: "",
style = MaterialTheme.typography.headlineLarge,
color = MaterialTheme.colorScheme.onPrimary,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.padding(horizontal = Dimens.sideMargin)
)
Text(
text = state.location?.city ?: "",
style = MaterialTheme.typography.headlineLarge,
color = MaterialTheme.colorScheme.onPrimary,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.padding(horizontal = Dimens.sideMargin)
)
var expanded by rememberSaveable { mutableStateOf(false) }
Expand Down

0 comments on commit 0720a4d

Please sign in to comment.