File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed
compose/snippets/src/main/java/com/example/compose/snippets/layouts Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,6 @@ import androidx.compose.runtime.mutableStateOf
28
28
import androidx.compose.runtime.remember
29
29
import androidx.compose.runtime.setValue
30
30
import androidx.compose.ui.unit.dp
31
- import androidx.window.core.layout.WindowHeightSizeClass
32
31
import androidx.window.core.layout.WindowSizeClass
33
32
34
33
/*
@@ -51,10 +50,10 @@ import androidx.window.core.layout.WindowSizeClass
51
50
fun MyApp (
52
51
windowSizeClass : WindowSizeClass = currentWindowAdaptiveInfo().windowSizeClass
53
52
) {
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 )
56
55
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.
58
57
MyScreen (
59
58
showTopAppBar = showTopAppBar,
60
59
/* ... */
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ androidx-navigation = "2.8.5"
18
18
androidx-paging = " 3.3.5"
19
19
androidx-test = " 1.6.1"
20
20
androidx-test-espresso = " 3.6.1"
21
- androidx-window = " 1.3.0 "
21
+ androidx-window = " 1.4.0-alpha05 "
22
22
androidxHiltNavigationCompose = " 1.2.0"
23
23
coil = " 2.7.0"
24
24
# @keep
You can’t perform that action at this time.
0 commit comments