Skip to content

Commit

Permalink
Replaced deprecated WindowHeightSizeClass with isHeightAtLeastBreakpo…
Browse files Browse the repository at this point in the history
…int(). (#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]>
  • Loading branch information
JonEckenrode and JonEckenrode authored Jan 7, 2025
1 parent 716dfe1 commit b9c07aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.unit.dp
import androidx.window.core.layout.WindowHeightSizeClass
import androidx.window.core.layout.WindowSizeClass

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

// MyScreen knows nothing about window sizes, and performs logic based on a Boolean flag.
// MyScreen logic is based on the showTopAppBar boolean flag.
MyScreen(
showTopAppBar = showTopAppBar,
/* ... */
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ androidx-navigation = "2.8.5"
androidx-paging = "3.3.5"
androidx-test = "1.6.1"
androidx-test-espresso = "3.6.1"
androidx-window = "1.3.0"
androidx-window = "1.4.0-alpha05"
androidxHiltNavigationCompose = "1.2.0"
coil = "2.7.0"
# @keep
Expand Down

0 comments on commit b9c07aa

Please sign in to comment.