Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add smooth scrolling for rotary input #3876

Merged
merged 1 commit into from
Sep 19, 2023
Merged

Conversation

Dubzer
Copy link
Contributor

@Dubzer Dubzer commented Sep 18, 2023

Summary

This pull request adds smooth scrolling for rotary input. That's especially important on Galaxy Watch Classic models, since it has "low-res" input.
Unfortunately, unlike views, Compose for Wear OS still doesn't have smooth scrolling for lists by default, but there's a horologist library by Google, which has an implementation of it. That's what I used.

Screenshots

studio64_kFBUfJ1ZQN.mp4

@dshokouhi
Copy link
Member

This is great! I wonder if we should also apply it to other areas like the refresh interval picker? Noticed the other day it felt a bit extra jumpy using rotary input :)

.onRotaryScrollEvent {
coroutineScope.launch {
state.scrollToOption(
state.selectedOption + it.verticalScrollPixels.sign.toInt()
)
}
true
}
.focusRequester(focusRequester)

@Dubzer
Copy link
Contributor Author

Dubzer commented Sep 18, 2023

I wonder if we should also apply it to other areas like the refresh interval picker?

This behavior is also implemented in Horologist. There's a modifier called rotaryWithSnap, which is used by similarly designed component - TimePicker.

But I'd like to keep this in a separate PR as it looks like a loosely related changes

@dshokouhi
Copy link
Member

But I'd like to keep this in a separate PR as it looks like a loosely related changes

absolutely, I wasn't sure when I looked at the code recently :)

@JBassett JBassett merged commit 20f87c8 into home-assistant:master Sep 19, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants