diff --git a/app/build.gradle.kts b/app/build.gradle.kts index e6e11bb35..4cf4ecc38 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -62,6 +62,7 @@ dependencies { implementation(libs.compose.ui) implementation(libs.compose.ui.graphics) implementation(libs.compose.material3) + implementation(libs.navigation.compose) // Compose preview tools implementation(libs.compose.ui.tooling.preview) debugImplementation(libs.compose.ui.tooling) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 9b30401c7..166bce17a 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -24,7 +24,7 @@ android:dataExtractionRules="@xml/data_extraction_rules" android:fullBackupContent="@xml/backup_rules" android:icon="@mipmap/ic_launcher" - android:label="@string/app_name" + android:label="@string/appName" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/Theme.AndroidSwissTransfer" diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/MainScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/MainScreen.kt new file mode 100644 index 000000000..9d531e8fa --- /dev/null +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/MainScreen.kt @@ -0,0 +1,27 @@ +/* + * 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 + +import androidx.compose.runtime.Composable +import androidx.navigation.compose.rememberNavController + +@Composable +fun MainScreen() { + val navController = rememberNavController() +} diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/navigation/NavigationArgs.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/navigation/NavigationArgs.kt new file mode 100644 index 000000000..1a14cd8d0 --- /dev/null +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/navigation/NavigationArgs.kt @@ -0,0 +1,48 @@ +/* + * 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.navigation + +/** + * Sealed class representing the navigation arguments for the main navigation flow. + */ +sealed class MainNavigation private constructor() : NavigationArgs() { + data object Sent : MainNavigation() + data object Received : MainNavigation() + data class TransferDetails(val transferId: Int) : MainNavigation() + + data object Settings : MainNavigation() +} + +/** + * Sealed class representing the navigation arguments for the new transfer flow. + */ +sealed class NewTransferNavigation private constructor() : NavigationArgs() { + data object ImportFiles : NewTransferNavigation() + data object TransferType : NewTransferNavigation() + data object TransferOptions : NewTransferNavigation() + data object ValidateUserEmail : NewTransferNavigation() + + data object UploadProgress : NewTransferNavigation() + data object UploadSuccess : NewTransferNavigation() +} + +/** + * Sealed class representing navigation arguments with a title resource. + */ +sealed class NavigationArgs diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/navigation/NavigationItem.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/navigation/NavigationItem.kt new file mode 100644 index 000000000..11bd8ba1f --- /dev/null +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/navigation/NavigationItem.kt @@ -0,0 +1,46 @@ +/* + * 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.navigation + +import androidx.annotation.StringRes +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.filled.Send +import androidx.compose.material.icons.filled.Settings +import androidx.compose.material.icons.filled.Star +import androidx.compose.material3.BottomAppBar +import androidx.compose.material3.NavigationRail +import androidx.compose.ui.graphics.vector.ImageVector +import com.infomaniak.swisstransfer.R + +/** + * Enum class representing the different destinations in the app's [BottomAppBar] or [NavigationRail]. + * + * @property label The resource ID of the string label for the destination. + * @property icon The icon to be displayed for the destination. + * @property contentDescription The resource ID of the content description for accessibility. + */ +enum class NavigationItem( + @StringRes val label: Int, + val icon: ImageVector, + @StringRes val contentDescription: Int, +) { + SENT(R.string.appName, Icons.AutoMirrored.Filled.Send, R.string.appName), + RECEIVED(R.string.appName, Icons.Default.Star, R.string.appName), + SETTINGS(R.string.appName, Icons.Default.Settings, R.string.appName), +} diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1ddfabc99..1e601be48 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -17,5 +17,5 @@ --> - SwissTransfer + SwissTransfer diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6e1fb025f..ad24acfa5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,6 +7,7 @@ junit = "4.13.2" junitVersion = "1.2.1" kotlin = "2.0.0" lifecycleRuntimeKtx = "2.8.3" +navigation = "2.8.0-beta05" [libraries] androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" } @@ -18,6 +19,7 @@ compose-ui = { group = "androidx.compose.ui", name = "ui" } compose-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" } compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" } compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" } +navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "navigation" } # Tests androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" } junit = { group = "junit", name = "junit", version.ref = "junit" }