File tree 1 file changed +29
-0
lines changed
wear/src/main/java/com/example/wear/snippets/list
1 file changed +29
-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,37 @@ 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
+ fun breakpointDemo () {
113
+ // [END_EXCLUDE]
114
+ // ... use in your Composables:
115
+ if (isLargeDisplay()) {
116
+ // Show additional content.
117
+ } else {
118
+ // Show content only for smaller displays.
119
+ }
120
+ // [START_EXCLUDE]
121
+ }
122
+ // [END_EXCLUDE]
123
+ // [END android_wear_list_breakpoint]
124
+
125
+ // [START android_wear_list_preview]
105
126
@WearPreviewDevices
106
127
@WearPreviewFontScales
107
128
@Composable
108
129
fun ComposeListPreview () {
109
130
ComposeList ()
110
131
}
132
+ // [END android_wear_list_preview]
133
+
134
+ @WearPreviewDevices
135
+ @WearPreviewFontScales
136
+ @Composable
137
+ fun SnapAndFlingComposeListPreview () {
138
+ SnapAndFlingComposeList ()
139
+ }
You can’t perform that action at this time.
0 commit comments