diff --git a/app/build.gradle b/app/build.gradle index 58c8c465a..fc7eb283a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -147,7 +147,6 @@ dependencies { implementation libs.material3 implementation libs.accompanist.flowlayout - implementation libs.accompanist.insets implementation libs.androidx.compose.foundation.layout // TODO (M3): Remove this dependency when all components are available diff --git a/app/src/main/java/com/google/samples/apps/nowinandroid/ui/NiaApp.kt b/app/src/main/java/com/google/samples/apps/nowinandroid/ui/NiaApp.kt index 851791e6f..d55678267 100644 --- a/app/src/main/java/com/google/samples/apps/nowinandroid/ui/NiaApp.kt +++ b/app/src/main/java/com/google/samples/apps/nowinandroid/ui/NiaApp.kt @@ -17,8 +17,11 @@ package com.google.samples.apps.nowinandroid.ui import androidx.annotation.StringRes +import androidx.compose.foundation.layout.captionBarPadding import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.statusBarsPadding import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.AutoStories import androidx.compose.material.icons.filled.Bookmarks @@ -45,8 +48,6 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.navigation.compose.currentBackStackEntryAsState import androidx.navigation.compose.rememberNavController -import com.google.accompanist.insets.ProvideWindowInsets -import com.google.accompanist.insets.systemBarsPadding import com.google.samples.apps.nowinandroid.R import com.google.samples.apps.nowinandroid.ui.theme.NiaTheme @@ -54,31 +55,29 @@ import com.google.samples.apps.nowinandroid.ui.theme.NiaTheme @Composable fun NiaApp() { NiaTheme { - ProvideWindowInsets { - val navController = rememberNavController() - val navigationActions = remember(navController) { - NiaNavigationActions(navController) - } + val navController = rememberNavController() + val navigationActions = remember(navController) { + NiaNavigationActions(navController) + } - val navBackStackEntry by navController.currentBackStackEntryAsState() - val currentRoute = - navBackStackEntry?.destination?.route ?: NiaDestinations.FOR_YOU_ROUTE + val navBackStackEntry by navController.currentBackStackEntryAsState() + val currentRoute = + navBackStackEntry?.destination?.route ?: NiaDestinations.FOR_YOU_ROUTE - Scaffold( - modifier = Modifier, - bottomBar = { - // TODO: Only show on small screens - NiABottomBar(navigationActions, currentRoute) - }, - ) { padding -> - Surface(Modifier.fillMaxSize()) { - NiaNavGraph( - navController = navController, - modifier = Modifier - .systemBarsPadding(bottom = false) - .padding(padding) - ) - } + Scaffold( + modifier = Modifier, + bottomBar = { + // TODO: Only show on small screens + NiABottomBar(navigationActions, currentRoute) + }, + ) { padding -> + Surface(Modifier.fillMaxSize()) { + NiaNavGraph( + navController = navController, + modifier = Modifier + .statusBarsPadding() + .padding(padding) + ) } } } @@ -93,7 +92,7 @@ private fun NiABottomBar( // navigation is equal to the container color of the navigation bar. Surface(color = MaterialTheme.colorScheme.surface) { NavigationBar( - modifier = Modifier.systemBarsPadding(top = false), + modifier = Modifier.navigationBarsPadding().captionBarPadding(), tonalElevation = 0.dp ) { TOP_LEVEL_DESTINATIONS.forEach { dst -> diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f256673ff..84d82ac87 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,7 +4,7 @@ androidDesugarJdkLibs = "1.1.5" androidGradlePlugin = "7.0.3" androidxActivity = "1.4.0" androidxAppCompat = "1.3.0" -androidxCompose = "1.1.0-beta04" +androidxCompose = "1.2.0-SNAPSHOT" androidxComposeMaterial3 = "1.0.0-alpha03" androidxCore = "1.7.0" androidxDataStore = "1.0.0" @@ -17,12 +17,12 @@ androidxTestExt = "1.1.2" hilt = "2.40.5" jacoco = "0.8.7" junit4 = "4.13" -kotlin = "1.6.0" +kotlin = "1.6.10" kotlinxCoroutines = "1.6.0" kotlinxCoroutinesTest = "1.6.0" kotlinxDatetime = "0.3.1" kotlinxSerializationJson = "1.3.1" -ksp = "1.6.0-1.0.1" +ksp = "1.6.10-1.0.2" ktlint = "0.43.0" material3 = "1.5.0-alpha05" mockk = "1.12.1" @@ -34,7 +34,6 @@ turbine = "0.7.0" [libraries] accompanist-flowlayout = { group = "com.google.accompanist", name = "accompanist-flowlayout", version.ref = "accompanist" } -accompanist-insets = { group = "com.google.accompanist", name = "accompanist-insets", version.ref = "accompanist" } android-desugarJdkLibs = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "androidDesugarJdkLibs" } android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" } androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "androidxActivity" } diff --git a/settings.gradle b/settings.gradle index e24e3409c..1233caeb2 100644 --- a/settings.gradle +++ b/settings.gradle @@ -24,6 +24,7 @@ dependencyResolutionManagement { google() mavenCentral() gradlePluginPortal() + maven { url "https://androidx.dev/snapshots/builds/8143371/artifacts/repository" } } } rootProject.name = "nowinandroid"