Skip to content

Replaced deprecated WindowHeightSizeClass with isHeightAtLeastBreakpoint(). #419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading