File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
wear/src/main/java/com/example/wear/snippets/list Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ package com.example.wear.snippets.list
18
18
import androidx.compose.material.icons.Icons
19
19
import androidx.compose.material.icons.filled.Build
20
20
import androidx.compose.runtime.Composable
21
+ import androidx.compose.ui.platform.LocalConfiguration
21
22
import androidx.wear.compose.material.Text
22
23
import androidx.wear.compose.ui.tooling.preview.WearPreviewDevices
23
24
import androidx.wear.compose.ui.tooling.preview.WearPreviewFontScales
@@ -102,9 +103,38 @@ fun SnapAndFlingComposeList() {
102
103
// [END android_wear_snap]
103
104
}
104
105
106
+ // [START android_wear_list_breakpoint]
107
+ const val LARGE_DISPLAY_BREAKPOINT = 225
108
+
109
+ @Composable
110
+ fun isLargeDisplay () = LocalConfiguration .current.screenWidthDp >= LARGE_DISPLAY_BREAKPOINT
111
+ // [START_EXCLUDE]
112
+ @Composable
113
+ fun breakpointDemo () {
114
+ // [END_EXCLUDE]
115
+ // ... use in your Composables:
116
+ if (isLargeDisplay()) {
117
+ // Show additional content.
118
+ } else {
119
+ // Show content only for smaller displays.
120
+ }
121
+ // [START_EXCLUDE]
122
+ }
123
+ // [END_EXCLUDE]
124
+ // [END android_wear_list_breakpoint]
125
+
126
+ // [START android_wear_list_preview]
105
127
@WearPreviewDevices
106
128
@WearPreviewFontScales
107
129
@Composable
108
130
fun ComposeListPreview () {
109
131
ComposeList ()
110
132
}
133
+ // [END android_wear_list_preview]
134
+
135
+ @WearPreviewDevices
136
+ @WearPreviewFontScales
137
+ @Composable
138
+ fun SnapAndFlingComposeListPreview () {
139
+ SnapAndFlingComposeList ()
140
+ }
You can’t perform that action at this time.
0 commit comments