From 5032136784f0f838ba4b62c1599433899a8e562a Mon Sep 17 00:00:00 2001 From: Rivan Date: Fri, 27 May 2022 21:10:51 +0530 Subject: [PATCH 1/3] Fix Navigation Bar in landscape mode. --- .../samples/apps/nowinandroid/ui/NiaApp.kt | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) 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 135634a31..4291cec66 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 @@ -75,12 +75,10 @@ fun NiaApp(windowSizeClass: WindowSizeClass) { containerColor = Color.Transparent, contentColor = MaterialTheme.colorScheme.onBackground, bottomBar = { - if (windowSizeClass.widthSizeClass == WindowWidthSizeClass.Compact) { - NiaBottomBar( - onNavigateToTopLevelDestination = niaTopLevelNavigation::navigateTo, - currentDestination = currentDestination - ) - } + NiaBottomBar( + onNavigateToTopLevelDestination = niaTopLevelNavigation::navigateTo, + currentDestination = currentDestination + ) } ) { padding -> Row( @@ -92,14 +90,6 @@ fun NiaApp(windowSizeClass: WindowSizeClass) { ) ) ) { - if (windowSizeClass.widthSizeClass != WindowWidthSizeClass.Compact) { - NiaNavRail( - onNavigateToTopLevelDestination = niaTopLevelNavigation::navigateTo, - currentDestination = currentDestination, - modifier = Modifier.safeDrawingPadding() - ) - } - NiaNavHost( windowSizeClass = windowSizeClass, navController = navController, From 747416ad840c4f968fe70361c61b808c41a254b3 Mon Sep 17 00:00:00 2001 From: Rivan Date: Sat, 28 May 2022 10:29:29 +0530 Subject: [PATCH 2/3] Fix Navigation Bar in landscape mode. --- .../samples/apps/nowinandroid/ui/NiaApp.kt | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) 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 4291cec66..34a16596c 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 @@ -37,6 +37,7 @@ import androidx.compose.material3.NavigationRailItem import androidx.compose.material3.Scaffold import androidx.compose.material3.Surface import androidx.compose.material3.Text +import androidx.compose.material3.windowsizeclass.WindowHeightSizeClass import androidx.compose.material3.windowsizeclass.WindowSizeClass import androidx.compose.material3.windowsizeclass.WindowWidthSizeClass import androidx.compose.runtime.Composable @@ -75,10 +76,12 @@ fun NiaApp(windowSizeClass: WindowSizeClass) { containerColor = Color.Transparent, contentColor = MaterialTheme.colorScheme.onBackground, bottomBar = { - NiaBottomBar( - onNavigateToTopLevelDestination = niaTopLevelNavigation::navigateTo, - currentDestination = currentDestination - ) + if (windowSizeClass.widthSizeClass == WindowWidthSizeClass.Compact || windowSizeClass.heightSizeClass == WindowHeightSizeClass.Compact) { + NiaBottomBar( + onNavigateToTopLevelDestination = niaTopLevelNavigation::navigateTo, + currentDestination = currentDestination + ) + } } ) { padding -> Row( @@ -90,6 +93,14 @@ fun NiaApp(windowSizeClass: WindowSizeClass) { ) ) ) { + if (windowSizeClass.widthSizeClass != WindowWidthSizeClass.Compact && windowSizeClass.heightSizeClass != WindowHeightSizeClass.Compact) { + NiaNavRail( + onNavigateToTopLevelDestination = niaTopLevelNavigation::navigateTo, + currentDestination = currentDestination, + modifier = Modifier.safeDrawingPadding() + ) + } + NiaNavHost( windowSizeClass = windowSizeClass, navController = navController, From 334a6d07b39e64ab88531d48a3f03097b52fd09a Mon Sep 17 00:00:00 2001 From: Rivan Date: Wed, 15 Jun 2022 20:07:22 +0530 Subject: [PATCH 3/3] Fix SpotlessApply. --- .../com/google/samples/apps/nowinandroid/ui/NiaApp.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 34a16596c..f64445ef4 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 @@ -76,7 +76,9 @@ fun NiaApp(windowSizeClass: WindowSizeClass) { containerColor = Color.Transparent, contentColor = MaterialTheme.colorScheme.onBackground, bottomBar = { - if (windowSizeClass.widthSizeClass == WindowWidthSizeClass.Compact || windowSizeClass.heightSizeClass == WindowHeightSizeClass.Compact) { + if (windowSizeClass.widthSizeClass == WindowWidthSizeClass.Compact || + windowSizeClass.heightSizeClass == WindowHeightSizeClass.Compact + ) { NiaBottomBar( onNavigateToTopLevelDestination = niaTopLevelNavigation::navigateTo, currentDestination = currentDestination @@ -93,7 +95,9 @@ fun NiaApp(windowSizeClass: WindowSizeClass) { ) ) ) { - if (windowSizeClass.widthSizeClass != WindowWidthSizeClass.Compact && windowSizeClass.heightSizeClass != WindowHeightSizeClass.Compact) { + if (windowSizeClass.widthSizeClass != WindowWidthSizeClass.Compact && + windowSizeClass.heightSizeClass != WindowHeightSizeClass.Compact + ) { NiaNavRail( onNavigateToTopLevelDestination = niaTopLevelNavigation::navigateTo, currentDestination = currentDestination,