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 a98b662f7..be78efdf3 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 @@ -18,23 +18,15 @@ package com.infomaniak.swisstransfer.ui.screen.newtransfer.importfiles import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.padding -import androidx.compose.material3.HorizontalDivider -import androidx.compose.material3.Surface import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue -import androidx.compose.ui.Modifier import com.infomaniak.swisstransfer.R import com.infomaniak.swisstransfer.ui.components.* import com.infomaniak.swisstransfer.ui.images.AppImages.AppIcons import com.infomaniak.swisstransfer.ui.images.icons.Add -import com.infomaniak.swisstransfer.ui.images.icons.Camera -import com.infomaniak.swisstransfer.ui.images.icons.Folder -import com.infomaniak.swisstransfer.ui.images.icons.PolaroidLandscape -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 @@ -77,28 +69,6 @@ fun ImportFilesScreen(navigateToTransferTypeScreen: () -> Unit) { } } -@Composable -private fun UploadSourceChoiceBottomSheet( - isBottomSheetVisible: () -> Boolean, - onDismissRequest: () -> Unit, -) { - if (isBottomSheetVisible()) { - SwissTransferBottomSheet( - onDismissRequest = onDismissRequest, - titleRes = R.string.transferUploadSourceChoiceTitle, - content = { - Column { - 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)) - BottomSheetItem(AppIcons.Folder, R.string.transferUploadSourceChoiceFiles) { /* TODO */ } - } - }, - ) - } -} - @PreviewMobile @PreviewTablet @Composable @@ -107,14 +77,3 @@ private fun ImportFilesScreenPreview() { ImportFilesScreen {} } } - -@PreviewMobile -@PreviewTablet -@Composable -private fun ImportChoiceBottomSheetPreview() { - SwissTransferTheme { - Surface { - UploadSourceChoiceBottomSheet(isBottomSheetVisible = { true }, onDismissRequest = {}) - } - } -} diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/UploadSourceChoiceBottomSheet.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/UploadSourceChoiceBottomSheet.kt new file mode 100644 index 000000000..992f7ae97 --- /dev/null +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/UploadSourceChoiceBottomSheet.kt @@ -0,0 +1,72 @@ +/* + * 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 + +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.HorizontalDivider +import androidx.compose.material3.Surface +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import com.infomaniak.swisstransfer.R +import com.infomaniak.swisstransfer.ui.components.BottomSheetItem +import com.infomaniak.swisstransfer.ui.components.SwissTransferBottomSheet +import com.infomaniak.swisstransfer.ui.images.AppImages +import com.infomaniak.swisstransfer.ui.images.icons.Camera +import com.infomaniak.swisstransfer.ui.images.icons.Folder +import com.infomaniak.swisstransfer.ui.images.icons.PolaroidLandscape +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 UploadSourceChoiceBottomSheet( + isBottomSheetVisible: () -> Boolean, + onDismissRequest: () -> Unit, +) { + if (isBottomSheetVisible()) { + SwissTransferBottomSheet( + onDismissRequest = onDismissRequest, + titleRes = R.string.transferUploadSourceChoiceTitle, + content = { + Column { + BottomSheetItem(AppImages.AppIcons.Camera, R.string.transferUploadSourceChoiceCamera) { /* TODO */ } + HorizontalDivider(Modifier.padding(horizontal = Margin.Medium)) + BottomSheetItem( + AppImages.AppIcons.PolaroidLandscape, + R.string.transferUploadSourceChoiceGallery + ) { /* TODO */ } + HorizontalDivider(Modifier.padding(horizontal = Margin.Medium)) + BottomSheetItem(AppImages.AppIcons.Folder, R.string.transferUploadSourceChoiceFiles) { /* TODO */ } + } + }, + ) + } +} + +@PreviewMobile +@PreviewTablet +@Composable +private fun UploadSourceChoiceBottomSheetPreview() { + SwissTransferTheme { + Surface { + UploadSourceChoiceBottomSheet(isBottomSheetVisible = { true }, onDismissRequest = {}) + } + } +}