Skip to content

Commit

Permalink
Remote special handling for rotary for SLC
Browse files Browse the repository at this point in the history
  • Loading branch information
kul3r4 committed Sep 5, 2024
1 parent 822ac2d commit 2989237
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 37 deletions.
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ recyclerview = "1.3.2"
# @keep
targetSdk = "34"
version-catalog-update = "0.8.3"
wearComposeFoundation = "1.3.0"
wearComposeMaterial = "1.3.0"
wearComposeFoundation = "1.4.0"
wearComposeMaterial = "1.4.0"
composeUiTooling = "1.3.1"

[libraries]
Expand Down
35 changes: 0 additions & 35 deletions wear/src/main/java/com/example/wear/snippets/rotary/Rotary.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,45 +58,10 @@ import androidx.wear.compose.ui.tooling.preview.WearPreviewDevices
import androidx.wear.compose.ui.tooling.preview.WearPreviewFontScales
import kotlinx.coroutines.launch

@OptIn(ExperimentalWearFoundationApi::class)
@Composable
fun ScrollableScreen() {
// This sample doesn't add a Time Text at the top of the screen.
// If using Time Text, add padding to ensure content does not overlap with Time Text.
// [START android_wear_rotary_input]
val listState = rememberScalingLazyListState()
Scaffold(
positionIndicator = {
PositionIndicator(scalingLazyListState = listState)
}
) {

val focusRequester = rememberActiveFocusRequester()
val coroutineScope = rememberCoroutineScope()

ScalingLazyColumn(
modifier = Modifier
.onRotaryScrollEvent {
coroutineScope.launch {
listState.scrollBy(it.verticalScrollPixels)
listState.animateScrollBy(0f)
}
true
}
.focusRequester(focusRequester)
.focusable()
.fillMaxSize(),
state = listState
) {
// Content goes here
// [START_EXCLUDE]
items(count = 5) {
Chip(onClick = { }, label = { Text("Item #$it") })
}
// [END_EXCLUDE]
}
}
// [END android_wear_rotary_input]
}

@OptIn(ExperimentalComposeUiApi::class)
Expand Down

0 comments on commit 2989237

Please sign in to comment.