Skip to content

A fully functional Android app built entirely with Kotlin and Jetpack Compose

Merge branch 'main' into dt/nav-safe-args

Don Turnera6397b7d8267
diff --cc app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppState.kt
index 300d67cfd,519603579..2394087dd
--- a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppState.kt
+++ b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppState.kt
@@@ -97,21 -90,13 +91,15 @@@ class NiaAppState
.currentBackStackEntryAsState().value?.destination
val currentTopLevelDestination: TopLevelDestination?
- @Composable get() = when (currentDestination?.route) {
- FOR_YOU_ROUTE -> FOR_YOU
- BOOKMARKS_ROUTE -> BOOKMARKS
- INTERESTS_ROUTE -> INTERESTS
- else -> null
+ @Composable get() {
+ with(currentDestination) {
+ if (this?.hasRoute<ForYouRoute>() == true) return FOR_YOU
+ if (this?.hasRoute<BookmarksRoute>() == true) return BOOKMARKS
+ if (this?.hasRoute<InterestsRoute>() == true) return INTERESTS
+ }
+ return null
}
- val shouldShowBottomBar: Boolean
- get() = windowSizeClass.widthSizeClass == WindowWidthSizeClass.Compact
-
- val shouldShowNavRail: Boolean
- get() = !shouldShowBottomBar
-
val isOffline = networkMonitor.isOnline
.map(Boolean::not)
.stateIn(