Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[i01] core: Navigation #2

Merged
merged 8 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
32 changes: 32 additions & 0 deletions app/src/main/java/com/infomaniak/swisstransfer/ui/MainScreen.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/

package com.infomaniak.swisstransfer.ui

import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteScaffold
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import androidx.navigation.compose.rememberNavController
import com.infomaniak.swisstransfer.ui.navigation.NavigationItem

@Composable
fun MainScreen() {
val navController = rememberNavController()
}
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

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 : NavigationArgs()
data object TransferType : NavigationArgs()
data object TransferOptions : NavigationArgs()
data object ValidateUserEmail : NavigationArgs()

data object UploadProgress : NavigationArgs()
data object UploadSuccess : NavigationArgs()
}

/**
* Sealed class representing navigation arguments with a title resource.
*/
sealed class NavigationArgs
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

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),
}
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
-->

<resources>
<string name="app_name">SwissTransfer</string>
<string name="appName">SwissTransfer</string>
</resources>
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand All @@ -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" }
Expand Down
Loading