diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/EmailAddressChip.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/EmailAddressChip.kt index c568c68ce..e2334b4a0 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/EmailAddressChip.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/EmailAddressChip.kt @@ -24,6 +24,7 @@ import androidx.compose.material3.Surface 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 com.infomaniak.swisstransfer.ui.theme.CustomShapes import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme @@ -38,6 +39,8 @@ fun EmailAddressChip( label = { Text( text = text, + maxLines = 1, + overflow = TextOverflow.MiddleEllipsis, style = SwissTransferTheme.typography.bodyRegular, ) }, diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/EmailsFlowRow.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/EmailsFlowRow.kt new file mode 100644 index 000000000..f9da94764 --- /dev/null +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/EmailsFlowRow.kt @@ -0,0 +1,61 @@ +/* + * Infomaniak SwissTransfer - Android + * Copyright (C) 2024 Infomaniak Network SA + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.infomaniak.swisstransfer.ui.components + +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.ExperimentalLayoutApi +import androidx.compose.foundation.layout.FlowRow +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Surface +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.PreviewParameter +import com.infomaniak.swisstransfer.ui.previewparameter.EmailsPreviewParameter +import com.infomaniak.swisstransfer.ui.theme.Margin +import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme +import com.infomaniak.swisstransfer.ui.utils.PreviewLightAndDark + +@OptIn(ExperimentalLayoutApi::class) +@Composable +fun EmailsFlowRow( + emails: List, + modifier: Modifier = Modifier, + horizontalArrangement: Arrangement.Horizontal = Arrangement.Start, +) { + FlowRow( + modifier = modifier, + horizontalArrangement = horizontalArrangement, + ) { + emails.forEach { + EmailAddressChip( + text = it, + modifier = Modifier.padding(horizontal = Margin.Micro), + ) + } + } +} + +@PreviewLightAndDark +@Composable +private fun Preview(@PreviewParameter(EmailsPreviewParameter::class) emails: List) { + SwissTransferTheme { + Surface { + EmailsFlowRow(emails) + } + } +} diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadSuccessEmailScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadSuccessEmailScreen.kt index 60675341e..0e442f7b9 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadSuccessEmailScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadSuccessEmailScreen.kt @@ -50,40 +50,29 @@ fun UploadSuccessEmailScreen( onClick = closeActivity, ) }, - content = { Content(emails) }, - ) -} - -@OptIn(ExperimentalLayoutApi::class) -@Composable -private fun Content(emails: List) { - Column( - modifier = Modifier - .fillMaxSize() - .verticalScroll(rememberScrollState()) - .padding(Margin.Medium), - horizontalAlignment = Alignment.CenterHorizontally, - verticalArrangement = Arrangement.Center, ) { + Column( + modifier = Modifier + .fillMaxSize() + .verticalScroll(rememberScrollState()) + .padding(Margin.Medium), + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.Center, + ) { - IllustratedMessageBlock( - icon = AppIllus.Beers.image(), - title = TransferType.MAIL.titleRes, - description = pluralStringResource(TransferType.MAIL.descriptionRes!!, emails.count()), - ) + IllustratedMessageBlock( + icon = AppIllus.Beers.image(), + title = TransferType.MAIL.titleRes, + description = pluralStringResource(TransferType.MAIL.descriptionRes!!, emails.count()), + ) - Spacer(modifier = Modifier.height(Margin.Medium)) + Spacer(modifier = Modifier.height(Margin.Medium)) - FlowRow( - modifier = Modifier.widthIn(max = 800.dp), - horizontalArrangement = Arrangement.Center, - ) { - emails.forEach { - EmailAddressChip( - text = it, - modifier = Modifier.padding(horizontal = Margin.Micro), - ) - } + EmailsFlowRow( + emails = emails, + modifier = Modifier.widthIn(max = 800.dp), + horizontalArrangement = Arrangement.Center, + ) } } } diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/ColorLight.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/ColorLight.kt index a92f243d8..138701e0f 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/ColorLight.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/ColorLight.kt @@ -86,7 +86,7 @@ val CustomLightColorScheme = CustomColorScheme( transferTypeQrOnContainer = Color(green_main), transferTypeProximityContainer = Color(specific3), transferTypeProximityOnContainer = Color(specific4), - emailAddressChipColor = Color(green_contrast), + emailAddressChipColor = Color(green_secondary), onEmailAddressChipColor = Color(green_dark), qrCodeDarkPixels = Color(green_dark), qrCodeLightPixels = Color(white),