diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/BottomStickyButtonScaffold.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/BottomStickyButtonScaffold.kt index 5f24fb217..ef6cab0e0 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/BottomStickyButtonScaffold.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/BottomStickyButtonScaffold.kt @@ -17,15 +17,21 @@ */ package com.infomaniak.swisstransfer.ui.components +import androidx.compose.foundation.background import androidx.compose.foundation.layout.* -import androidx.compose.material3.Scaffold -import androidx.compose.material3.SnackbarHost -import androidx.compose.material3.SnackbarHostState +import androidx.compose.material3.* import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.style.TextAlign import com.infomaniak.swisstransfer.ui.theme.Dimens import com.infomaniak.swisstransfer.ui.theme.Margin +import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme +import com.infomaniak.swisstransfer.ui.utils.PreviewLargeWindow +import com.infomaniak.swisstransfer.ui.utils.PreviewSmallWindow + +private val STICKY_BUTTON_VERTICAL_PADDING = Margin.Small @Composable fun BottomStickyButtonScaffold( @@ -44,12 +50,12 @@ fun BottomStickyButtonScaffold( modifier = modifier .fillMaxWidth() .padding(contentPaddings) - .padding(vertical = Margin.Small), + .padding(vertical = STICKY_BUTTON_VERTICAL_PADDING), horizontalAlignment = Alignment.CenterHorizontally, ) { Box( modifier = Modifier - .padding(bottom = Margin.Small) + .padding(bottom = STICKY_BUTTON_VERTICAL_PADDING) .weight(1.0f) .widthIn(max = Dimens.MaxSinglePaneScreenWidth), content = content, @@ -58,3 +64,40 @@ fun BottomStickyButtonScaffold( } } } + +@PreviewSmallWindow +@PreviewLargeWindow +@Composable +private fun Preview() { + SwissTransferTheme { + Surface { + BottomStickyButtonScaffold( + topBar = { + Text( + modifier = Modifier + .fillMaxWidth() + .background(Color.DarkGray), + text = "topBar", + textAlign = TextAlign.Center, + ) + }, + topButton = { modifier -> + SwissTransferButton( + modifier = modifier, + style = ButtonType.PRIMARY, + onClick = {}, + content = { Text("sticky button") }, + ) + }, + ) { + Text( + modifier = Modifier + .fillMaxSize() + .background(Color.LightGray), + text = "content", + textAlign = TextAlign.Center, + ) + } + } + } +} diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/DoubleButtonCombo.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/DoubleButtonCombo.kt index f8334474c..e2e4d4387 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/DoubleButtonCombo.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/DoubleButtonCombo.kt @@ -125,6 +125,7 @@ private fun DoubleButtonComboPreview() { ) }, ) + Spacer(Modifier.height(Margin.Medium)) DoubleButtonCombo( bottomButton = { LargeButton( diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/components/PasswordOptionAlertDialog.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/components/PasswordOptionAlertDialog.kt index fe275b5e3..49f6ad9c9 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/components/PasswordOptionAlertDialog.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/components/PasswordOptionAlertDialog.kt @@ -26,10 +26,12 @@ import androidx.compose.runtime.* import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.alpha import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.tooling.preview.Preview import com.infomaniak.swisstransfer.R +import com.infomaniak.swisstransfer.ui.MatomoSwissTransfer.toFloat import com.infomaniak.swisstransfer.ui.components.SwissTransferAlertDialog import com.infomaniak.swisstransfer.ui.components.SwissTransferTextField import com.infomaniak.swisstransfer.ui.screen.newtransfer.importfiles.PasswordTransferOption @@ -110,8 +112,10 @@ private fun ColumnScope.AnimatedPasswordInput( imeAction = ImeAction.Done, isError = isError, supportingText = { - val errorText = if (isError) stringResource(R.string.errorTransferPasswordLength) else "" - Text(text = errorText, minLines = 2) + Text( + modifier = Modifier.alpha(isError.toFloat()), + text = stringResource(R.string.errorTransferPasswordLength), + ) }, onValueChange = { password.set(it) }, ) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/components/TransferTypeButtons.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/components/TransferTypeButtons.kt index 92cf1f63a..fd2d5d665 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/components/TransferTypeButtons.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/components/TransferTypeButtons.kt @@ -20,10 +20,7 @@ package com.infomaniak.swisstransfer.ui.screen.newtransfer.importfiles.component import androidx.annotation.PluralsRes import androidx.annotation.StringRes import androidx.compose.foundation.horizontalScroll -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.WindowInsets -import androidx.compose.foundation.layout.windowInsetsPadding +import androidx.compose.foundation.layout.* import androidx.compose.foundation.rememberScrollState import androidx.compose.material3.Surface import androidx.compose.runtime.Composable @@ -47,7 +44,7 @@ fun TransferTypeButtons(transferType: GetSetCallbacks) { Row( modifier = Modifier .horizontalScroll(rememberScrollState()) - .windowInsetsPadding(insets = WindowInsets(left = Margin.Medium, top = 0.dp, right = Margin.Medium, bottom = 0.dp)), + .padding(horizontal = Margin.Medium), horizontalArrangement = Arrangement.spacedBy(Margin.Mini), ) { for (transferTypeEntry in TransferTypeUi.entries) {