From 854f0c25dcea9d8b2aeb9b7a88b3ede4455e688a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20G=C3=B6ransson?= Date: Fri, 8 Sep 2023 08:57:06 +0200 Subject: [PATCH] Fix padding for dialogs --- .../mullvad/mullvadvpn/compose/component/List.kt | 3 +-- .../mullvadvpn/compose/dialog/ChangelogDialog.kt | 12 +++++++----- .../mullvad/mullvadvpn/compose/dialog/DnsDialog.kt | 1 - .../mullvad/mullvadvpn/compose/dialog/InfoDialog.kt | 13 ++++--------- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/List.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/List.kt index d7b550a3d0ba..d94632650936 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/List.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/List.kt @@ -149,7 +149,6 @@ fun ListItem( @Composable fun ChangeListItem(text: String) { - val smallPadding = Dimens.smallPadding ConstraintLayout { val (bullet, changeLog) = createRefs() @@ -170,7 +169,7 @@ fun ChangeListItem(text: String) { modifier = Modifier.absolutePadding(left = Dimens.mediumPadding).constrainAs(changeLog) { top.linkTo(parent.top) - bottom.linkTo(parent.bottom, margin = smallPadding) + bottom.linkTo(parent.bottom) start.linkTo(parent.start) end.linkTo(parent.end) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ChangelogDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ChangelogDialog.kt index 27cc1c221ba4..e7f786b5b6a9 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ChangelogDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ChangelogDialog.kt @@ -1,9 +1,9 @@ package net.mullvad.mullvadvpn.compose.dialog +import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.defaultMinSize import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.material3.AlertDialog import androidx.compose.material3.Button @@ -39,13 +39,16 @@ fun ChangelogDialog(changesList: List, version: String, onDismiss: () -> ) }, text = { - Column { + Column( + modifier = Modifier.fillMaxWidth(), + verticalArrangement = + Arrangement.spacedBy(dimensionResource(id = R.dimen.small_padding)) + ) { Text( text = stringResource(R.string.changes_dialog_subtitle), fontSize = 18.sp, color = Color.White, - modifier = - Modifier.padding(vertical = dimensionResource(id = R.dimen.medium_padding)) + modifier = Modifier.fillMaxWidth() ) changesList.forEach { changeItem -> ChangeListItem(text = changeItem) } @@ -55,7 +58,6 @@ fun ChangelogDialog(changesList: List, version: String, onDismiss: () -> Button( modifier = Modifier.wrapContentHeight() - .padding(all = dimensionResource(id = R.dimen.medium_padding)) .defaultMinSize(minHeight = dimensionResource(id = R.dimen.button_height)) .fillMaxWidth(), colors = diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DnsDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DnsDialog.kt index 7d681f8520d7..cedc381724a4 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DnsDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DnsDialog.kt @@ -14,7 +14,6 @@ import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/InfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/InfoDialog.kt index c3420bad26eb..6f22d65fb139 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/InfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/InfoDialog.kt @@ -1,10 +1,9 @@ package net.mullvad.mullvadvpn.compose.dialog import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.defaultMinSize +import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.material3.AlertDialog import androidx.compose.material3.Button @@ -58,7 +57,6 @@ fun InfoDialog(message: String, additionalInfo: String? = null, onDismiss: () -> text = { Column( horizontalAlignment = Alignment.CenterHorizontally, - modifier = Modifier.padding(top = verticalSpacing) ) { Text( text = message, @@ -66,9 +64,10 @@ fun InfoDialog(message: String, additionalInfo: String? = null, onDismiss: () -> fontSize = dimensionResource(id = R.dimen.text_small).value.sp, fontStyle = FontStyle.Normal, textAlign = TextAlign.Start, - modifier = Modifier.padding(bottom = verticalSpacing).fillMaxWidth() + modifier = Modifier.fillMaxWidth() ) if (additionalInfo != null) { + Spacer(modifier = Modifier.height(verticalSpacing)) HtmlText( htmlFormattedString = additionalInfo, textColor = colorResource(id = R.color.white).toArgb(), @@ -80,11 +79,7 @@ fun InfoDialog(message: String, additionalInfo: String? = null, onDismiss: () -> }, confirmButton = { Button( - modifier = - Modifier.wrapContentHeight() - .padding(all = dimensionResource(id = R.dimen.medium_padding)) - .defaultMinSize(minHeight = dimensionResource(id = R.dimen.button_height)) - .fillMaxWidth(), + modifier = Modifier.wrapContentHeight().fillMaxWidth(), colors = ButtonDefaults.buttonColors( containerColor = colorResource(id = R.color.blue),