Skip to content

Commit fff7b28

Browse files
committed
feat: Integrate Navigation3 and setup application routing
This commit introduces the Navigation3 library and configures the initial routing structure for the application. It also defines placeholder screens for the weather, location, and settings features. - **Dependencies**: - Added `navigation3-runtime` and `navigation3-ui` (v1.0.1) to `libs.versions.toml`. - Included `feature-weather`, `feature-location`, `feature-settings`, and `core` projects in `app/build.gradle.kts`. - **Navigation**: - `app/src/main/java/com/warbler/navigation/Destinations.kt`: Defined a sealed interface `Destinations` using `@Serializable` for `Home`, `Forecast`, `Location`, and `Settings`. - `app/src/main/java/com/warbler/navigation/ApplicationNavigation.kt`: Implemented `ApplicationNavigation` using `NavDisplay` and `entryProvider` to manage app routing. - **UI Placeholders**: - Created basic `Composable` screen placeholders: `WeatherScreen`, `ForecastScreen`, `LocationScreen`, and `SettingsScreen` across respective feature modules.
1 parent dd387f6 commit fff7b28

File tree

10 files changed

+88
-1
lines changed

10 files changed

+88
-1
lines changed

app/build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ tasks.named("preBuild") {
139139

140140
dependencies {
141141
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
142+
implementation(project(":feature-weather"))
143+
implementation(project(":feature-location"))
144+
implementation(project(":feature-settings"))
145+
implementation(project(":core"))
142146

143147
// Android specific
144148
implementation(libs.appcompat)
@@ -150,6 +154,8 @@ dependencies {
150154
implementation(libs.viewpager2)
151155
implementation(libs.material3Compose)
152156
implementation(libs.material3View)
157+
implementation(libs.navigation3.runtime)
158+
implementation(libs.navigation3.ui)
153159

154160
// Compose
155161
val composeBom = platform("androidx.compose:compose-bom:2025.09.01")
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.warbler.navigation
2+
3+
import androidx.compose.runtime.Composable
4+
import androidx.compose.ui.Modifier
5+
import androidx.navigation3.runtime.NavBackStack
6+
import androidx.navigation3.runtime.NavKey
7+
import androidx.navigation3.runtime.entryProvider
8+
import androidx.navigation3.runtime.rememberNavBackStack
9+
import androidx.navigation3.ui.NavDisplay
10+
import com.warbler.feature.location.ui.LocationScreen
11+
import com.warbler.feature.settings.ui.SettingsScreen
12+
import com.warbler.feature.weather.ui.ForecastScreen
13+
import com.warbler.feature.weather.ui.WeatherScreen
14+
15+
@Composable
16+
fun ApplicationNavigation(
17+
modifier: Modifier = Modifier,
18+
backStack: NavBackStack<NavKey> = rememberNavBackStack(Destinations.Home),
19+
) {
20+
NavDisplay(
21+
backStack = backStack,
22+
onBack = { backStack.removeLastOrNull() },
23+
entryProvider =
24+
entryProvider {
25+
entry<Destinations.Home> { WeatherScreen() }
26+
entry<Destinations.Forecast> { ForecastScreen() }
27+
entry<Destinations.Location> { LocationScreen() }
28+
entry<Destinations.Settings> { SettingsScreen() }
29+
},
30+
)
31+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.warbler.navigation
2+
3+
import androidx.navigation3.runtime.NavKey
4+
import kotlinx.serialization.Serializable
5+
6+
@Serializable
7+
sealed interface Destinations : NavKey {
8+
@Serializable
9+
data object Forecast : Destinations
10+
11+
@Serializable
12+
data object Home : Destinations
13+
14+
@Serializable
15+
data object Location : Destinations
16+
17+
@Serializable
18+
data object Settings : Destinations
19+
}
0 Bytes
Binary file not shown.

core/src/main/java/com/warbler/core/network/ConnectionHandler.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ object ConnectionHandler {
2525
}
2626
return false
2727
}
28-
}
28+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.warbler.feature.location.ui
2+
3+
import androidx.compose.runtime.Composable
4+
5+
@Composable
6+
fun LocationScreen() {}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.warbler.feature.settings.ui
2+
3+
import androidx.compose.runtime.Composable
4+
5+
@Composable
6+
fun SettingsScreen() {}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.warbler.feature.weather.ui
2+
3+
import androidx.compose.runtime.Composable
4+
5+
@Composable
6+
fun ForecastScreen() {}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.warbler.feature.weather.ui
2+
3+
import androidx.compose.runtime.Composable
4+
5+
@Composable
6+
fun WeatherScreen() {}

gradle/libs.versions.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ rules = "1.7.0"
5151
runner = "1.7.0"
5252
vicoCore = "2.0.0-alpha.6" # Leave for now, resource linking issue with updated version, requires investigation.
5353
viewpager2 = "1.1.0"
54+
navigation3Runtime = "1.0.1"
55+
navigation3Ui = "1.0.1"
5456

5557
[libraries]
5658
accessibility-test-framework = { module = "com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework", version.ref = "accessibilityTestFramework" }
@@ -98,6 +100,9 @@ material-icons-core = { module = "androidx.compose.material:material-icons-core"
98100
material-icons-extended = { module = "androidx.compose.material:material-icons-extended" }
99101
material3View = { module = "com.google.android.material:material", version.ref = "material3" }
100102
material3Compose = { module = "androidx.compose.material3:material3" }
103+
104+
105+
101106
navigation-dynamic-features-fragment = { module = "androidx.navigation:navigation-dynamic-features-fragment", version.ref = "navigationDynamicFeaturesFragment" }
102107
navigation-fragment-ktx = { module = "androidx.navigation:navigation-fragment-ktx", version.ref = "navigationFragmentKtx" }
103108
navigation-safe-args-gradle-plugin = { module = "androidx.navigation:navigation-safe-args-gradle-plugin", version.ref = "navigationSafeArgsGradlePlugin" }
@@ -123,6 +128,8 @@ ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" }
123128
viewpager2 = { module = "androidx.viewpager2:viewpager2", version.ref = "viewpager2" }
124129
vico-core = { module = "com.patrykandpatrick.vico:core", version.ref = "vicoCore" }
125130
vico-views = { module = "com.patrykandpatrick.vico:views", version.ref = "vicoCore" }
131+
navigation3-runtime = { group = "androidx.navigation3", name = "navigation3-runtime", version.ref = "navigation3Runtime" }
132+
navigation3-ui = { group = "androidx.navigation3", name = "navigation3-ui", version.ref = "navigation3Ui" }
126133

127134
[plugins]
128135
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }

0 commit comments

Comments
 (0)