Skip to content

Commit b9c07aa

Browse files
authored
Replaced deprecated WindowHeightSizeClass with isHeightAtLeastBreakpoint(). (#419)
* Replaced deprecated WindowHeightSizeClass with isHeightAtLeastBreakpoint. * Apply Spotless * Replaced deprecated WindowHeightSizeClass with isHeightAtLeastBreakpoint. * Updated androidx-window to 1.4.0-alpha05. --------- Co-authored-by: JonEckenrode <[email protected]>
1 parent 716dfe1 commit b9c07aa

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
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
/* ... */

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ androidx-navigation = "2.8.5"
1818
androidx-paging = "3.3.5"
1919
androidx-test = "1.6.1"
2020
androidx-test-espresso = "3.6.1"
21-
androidx-window = "1.3.0"
21+
androidx-window = "1.4.0-alpha05"
2222
androidxHiltNavigationCompose = "1.2.0"
2323
coil = "2.7.0"
2424
# @keep

0 commit comments

Comments
 (0)