File tree Expand file tree Collapse file tree 2 files changed +2
-37
lines changed
wear/src/main/java/com/example/wear/snippets/rotary Expand file tree Collapse file tree 2 files changed +2
-37
lines changed Original file line number Diff line number Diff line change @@ -46,8 +46,8 @@ recyclerview = "1.3.2"
46
46
# @keep
47
47
targetSdk = " 34"
48
48
version-catalog-update = " 0.8.3"
49
- wearComposeFoundation = " 1.3 .0"
50
- wearComposeMaterial = " 1.3 .0"
49
+ wearComposeFoundation = " 1.4 .0"
50
+ wearComposeMaterial = " 1.4 .0"
51
51
composeUiTooling = " 1.3.1"
52
52
53
53
[libraries ]
Original file line number Diff line number Diff line change @@ -58,45 +58,10 @@ import androidx.wear.compose.ui.tooling.preview.WearPreviewDevices
58
58
import androidx.wear.compose.ui.tooling.preview.WearPreviewFontScales
59
59
import kotlinx.coroutines.launch
60
60
61
- @OptIn(ExperimentalWearFoundationApi ::class )
62
61
@Composable
63
62
fun ScrollableScreen () {
64
63
// This sample doesn't add a Time Text at the top of the screen.
65
64
// If using Time Text, add padding to ensure content does not overlap with Time Text.
66
- // [START android_wear_rotary_input]
67
- val listState = rememberScalingLazyListState()
68
- Scaffold (
69
- positionIndicator = {
70
- PositionIndicator (scalingLazyListState = listState)
71
- }
72
- ) {
73
-
74
- val focusRequester = rememberActiveFocusRequester()
75
- val coroutineScope = rememberCoroutineScope()
76
-
77
- ScalingLazyColumn (
78
- modifier = Modifier
79
- .onRotaryScrollEvent {
80
- coroutineScope.launch {
81
- listState.scrollBy(it.verticalScrollPixels)
82
- listState.animateScrollBy(0f )
83
- }
84
- true
85
- }
86
- .focusRequester(focusRequester)
87
- .focusable()
88
- .fillMaxSize(),
89
- state = listState
90
- ) {
91
- // Content goes here
92
- // [START_EXCLUDE]
93
- items(count = 5 ) {
94
- Chip (onClick = { }, label = { Text (" Item #$it " ) })
95
- }
96
- // [END_EXCLUDE]
97
- }
98
- }
99
- // [END android_wear_rotary_input]
100
65
}
101
66
102
67
@OptIn(ExperimentalComposeUiApi ::class )
You can’t perform that action at this time.
0 commit comments