Skip to content

Commit 5acb8a7

Browse files
committed
Replaced deprecated WindowHeightSizeClass with isHeightAtLeastBreakpoint.
1 parent 41b6a64 commit 5acb8a7

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

compose/snippets/src/main/java/com/example/compose/snippets/layouts/AdaptiveLayoutSnippets.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import androidx.compose.runtime.mutableStateOf
2828
import androidx.compose.runtime.remember
2929
import androidx.compose.runtime.setValue
3030
import androidx.compose.ui.unit.dp
31-
import androidx.window.core.layout.WindowHeightSizeClass
3231
import androidx.window.core.layout.WindowSizeClass
3332

3433
/*
@@ -51,10 +50,10 @@ import androidx.window.core.layout.WindowSizeClass
5150
fun MyApp(
5251
windowSizeClass: WindowSizeClass = currentWindowAdaptiveInfo().windowSizeClass
5352
) {
54-
// Perform logic on the size class to decide whether to show the top app bar.
55-
val showTopAppBar = windowSizeClass.windowHeightSizeClass != WindowHeightSizeClass.COMPACT
53+
// Decide whether to show the top app bar based on window size class.
54+
val showTopAppBar = windowSizeClass.isHeightAtLeastBreakpoint(WindowSizeClass.HEIGHT_DP_MEDIUM_LOWER_BOUND)
5655

57-
// MyScreen knows nothing about window sizes, and performs logic based on a Boolean flag.
56+
// MyScreen logic is based on the showTopAppBar boolean flag.
5857
MyScreen(
5958
showTopAppBar = showTopAppBar,
6059
/* ... */

0 commit comments

Comments
 (0)