-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
The logic to decide on the navigation component type looks like it should use a top bar layout if the window width is large or above:
@Composable
fun rememberNavigationComponentType(): NavigationComponentType {
val windowSizeClass = currentWindowAdaptiveInfo().windowSizeClass
val isLeanbackEnabled = isLeanbackEnabled()
val isAutomotiveEnabled = isAutomotiveEnabled()
val isPreview = LocalInspectionMode.current
val isSpatialUiEnabled = if (isPreview) {
false
} else {
hasXrSpatialFeature() && isSpatialUiEnabled()
}
return remember(isLeanbackEnabled, isAutomotiveEnabled, windowSizeClass, isSpatialUiEnabled) {
selectNavigationComponentType(
isLeanbackEnabled = isLeanbackEnabled,
isAutomotiveEnabled = isAutomotiveEnabled,
isLargeWindow = windowSizeClass.isWidthAtLeastLarge(),
isSpatialUiEnabled = isSpatialUiEnabled
)
}
}
// Select the navigation component type based on the available input devices.
private fun selectNavigationComponentType(
isLeanbackEnabled: Boolean,
isAutomotiveEnabled: Boolean,
isLargeWindow: Boolean,
isSpatialUiEnabled: Boolean,
): NavigationComponentType {
return when {
isSpatialUiEnabled -> NavigationComponentType.Spatial
isLeanbackEnabled -> NavigationComponentType.TopBar
isAutomotiveEnabled -> NavigationComponentType.TopBar
isLargeWindow -> NavigationComponentType.TopBar
else -> NavigationComponentType.NavigationSuiteScaffold
}
}
However, when currentWindowAdaptiveInfo() has a parameter supportLargeAndXLargeWidth which defaults to false meaning that even on large screens, isLargeWindow will still be false.
Suggest updating to set this parameter to true.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels