From 589e7a60e52600cecd62a03b5453f933ca4d9a79 Mon Sep 17 00:00:00 2001 From: Gibran Chevalley Date: Tue, 20 Aug 2024 11:50:26 +0200 Subject: [PATCH 1/6] Add bogus navigation so we can reach the TransferTypeDestination screen during dev --- .../ui/screen/newtransfer/NewTransferNavHost.kt | 4 +--- .../newtransfer/importfiles/ImportFilesScreen.kt | 10 ++++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferNavHost.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferNavHost.kt index 2b27689c1..9f72e67bf 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferNavHost.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferNavHost.kt @@ -18,9 +18,7 @@ package com.infomaniak.swisstransfer.ui.screen.newtransfer -import androidx.compose.foundation.layout.safeDrawingPadding import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier import androidx.navigation.NavHostController import androidx.navigation.compose.NavHost import androidx.navigation.compose.composable @@ -38,7 +36,7 @@ fun NewTransferNavHost(navController: NavHostController) { NavHost(navController, NewTransferNavigation.startDestination) { composable { - ImportFilesScreen() + ImportFilesScreen(navigateToTransferTypeScreen = { navController.navigate(TransferTypeDestination) }) } composable { TransferTypeScreen() diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt index edb6867ce..6e1a826b2 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt @@ -41,7 +41,7 @@ import com.infomaniak.swisstransfer.ui.utils.PreviewMobile import com.infomaniak.swisstransfer.ui.utils.PreviewTablet @Composable -fun ImportFilesScreen() { +fun ImportFilesScreen(navigateToTransferTypeScreen: () -> Unit) { var showUploadSourceChoiceBottomSheet by rememberSaveable { mutableStateOf(false) } BottomStickyButtonScaffold( @@ -67,6 +67,7 @@ fun ImportFilesScreen() { UploadSourceChoiceBottomSheet( isBottomSheetVisible = { showUploadSourceChoiceBottomSheet }, onDismissRequest = { showUploadSourceChoiceBottomSheet = false }, + onCameraClicked = { navigateToTransferTypeScreen() } ) } } @@ -76,6 +77,7 @@ fun ImportFilesScreen() { private fun UploadSourceChoiceBottomSheet( isBottomSheetVisible: () -> Boolean, onDismissRequest: () -> Unit, + onCameraClicked: () -> Unit, ) { if (isBottomSheetVisible()) { SwissTransferBottomSheet( @@ -83,7 +85,7 @@ private fun UploadSourceChoiceBottomSheet( titleRes = R.string.transferUploadSourceChoiceTitle, content = { Column { - BottomSheetItem(AppIcons.Camera, R.string.transferUploadSourceChoiceCamera) { /*TODO*/ } + BottomSheetItem(AppIcons.Camera, R.string.transferUploadSourceChoiceCamera, onClick = onCameraClicked) HorizontalDivider(Modifier.padding(horizontal = Margin.Medium)) BottomSheetItem(AppIcons.PolaroidLandscape, R.string.transferUploadSourceChoiceGallery) { /*TODO*/ } HorizontalDivider(Modifier.padding(horizontal = Margin.Medium)) @@ -99,7 +101,7 @@ private fun UploadSourceChoiceBottomSheet( @Composable private fun ImportFilesScreenPreview() { SwissTransferTheme { - ImportFilesScreen() + ImportFilesScreen {} } } @@ -109,7 +111,7 @@ private fun ImportFilesScreenPreview() { private fun ImportChoiceBottomSheetPreview() { SwissTransferTheme { Surface { - UploadSourceChoiceBottomSheet({ true }, {}) + UploadSourceChoiceBottomSheet({ true }, {}, {}) } } } From 2e1551dfa41c9fcd728fbd140f6441971aeb7d4f Mon Sep 17 00:00:00 2001 From: Gibran Chevalley Date: Tue, 20 Aug 2024 12:44:18 +0200 Subject: [PATCH 2/6] Add transfer type buttons --- .../ui/icons/illu/ChainTilted.kt | 81 +++++++++++++ .../ui/icons/illu/EnvelopeTilted.kt | 84 +++++++++++++ .../ui/icons/illu/QrCodeTilted.kt | 85 ++++++++++++++ .../ui/icons/illu/WaveSignalTilted.kt | 68 +++++++++++ .../screen/newtransfer/NewTransferNavHost.kt | 2 +- .../importfiles/TransferTypeScreen.kt | 83 ++++++++++++- .../components/TransferTypeButtons.kt | 111 ++++++++++++++++++ .../swisstransfer/ui/theme/ColorDark.kt | 9 ++ .../swisstransfer/ui/theme/ColorLight.kt | 8 ++ .../swisstransfer/ui/theme/Theme.kt | 8 ++ 10 files changed, 536 insertions(+), 3 deletions(-) create mode 100644 app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/ChainTilted.kt create mode 100644 app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/EnvelopeTilted.kt create mode 100644 app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/QrCodeTilted.kt create mode 100644 app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/WaveSignalTilted.kt create mode 100644 app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/components/TransferTypeButtons.kt diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/ChainTilted.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/ChainTilted.kt new file mode 100644 index 000000000..d25fdb719 --- /dev/null +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/ChainTilted.kt @@ -0,0 +1,81 @@ +package com.infomaniak.swisstransfer.ui.icons.illu + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.size +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.PathFillType.Companion.NonZero +import androidx.compose.ui.graphics.SolidColor +import androidx.compose.ui.graphics.StrokeCap +import androidx.compose.ui.graphics.StrokeJoin.Companion.Round +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.graphics.vector.ImageVector.Builder +import androidx.compose.ui.graphics.vector.group +import androidx.compose.ui.graphics.vector.path +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.infomaniak.swisstransfer.ui.icons.AppIcons + +val AppIcons.Illu.ChainTilted: ImageVector + get() { + if (_chainTilted != null) { + return _chainTilted!! + } + _chainTilted = Builder( + name = "ChainTilted", + defaultWidth = 120.0.dp, + defaultHeight = 80.0.dp, + viewportWidth = 120.0f, + viewportHeight = 80.0f + ).apply { + group { + path( + fill = null, + stroke = SolidColor(Color(0xFF3cb572)), + strokeLineWidth = 3.264f, + strokeLineCap = StrokeCap.Round, + strokeLineJoin = Round, + strokeLineMiter = 4.0f, + pathFillType = NonZero + ) { + moveTo(47.1f, 75.72f) + lineToRelative(-4.56f, 4.56f) + arcToRelative(22.03f, 22.03f, 0.0f, true, true, -31.16f, -31.16f) + lineToRelative(23.37f, -23.37f) + arcToRelative(22.03f, 22.03f, 0.0f, false, true, 33.41f, 28.52f) + } + path( + fill = null, + stroke = SolidColor(Color(0xFF3cb572)), + strokeLineWidth = 3.264f, + strokeLineCap = StrokeCap.Round, + strokeLineJoin = Round, + strokeLineMiter = 4.0f, + pathFillType = NonZero + ) { + moveTo(73.8f, 12.4f) + lineToRelative(3.67f, -3.67f) + arcToRelative(22.03f, 22.03f, 0.0f, false, true, 31.16f, 31.16f) + lineTo(85.26f, 63.25f) + arcToRelative(22.03f, 22.03f, 0.0f, false, true, -33.41f, -28.52f) + } + } + }.build() + return _chainTilted!! + } + +private var _chainTilted: ImageVector? = null + +@Preview +@Composable +private fun Preview() { + Box { + Image( + imageVector = AppIcons.Illu.ChainTilted, + contentDescription = null, + modifier = Modifier.size(AppIcons.previewSize) + ) + } +} diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/EnvelopeTilted.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/EnvelopeTilted.kt new file mode 100644 index 000000000..cf19b4846 --- /dev/null +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/EnvelopeTilted.kt @@ -0,0 +1,84 @@ +package com.infomaniak.swisstransfer.ui.icons.illu + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.size +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.PathFillType.Companion.NonZero +import androidx.compose.ui.graphics.SolidColor +import androidx.compose.ui.graphics.StrokeCap +import androidx.compose.ui.graphics.StrokeJoin.Companion.Round +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.graphics.vector.ImageVector.Builder +import androidx.compose.ui.graphics.vector.group +import androidx.compose.ui.graphics.vector.path +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.infomaniak.swisstransfer.ui.icons.AppIcons + +val AppIcons.Illu.EnvelopeTilted: ImageVector + get() { + if (_envelopeTilted != null) { + return _envelopeTilted!! + } + _envelopeTilted = Builder( + name = "EnvelopeTilted", + defaultWidth = 120.0.dp, + defaultHeight = 80.0.dp, + viewportWidth = 120.0f, + viewportHeight = 80.0f + ).apply { + group { + path( + fill = null, + stroke = SolidColor(Color(0xFF014958)), + strokeLineWidth = 2.982f, + strokeLineCap = StrokeCap.Round, + strokeLineJoin = Round, + strokeLineMiter = 4.0f, + pathFillType = NonZero + ) { + moveTo(86.13f, 4.46f) + lineTo(64.07f, 62.74f) + lineTo(2.57f, 52.69f) + } + path( + fill = null, + stroke = SolidColor(Color(0xFF014958)), + strokeLineWidth = 2.982f, + strokeLineCap = StrokeCap.Round, + strokeLineJoin = Round, + strokeLineMiter = 4.0f, + pathFillType = NonZero + ) { + moveTo(81.12f, 4.77f) + lineTo(5.34f, 48.52f) + curveToRelative(-3.14f, 1.81f, -4.18f, 5.88f, -2.33f, 9.09f) + lineToRelative(26.83f, 46.48f) + curveToRelative(1.85f, 3.21f, 5.9f, 4.34f, 9.04f, 2.53f) + lineToRelative(75.78f, -43.75f) + curveToRelative(3.14f, -1.81f, 4.18f, -5.88f, 2.33f, -9.09f) + lineTo(90.16f, 7.3f) + curveToRelative(-1.85f, -3.21f, -5.9f, -4.34f, -9.04f, -2.53f) + close() + } + } + }.build() + return _envelopeTilted!! + } + +private var _envelopeTilted: ImageVector? = null + +@Preview +@Composable +private fun Preview() { + Box { + Image( + imageVector = AppIcons.Illu.EnvelopeTilted, + contentDescription = null, + modifier = Modifier.size(AppIcons.previewSize) + ) + } +} diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/QrCodeTilted.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/QrCodeTilted.kt new file mode 100644 index 000000000..92484c178 --- /dev/null +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/QrCodeTilted.kt @@ -0,0 +1,85 @@ +package com.infomaniak.swisstransfer.ui.icons.illu + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.size +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.PathFillType.Companion.NonZero +import androidx.compose.ui.graphics.SolidColor +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.graphics.vector.ImageVector.Builder +import androidx.compose.ui.graphics.vector.path +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.infomaniak.swisstransfer.ui.icons.AppIcons +import androidx.compose.ui.graphics.StrokeCap.Companion.Round as strokeCapRound +import androidx.compose.ui.graphics.StrokeJoin.Companion.Round as strokeJoinRound + +val AppIcons.Illu.QrCodeTilted: ImageVector + get() { + if (_qrCodeTilted != null) { + return _qrCodeTilted!! + } + _qrCodeTilted = Builder( + name = "QrCodeTilted", + defaultWidth = 120.0.dp, + defaultHeight = 80.0.dp, + viewportWidth = 120.0f, + viewportHeight = 80.0f + ).apply { + path( + fill = null, + stroke = SolidColor(Color(0xFF3cb572)), + strokeLineWidth = 2.77778f, + strokeLineCap = strokeCapRound, + strokeLineJoin = strokeJoinRound, + strokeLineMiter = 4.0f, + pathFillType = NonZero + ) { + moveTo(15.55f, 56.31f) + lineToRelative(14.43f, -8.34f) + lineToRelative(-8.33f, -14.43f) + lineToRelative(-14.44f, 8.33f) + lineToRelative(8.34f, 14.44f) + close() + moveToRelative(79.68f, 21.34f) + lineToRelative(14.43f, -8.33f) + lineToRelative(-8.33f, -14.43f) + lineToRelative(-14.43f, 8.33f) + lineToRelative(8.33f, 14.43f) + close() + moveToRelative(-71.35f, -6.91f) + lineToRelative(28.87f, -16.67f) + lineToRelative(-4.17f, -7.22f) + moveToRelative(14.43f, -8.33f) + lineToRelative(-12.5f, -21.65f) + lineToRelative(21.65f, -12.5f) + lineToRelative(12.5f, 21.65f) + lineToRelative(-7.21f, 4.17f) + moveToRelative(-37.2f, 2.23f) + lineToRelative(-4.17f, -7.22f) + moveToRelative(37.5f, 64.95f) + lineTo(61.08f, 68.5f) + lineToRelative(7.22f, -4.16f) + moveToRelative(10.27f, -15.55f) + lineTo(93.0f, 40.46f) + } + }.build() + return _qrCodeTilted!! + } + +private var _qrCodeTilted: ImageVector? = null + +@Preview +@Composable +private fun Preview() { + Box { + Image( + imageVector = AppIcons.Illu.QrCodeTilted, + contentDescription = null, + modifier = Modifier.size(AppIcons.previewSize) + ) + } +} diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/WaveSignalTilted.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/WaveSignalTilted.kt new file mode 100644 index 000000000..547a0b091 --- /dev/null +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/WaveSignalTilted.kt @@ -0,0 +1,68 @@ +package com.infomaniak.swisstransfer.ui.icons.illu + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.size +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.PathFillType.Companion.NonZero +import androidx.compose.ui.graphics.SolidColor +import androidx.compose.ui.graphics.StrokeCap +import androidx.compose.ui.graphics.StrokeJoin.Companion.Round +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.graphics.vector.ImageVector.Builder +import androidx.compose.ui.graphics.vector.group +import androidx.compose.ui.graphics.vector.path +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.infomaniak.swisstransfer.ui.icons.AppIcons + +val AppIcons.Illu.WaveSignalTilted: ImageVector + get() { + if (_waveSignalTilted != null) { + return _waveSignalTilted!! + } + _waveSignalTilted = Builder( + name = "WaveSignalTilted", + defaultWidth = 120.0.dp, + defaultHeight = 80.0.dp, + viewportWidth = 120.0f, + viewportHeight = 80.0f + ).apply { + group {} + group { + path( + fill = null, + stroke = SolidColor(Color(0xFFcf9e1b)), + strokeLineWidth = 2.931f, + strokeLineCap = StrokeCap.Round, + strokeLineJoin = Round, + strokeLineMiter = 4.0f, + pathFillType = NonZero + ) { + moveTo(93.93f, 50.5f) + arcToRelative(32.97f, 32.97f, 0.0f, false, false, -40.38f, 23.31f) + moveToRelative(46.19f, -42.82f) + arcToRelative(52.75f, 52.75f, 0.0f, false, false, -64.6f, 37.3f) + moveToRelative(66.36f, -56.51f) + arcToRelative(72.53f, 72.53f, 0.0f, false, false, -85.65f, 49.45f) + } + } + }.build() + return _waveSignalTilted!! + } + +private var _waveSignalTilted: ImageVector? = null + +@Preview +@Composable +private fun Preview() { + Box { + Image( + imageVector = AppIcons.Illu.WaveSignalTilted, + contentDescription = null, + modifier = Modifier.size(AppIcons.previewSize) + ) + } +} diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferNavHost.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferNavHost.kt index 9f72e67bf..54467d858 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferNavHost.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferNavHost.kt @@ -39,7 +39,7 @@ fun NewTransferNavHost(navController: NavHostController) { ImportFilesScreen(navigateToTransferTypeScreen = { navController.navigate(TransferTypeDestination) }) } composable { - TransferTypeScreen() + TransferTypeScreen(navigateToTransfer = { /*TODO*/ }) } composable { TransferOptionsScreen() diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/TransferTypeScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/TransferTypeScreen.kt index 5f02f61d0..e57a4e3a4 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/TransferTypeScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/TransferTypeScreen.kt @@ -18,10 +18,89 @@ package com.infomaniak.swisstransfer.ui.screen.newtransfer.importfiles +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Scaffold 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.graphics.vector.ImageVector +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextAlign +import com.infomaniak.swisstransfer.R +import com.infomaniak.swisstransfer.ui.components.SwissTransferTobAppBar +import com.infomaniak.swisstransfer.ui.icons.AppIcons +import com.infomaniak.swisstransfer.ui.icons.illu.ChainTilted +import com.infomaniak.swisstransfer.ui.icons.illu.EnvelopeTilted +import com.infomaniak.swisstransfer.ui.icons.illu.QrCodeTilted +import com.infomaniak.swisstransfer.ui.icons.illu.WaveSignalTilted +import com.infomaniak.swisstransfer.ui.screen.newtransfer.importfiles.components.TransferTypeButtons +import com.infomaniak.swisstransfer.ui.theme.Margin +import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme +import com.infomaniak.swisstransfer.ui.utils.PreviewMobile +import com.infomaniak.swisstransfer.ui.utils.PreviewTablet @Composable -fun TransferTypeScreen() { - Text("TransferTypeScreen") +fun TransferTypeScreen(navigateToTransfer: (TransferType) -> Unit) { + Scaffold(topBar = { SwissTransferTobAppBar() }) { contentPaddings -> + Column( + modifier = Modifier + .fillMaxWidth() + .padding(contentPaddings) + ) { + Text( + modifier = Modifier + .fillMaxWidth() + .padding(vertical = Margin.Large, horizontal = Margin.Medium), + text = stringResource(R.string.appName), + style = SwissTransferTheme.typography.h1, + textAlign = TextAlign.Center, + ) + + TransferTypeButtons(TransferType.entries, navigateToTransfer) + } + } +} + +enum class TransferType( + val label: String, + val background: @Composable () -> Color, + val foreground: @Composable () -> Color, + val icon: ImageVector, +) { + LINK( + "Lien", + { SwissTransferTheme.colors.transferTypeLinkContainer }, + { SwissTransferTheme.colors.transferTypeLinkOnContainer }, + AppIcons.Illu.ChainTilted + ), + EMAIL( + "Mail", + { SwissTransferTheme.colors.transferTypeEmailContainer }, + { SwissTransferTheme.colors.transferTypeEmailOnContainer }, + AppIcons.Illu.EnvelopeTilted + ), + QR_CODE( + "QR Code", + { SwissTransferTheme.colors.transferTypeQrContainer }, + { SwissTransferTheme.colors.transferTypeQrOnContainer }, + AppIcons.Illu.QrCodeTilted + ), + PROXIMITY( + "A proximité", + { SwissTransferTheme.colors.transferTypeProximityContainer }, + { SwissTransferTheme.colors.transferTypeProximityOnContainer }, + AppIcons.Illu.WaveSignalTilted + ), +} + +@PreviewMobile +@PreviewTablet +@Composable +private fun TransferTypeScreenPreview() { + SwissTransferTheme { + TransferTypeScreen {} + } } 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 new file mode 100644 index 000000000..d852d790d --- /dev/null +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/components/TransferTypeButtons.kt @@ -0,0 +1,111 @@ +/* + * 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.screen.newtransfer.importfiles.components + +import android.content.res.Configuration +import androidx.compose.foundation.layout.* +import androidx.compose.foundation.lazy.grid.GridCells +import androidx.compose.foundation.lazy.grid.LazyVerticalGrid +import androidx.compose.foundation.lazy.grid.items +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.graphics.vector.ImageVector +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.infomaniak.swisstransfer.ui.screen.newtransfer.importfiles.TransferType +import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme + +private val SPACE_AROUND_BUTTONS = 20.dp +private val COLUMN_MIN_WIDTH = 150.dp + +@Composable +fun TransferTypeButtons(items: List, navigateToTransfer: (TransferType) -> Unit) { + LazyVerticalGrid( + modifier = Modifier + .padding(horizontal = SPACE_AROUND_BUTTONS) + .wrapContentHeight(), + userScrollEnabled = false, + columns = GridCells.Adaptive(COLUMN_MIN_WIDTH), + verticalArrangement = Arrangement.spacedBy(SPACE_AROUND_BUTTONS), + horizontalArrangement = Arrangement.spacedBy(SPACE_AROUND_BUTTONS), + ) { + items(items = items, key = { it.label }) { item -> + TransferTypeButton( + modifier = Modifier.aspectRatio(0.87f), + label = item.label, + background = item.background(), + foreground = item.foreground(), + icon = item.icon, + onClick = { navigateToTransfer(item) } + ) + } + } +} + +@Composable +private fun TransferTypeButton( + modifier: Modifier = Modifier, + label: String, + background: Color, + foreground: Color, + icon: ImageVector, + onClick: () -> Unit, +) { + Button( + contentPadding = PaddingValues(0.dp), + modifier = modifier.fillMaxSize(), + colors = ButtonDefaults.buttonColors(containerColor = background, contentColor = foreground), + shape = ShapeDefaults.Medium, + onClick = onClick, + ) { + Box(modifier = Modifier.fillMaxSize()) { + Text( + modifier = Modifier + .fillMaxHeight(0.80f) + .align(Alignment.BottomCenter), + text = label, + textAlign = TextAlign.Center, + style = SwissTransferTheme.typography.bodyMedium, + ) + + Icon( + modifier = Modifier + .fillMaxWidth(0.75f) + .align(Alignment.BottomCenter), + imageVector = icon, + contentDescription = null, + ) + } + } +} + +@Preview(name = "Light") +@Preview(name = "Dark", uiMode = Configuration.UI_MODE_NIGHT_YES or Configuration.UI_MODE_TYPE_NORMAL) +@Composable +private fun TransferTypeButtonsPreview() { + SwissTransferTheme { + Surface { + TransferTypeButtons(TransferType.entries) {} + } + } +} diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/ColorDark.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/ColorDark.kt index 342a7c3e4..64e72d278 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/ColorDark.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/ColorDark.kt @@ -36,6 +36,7 @@ private const val specific1 = 0xFF124426 private const val specific2 = 0xFF334117 private const val specific3 = 0xFF503E0F private const val specific4 = 0xFFEAC35D +private const val specific5 = 0xFF49DEFD // Extra palette private const val error = 0xFFFC8878 @@ -70,4 +71,12 @@ val CustomDarkColorScheme = CustomColorScheme( navigationItemBackground = Color(dark2), tertiaryButtonBackground = Color(dark2), selectedSettingItem = Color(dark2), + transferTypeLinkContainer = Color(specific1), + transferTypeLinkOnContainer = Color(green_main), + transferTypeEmailContainer = Color(green_dark), + transferTypeEmailOnContainer = Color(specific5), + transferTypeQrContainer = Color(specific2), + transferTypeQrOnContainer = Color(green_main), + transferTypeProximityContainer = Color(specific3), + transferTypeProximityOnContainer = Color(specific4), ) 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 80c2bef8c..3e14028dc 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 @@ -74,4 +74,12 @@ val CustomLightColorScheme = CustomColorScheme( navigationItemBackground = LightColorScheme.background, tertiaryButtonBackground = Color(rabbit), selectedSettingItem = Color(rabbit), + transferTypeLinkContainer = Color(specific1), + transferTypeLinkOnContainer = Color(green_main), + transferTypeEmailContainer = Color(specific2), + transferTypeEmailOnContainer = Color(green_dark), + transferTypeQrContainer = Color(green_secondary), + transferTypeQrOnContainer = Color(green_main), + transferTypeProximityContainer = Color(specific3), + transferTypeProximityOnContainer = Color(specific4), ) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/Theme.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/Theme.kt index def44f51c..dd5d9350e 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/Theme.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/theme/Theme.kt @@ -68,4 +68,12 @@ data class CustomColorScheme( val navigationItemBackground: Color = Color.Unspecified, val tertiaryButtonBackground: Color = Color.Unspecified, val selectedSettingItem: Color = Color.Unspecified, + val transferTypeLinkContainer: Color = Color.Unspecified, + val transferTypeLinkOnContainer: Color = Color.Unspecified, + val transferTypeEmailContainer: Color = Color.Unspecified, + val transferTypeEmailOnContainer: Color = Color.Unspecified, + val transferTypeQrContainer: Color = Color.Unspecified, + val transferTypeQrOnContainer: Color = Color.Unspecified, + val transferTypeProximityContainer: Color = Color.Unspecified, + val transferTypeProximityOnContainer: Color = Color.Unspecified, ) From 675ef50a15c393e2fc7b8a848b9b7ac7050957ab Mon Sep 17 00:00:00 2001 From: Gibran Chevalley Date: Tue, 20 Aug 2024 16:49:15 +0200 Subject: [PATCH 3/6] Import strings --- .../newtransfer/importfiles/TransferTypeScreen.kt | 13 +++++++------ .../importfiles/components/TransferTypeButtons.kt | 5 +++-- app/src/main/res/values-de/strings.xml | 5 +++++ app/src/main/res/values-es/strings.xml | 5 +++++ app/src/main/res/values-fr/strings.xml | 5 +++++ app/src/main/res/values-it/strings.xml | 5 +++++ app/src/main/res/values/strings.xml | 5 +++++ 7 files changed, 35 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/TransferTypeScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/TransferTypeScreen.kt index e57a4e3a4..0b7660dde 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/TransferTypeScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/TransferTypeScreen.kt @@ -18,6 +18,7 @@ package com.infomaniak.swisstransfer.ui.screen.newtransfer.importfiles +import androidx.annotation.StringRes import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding @@ -54,7 +55,7 @@ fun TransferTypeScreen(navigateToTransfer: (TransferType) -> Unit) { modifier = Modifier .fillMaxWidth() .padding(vertical = Margin.Large, horizontal = Margin.Medium), - text = stringResource(R.string.appName), + text = stringResource(R.string.transferTypeTitle), style = SwissTransferTheme.typography.h1, textAlign = TextAlign.Center, ) @@ -65,31 +66,31 @@ fun TransferTypeScreen(navigateToTransfer: (TransferType) -> Unit) { } enum class TransferType( - val label: String, + @StringRes val titleRes: Int, val background: @Composable () -> Color, val foreground: @Composable () -> Color, val icon: ImageVector, ) { LINK( - "Lien", + R.string.transferTypeLink, { SwissTransferTheme.colors.transferTypeLinkContainer }, { SwissTransferTheme.colors.transferTypeLinkOnContainer }, AppIcons.Illu.ChainTilted ), EMAIL( - "Mail", + R.string.transferTypeEmail, { SwissTransferTheme.colors.transferTypeEmailContainer }, { SwissTransferTheme.colors.transferTypeEmailOnContainer }, AppIcons.Illu.EnvelopeTilted ), QR_CODE( - "QR Code", + R.string.transferTypeQrCode, { SwissTransferTheme.colors.transferTypeQrContainer }, { SwissTransferTheme.colors.transferTypeQrOnContainer }, AppIcons.Illu.QrCodeTilted ), PROXIMITY( - "A proximité", + R.string.transferTypeProximity, { SwissTransferTheme.colors.transferTypeProximityContainer }, { SwissTransferTheme.colors.transferTypeProximityOnContainer }, AppIcons.Illu.WaveSignalTilted 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 d852d790d..bdc8b1e91 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 @@ -29,6 +29,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp @@ -49,10 +50,10 @@ fun TransferTypeButtons(items: List, navigateToTransfer: (Transfer verticalArrangement = Arrangement.spacedBy(SPACE_AROUND_BUTTONS), horizontalArrangement = Arrangement.spacedBy(SPACE_AROUND_BUTTONS), ) { - items(items = items, key = { it.label }) { item -> + items(items = items, key = { it.titleRes }) { item -> TransferTypeButton( modifier = Modifier.aspectRatio(0.87f), - label = item.label, + label = stringResource(item.titleRes), background = item.background(), foreground = item.foreground(), icon = item.icon, diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index aa5b42743..da0b9f8ac 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -35,6 +35,11 @@ Thema Dauer der Gültigkeit Einstellungen + E-Mail + Link + In der Nähe + QR-Code + Schicke deine Dateien per Kamera Dateien durchsuchen Foto- und Videogalerie diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 7882db19e..35daa1d37 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -35,6 +35,11 @@ Tema Periodo de validez Parámetros + Correo electrónico + Enlace + Proximidad + Código QR + Envía tus archivos por Cámara Examinar archivos Galería de fotos y vídeos diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index ac5185aee..1e149e3ea 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -35,6 +35,11 @@ Thème Durée de validité Paramètres + E-mail + Lien + A proximité + QR Code + Envoie tes fichiers par Appareil photo Parcourir les fichiers Galerie photos et vidéos diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 6b540844d..6ea448e15 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -35,6 +35,11 @@ Tema Periodo di validità Parametri + Email + Link + Vicino + Codice QR + Inviate i vostri file tramite Macchina fotografica Sfogliare i file Galleria di foto e video diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 11fd8a015..51f388933 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -38,6 +38,11 @@ Theme Validity period Settings + Email + Link + Proximity + QR Code + Send your files by Camera Browse files Photo and video gallery From 4129947a58e970a31d6b509b00db25d7c23d3319 Mon Sep 17 00:00:00 2001 From: Gibran Chevalley Date: Wed, 21 Aug 2024 10:32:25 +0200 Subject: [PATCH 4/6] Update fixed transfer type icons --- .../ui/icons/illu/ChainTilted.kt | 65 ++++++++--------- .../ui/icons/illu/EnvelopeTilted.kt | 70 +++++++++---------- .../ui/icons/illu/QrCodeTilted.kt | 34 ++++----- .../ui/icons/illu/WaveSignalTilted.kt | 40 +++++------ 4 files changed, 100 insertions(+), 109 deletions(-) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/ChainTilted.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/ChainTilted.kt index d25fdb719..4d3f44072 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/ChainTilted.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/ChainTilted.kt @@ -8,15 +8,14 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.PathFillType.Companion.NonZero import androidx.compose.ui.graphics.SolidColor -import androidx.compose.ui.graphics.StrokeCap -import androidx.compose.ui.graphics.StrokeJoin.Companion.Round import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector.Builder -import androidx.compose.ui.graphics.vector.group import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.infomaniak.swisstransfer.ui.icons.AppIcons +import androidx.compose.ui.graphics.StrokeCap.Companion.Round as strokeCapRound +import androidx.compose.ui.graphics.StrokeJoin.Companion.Round as strokeJoinRound val AppIcons.Illu.ChainTilted: ImageVector get() { @@ -30,37 +29,35 @@ val AppIcons.Illu.ChainTilted: ImageVector viewportWidth = 120.0f, viewportHeight = 80.0f ).apply { - group { - path( - fill = null, - stroke = SolidColor(Color(0xFF3cb572)), - strokeLineWidth = 3.264f, - strokeLineCap = StrokeCap.Round, - strokeLineJoin = Round, - strokeLineMiter = 4.0f, - pathFillType = NonZero - ) { - moveTo(47.1f, 75.72f) - lineToRelative(-4.56f, 4.56f) - arcToRelative(22.03f, 22.03f, 0.0f, true, true, -31.16f, -31.16f) - lineToRelative(23.37f, -23.37f) - arcToRelative(22.03f, 22.03f, 0.0f, false, true, 33.41f, 28.52f) - } - path( - fill = null, - stroke = SolidColor(Color(0xFF3cb572)), - strokeLineWidth = 3.264f, - strokeLineCap = StrokeCap.Round, - strokeLineJoin = Round, - strokeLineMiter = 4.0f, - pathFillType = NonZero - ) { - moveTo(73.8f, 12.4f) - lineToRelative(3.67f, -3.67f) - arcToRelative(22.03f, 22.03f, 0.0f, false, true, 31.16f, 31.16f) - lineTo(85.26f, 63.25f) - arcToRelative(22.03f, 22.03f, 0.0f, false, true, -33.41f, -28.52f) - } + path( + fill = null, + stroke = SolidColor(Color(0xFF3CB572)), + strokeLineWidth = 3.0f, + strokeLineCap = strokeCapRound, + strokeLineJoin = strokeJoinRound, + strokeLineMiter = 4.0f, + pathFillType = NonZero + ) { + moveTo(47.17f, 75.82f) + lineToRelative(-4.56f, 4.56f) + arcToRelative(22.03f, 22.03f, 0.0f, true, true, -31.16f, -31.15f) + lineToRelative(23.37f, -23.37f) + arcToRelative(22.03f, 22.03f, 0.0f, false, true, 33.41f, 28.52f) + } + path( + fill = null, + stroke = SolidColor(Color(0xFF3CB572)), + strokeLineWidth = 3.0f, + strokeLineCap = strokeCapRound, + strokeLineJoin = strokeJoinRound, + strokeLineMiter = 4.0f, + pathFillType = NonZero + ) { + moveTo(73.88f, 12.5f) + lineToRelative(3.67f, -3.67f) + arcToRelative(22.03f, 22.03f, 0.0f, false, true, 31.16f, 31.16f) + lineTo(85.34f, 63.36f) + arcToRelative(22.03f, 22.03f, 0.0f, false, true, -33.41f, -28.52f) } }.build() return _chainTilted!! diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/EnvelopeTilted.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/EnvelopeTilted.kt index cf19b4846..34e70a409 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/EnvelopeTilted.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/EnvelopeTilted.kt @@ -8,15 +8,14 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.PathFillType.Companion.NonZero import androidx.compose.ui.graphics.SolidColor -import androidx.compose.ui.graphics.StrokeCap -import androidx.compose.ui.graphics.StrokeJoin.Companion.Round import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector.Builder -import androidx.compose.ui.graphics.vector.group import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.infomaniak.swisstransfer.ui.icons.AppIcons +import androidx.compose.ui.graphics.StrokeCap.Companion.Round as strokeCapRound +import androidx.compose.ui.graphics.StrokeJoin.Companion.Round as strokeJoinRound val AppIcons.Illu.EnvelopeTilted: ImageVector get() { @@ -30,40 +29,37 @@ val AppIcons.Illu.EnvelopeTilted: ImageVector viewportWidth = 120.0f, viewportHeight = 80.0f ).apply { - group { - path( - fill = null, - stroke = SolidColor(Color(0xFF014958)), - strokeLineWidth = 2.982f, - strokeLineCap = StrokeCap.Round, - strokeLineJoin = Round, - strokeLineMiter = 4.0f, - pathFillType = NonZero - ) { - moveTo(86.13f, 4.46f) - lineTo(64.07f, 62.74f) - lineTo(2.57f, 52.69f) - } - path( - fill = null, - stroke = SolidColor(Color(0xFF014958)), - strokeLineWidth = 2.982f, - strokeLineCap = StrokeCap.Round, - strokeLineJoin = Round, - strokeLineMiter = 4.0f, - pathFillType = NonZero - ) { - moveTo(81.12f, 4.77f) - lineTo(5.34f, 48.52f) - curveToRelative(-3.14f, 1.81f, -4.18f, 5.88f, -2.33f, 9.09f) - lineToRelative(26.83f, 46.48f) - curveToRelative(1.85f, 3.21f, 5.9f, 4.34f, 9.04f, 2.53f) - lineToRelative(75.78f, -43.75f) - curveToRelative(3.14f, -1.81f, 4.18f, -5.88f, 2.33f, -9.09f) - lineTo(90.16f, 7.3f) - curveToRelative(-1.85f, -3.21f, -5.9f, -4.34f, -9.04f, -2.53f) - close() - } + path( + fill = null, + stroke = SolidColor(Color(0xFF014958)), + strokeLineWidth = 3.0f, + strokeLineCap = strokeCapRound, + strokeLineJoin = strokeJoinRound, + strokeLineMiter = 4.0f, + pathFillType = NonZero + ) { + moveTo(85.95f, 4.79f) + lineTo(63.9f, 63.07f) + lineTo(2.41f, 53.02f) + } + path( + fill = null, + stroke = SolidColor(Color(0xFF014958)), + strokeLineWidth = 3.0f, + strokeLineCap = strokeCapRound, + strokeLineJoin = strokeJoinRound, + strokeLineMiter = 4.0f, + pathFillType = NonZero + ) { + moveTo(80.94f, 5.11f) + lineTo(5.18f, 48.85f) + curveTo(2.04f, 50.66f, 1.0f, 54.73f, 2.85f, 57.94f) + lineToRelative(26.83f, 46.47f) + curveToRelative(1.85f, 3.21f, 5.9f, 4.34f, 9.03f, 2.53f) + lineToRelative(75.76f, -43.74f) + curveToRelative(3.14f, -1.81f, 4.18f, -5.88f, 2.33f, -9.09f) + lineTo(89.98f, 7.63f) + curveToRelative(-1.85f, -3.21f, -5.9f, -4.34f, -9.03f, -2.53f) } }.build() return _envelopeTilted!! diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/QrCodeTilted.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/QrCodeTilted.kt index 92484c178..b48dc7192 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/QrCodeTilted.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/QrCodeTilted.kt @@ -2,6 +2,7 @@ package com.infomaniak.swisstransfer.ui.icons.illu import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier @@ -17,6 +18,7 @@ import com.infomaniak.swisstransfer.ui.icons.AppIcons import androidx.compose.ui.graphics.StrokeCap.Companion.Round as strokeCapRound import androidx.compose.ui.graphics.StrokeJoin.Companion.Round as strokeJoinRound + val AppIcons.Illu.QrCodeTilted: ImageVector get() { if (_qrCodeTilted != null) { @@ -31,40 +33,38 @@ val AppIcons.Illu.QrCodeTilted: ImageVector ).apply { path( fill = null, - stroke = SolidColor(Color(0xFF3cb572)), - strokeLineWidth = 2.77778f, + stroke = SolidColor(Color(0xFF3CB572)), + strokeLineWidth = 3.0f, strokeLineCap = strokeCapRound, strokeLineJoin = strokeJoinRound, strokeLineMiter = 4.0f, pathFillType = NonZero ) { - moveTo(15.55f, 56.31f) - lineToRelative(14.43f, -8.34f) + moveTo(15.56f, 56.33f) + lineTo(29.99f, 48.0f) lineToRelative(-8.33f, -14.43f) - lineToRelative(-14.44f, 8.33f) - lineToRelative(8.34f, 14.44f) + lineTo(7.23f, 41.9f) close() - moveToRelative(79.68f, 21.34f) + moveToRelative(79.69f, 21.35f) lineToRelative(14.43f, -8.33f) lineToRelative(-8.33f, -14.43f) lineToRelative(-14.43f, 8.33f) - lineToRelative(8.33f, 14.43f) close() - moveToRelative(-71.35f, -6.91f) - lineToRelative(28.87f, -16.67f) + moveTo(23.9f, 70.76f) + lineToRelative(28.86f, -16.67f) lineToRelative(-4.17f, -7.22f) - moveToRelative(14.43f, -8.33f) + moveToRelative(14.44f, -8.33f) lineToRelative(-12.5f, -21.65f) lineToRelative(21.65f, -12.5f) lineToRelative(12.5f, 21.65f) - lineToRelative(-7.21f, 4.17f) + lineToRelative(-7.22f, 4.17f) moveToRelative(-37.2f, 2.23f) lineToRelative(-4.17f, -7.22f) - moveToRelative(37.5f, 64.95f) - lineTo(61.08f, 68.5f) - lineToRelative(7.22f, -4.16f) - moveToRelative(10.27f, -15.55f) - lineTo(93.0f, 40.46f) + moveTo(73.6f, 90.18f) + lineTo(61.1f, 68.53f) + lineToRelative(7.22f, -4.17f) + moveToRelative(10.26f, -15.55f) + lineToRelative(14.43f, -8.33f) } }.build() return _qrCodeTilted!! diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/WaveSignalTilted.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/WaveSignalTilted.kt index 547a0b091..a80a6387f 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/WaveSignalTilted.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/icons/illu/WaveSignalTilted.kt @@ -2,21 +2,22 @@ package com.infomaniak.swisstransfer.ui.icons.illu import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.PathFillType.Companion.NonZero import androidx.compose.ui.graphics.SolidColor -import androidx.compose.ui.graphics.StrokeCap -import androidx.compose.ui.graphics.StrokeJoin.Companion.Round import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector.Builder -import androidx.compose.ui.graphics.vector.group import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.infomaniak.swisstransfer.ui.icons.AppIcons +import androidx.compose.ui.graphics.StrokeCap.Companion.Round as strokeCapRound +import androidx.compose.ui.graphics.StrokeJoin.Companion.Round as strokeJoinRound + val AppIcons.Illu.WaveSignalTilted: ImageVector get() { @@ -30,24 +31,21 @@ val AppIcons.Illu.WaveSignalTilted: ImageVector viewportWidth = 120.0f, viewportHeight = 80.0f ).apply { - group {} - group { - path( - fill = null, - stroke = SolidColor(Color(0xFFcf9e1b)), - strokeLineWidth = 2.931f, - strokeLineCap = StrokeCap.Round, - strokeLineJoin = Round, - strokeLineMiter = 4.0f, - pathFillType = NonZero - ) { - moveTo(93.93f, 50.5f) - arcToRelative(32.97f, 32.97f, 0.0f, false, false, -40.38f, 23.31f) - moveToRelative(46.19f, -42.82f) - arcToRelative(52.75f, 52.75f, 0.0f, false, false, -64.6f, 37.3f) - moveToRelative(66.36f, -56.51f) - arcToRelative(72.53f, 72.53f, 0.0f, false, false, -85.65f, 49.45f) - } + path( + fill = null, + stroke = SolidColor(Color(0xFFCF9E1B)), + strokeLineWidth = 3.0f, + strokeLineCap = strokeCapRound, + strokeLineJoin = strokeJoinRound, + strokeLineMiter = 4.0f, + pathFillType = NonZero + ) { + moveTo(93.93f, 50.48f) + arcToRelative(32.97f, 32.97f, 0.0f, false, false, -40.38f, 23.31f) + moveToRelative(46.19f, -42.81f) + arcToRelative(52.75f, 52.75f, 0.0f, false, false, -64.6f, 37.3f) + moveToRelative(66.36f, -56.51f) + arcToRelative(72.53f, 72.53f, 0.0f, false, false, -85.65f, 49.45f) } }.build() return _waveSignalTilted!! From 3888a9367708226a3ede9f021e0b313d6343ab71 Mon Sep 17 00:00:00 2001 From: Gibran Chevalley Date: Wed, 21 Aug 2024 14:54:58 +0200 Subject: [PATCH 5/6] Have the button "next" navigate to the next screen not "camera" --- .../screen/newtransfer/importfiles/ImportFilesScreen.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt index 6e1a826b2..428370127 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt @@ -59,7 +59,7 @@ fun ImportFilesScreen(navigateToTransferTypeScreen: () -> Unit) { LargeButton( modifier = modifier, titleRes = R.string.buttonNext, - onClick = { /*TODO*/ }, + onClick = { navigateToTransferTypeScreen() }, ) }, ) { @@ -67,7 +67,6 @@ fun ImportFilesScreen(navigateToTransferTypeScreen: () -> Unit) { UploadSourceChoiceBottomSheet( isBottomSheetVisible = { showUploadSourceChoiceBottomSheet }, onDismissRequest = { showUploadSourceChoiceBottomSheet = false }, - onCameraClicked = { navigateToTransferTypeScreen() } ) } } @@ -77,7 +76,6 @@ fun ImportFilesScreen(navigateToTransferTypeScreen: () -> Unit) { private fun UploadSourceChoiceBottomSheet( isBottomSheetVisible: () -> Boolean, onDismissRequest: () -> Unit, - onCameraClicked: () -> Unit, ) { if (isBottomSheetVisible()) { SwissTransferBottomSheet( @@ -85,7 +83,7 @@ private fun UploadSourceChoiceBottomSheet( titleRes = R.string.transferUploadSourceChoiceTitle, content = { Column { - BottomSheetItem(AppIcons.Camera, R.string.transferUploadSourceChoiceCamera, onClick = onCameraClicked) + BottomSheetItem(AppIcons.Camera, R.string.transferUploadSourceChoiceCamera) { /*TODO*/ } HorizontalDivider(Modifier.padding(horizontal = Margin.Medium)) BottomSheetItem(AppIcons.PolaroidLandscape, R.string.transferUploadSourceChoiceGallery) { /*TODO*/ } HorizontalDivider(Modifier.padding(horizontal = Margin.Medium)) @@ -111,7 +109,7 @@ private fun ImportFilesScreenPreview() { private fun ImportChoiceBottomSheetPreview() { SwissTransferTheme { Surface { - UploadSourceChoiceBottomSheet({ true }, {}, {}) + UploadSourceChoiceBottomSheet({ true }, {}) } } } From e22fb876b8e221fb99ac9decd96b7f179e617aa4 Mon Sep 17 00:00:00 2001 From: Gibran Chevalley Date: Wed, 21 Aug 2024 15:03:22 +0200 Subject: [PATCH 6/6] Update preview of TransferTypeButton and use item to transmit data through methods --- .../components/TransferTypeButtons.kt | 43 +++++++++++-------- 1 file changed, 26 insertions(+), 17 deletions(-) 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 bdc8b1e91..60dfd17aa 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 @@ -27,8 +27,6 @@ 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.graphics.vector.ImageVector import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview @@ -53,10 +51,7 @@ fun TransferTypeButtons(items: List, navigateToTransfer: (Transfer items(items = items, key = { it.titleRes }) { item -> TransferTypeButton( modifier = Modifier.aspectRatio(0.87f), - label = stringResource(item.titleRes), - background = item.background(), - foreground = item.foreground(), - icon = item.icon, + item = item, onClick = { navigateToTransfer(item) } ) } @@ -64,18 +59,11 @@ fun TransferTypeButtons(items: List, navigateToTransfer: (Transfer } @Composable -private fun TransferTypeButton( - modifier: Modifier = Modifier, - label: String, - background: Color, - foreground: Color, - icon: ImageVector, - onClick: () -> Unit, -) { +private fun TransferTypeButton(modifier: Modifier = Modifier, item: TransferType, onClick: () -> Unit) { Button( contentPadding = PaddingValues(0.dp), modifier = modifier.fillMaxSize(), - colors = ButtonDefaults.buttonColors(containerColor = background, contentColor = foreground), + colors = ButtonDefaults.buttonColors(containerColor = item.background(), contentColor = item.foreground()), shape = ShapeDefaults.Medium, onClick = onClick, ) { @@ -84,7 +72,7 @@ private fun TransferTypeButton( modifier = Modifier .fillMaxHeight(0.80f) .align(Alignment.BottomCenter), - text = label, + text = stringResource(id = item.titleRes), textAlign = TextAlign.Center, style = SwissTransferTheme.typography.bodyMedium, ) @@ -93,13 +81,34 @@ private fun TransferTypeButton( modifier = Modifier .fillMaxWidth(0.75f) .align(Alignment.BottomCenter), - imageVector = icon, + imageVector = item.icon, contentDescription = null, ) } } } +@Preview(name = "Light") +@Preview(name = "Dark", uiMode = Configuration.UI_MODE_NIGHT_YES or Configuration.UI_MODE_TYPE_NORMAL) +@Composable +private fun TransferTypeButtonPreview() { + SwissTransferTheme { + Surface { + Column { + TransferType.entries.forEach { entry -> + TransferTypeButton( + modifier = Modifier + .size(160.dp, 200.dp) + .padding(20.dp), + item = entry, + ) {} + } + } + } + } +} + + @Preview(name = "Light") @Preview(name = "Dark", uiMode = Configuration.UI_MODE_NIGHT_YES or Configuration.UI_MODE_TYPE_NORMAL) @Composable