Hi, Does Compose UI have a first-class API for use...
# compose
l
Hi, Does Compose UI have a first-class API for user input like multi-touch gestures, mouse/touchpad input (think Chromebooks), keyboards, and arbitrary input soures? Or will we need to use platform API? Or maybe it's planned?
m
Hey. Yes, we plan to provide full compose-first gestures support. mouse/touchpad/etc is still to be done, but we already use in our components (Drawers, Buttons, Scrollers) our gesture handling API. The raw gesture detectors can be found here: https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/ui/ui-framework/src/main/java/androidx/ui/core/gesture/ And we also have few higher-level composables, such as Clickable (https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/ui/ui-foundation/src/main/java/androidx/ui/foundation/Clickable.kt), Draggable(https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/), Toggleable, etc. I'm pretty sure all the input handling will be first-class citizen in compose.
👍 5
l
Thanks for sharing, interesting stuff!
In this file: https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/ui/ui-framework/src/main/java/androidx/ui/core/gesture/constants.kt I see a bunch of hardcoded constants like
val LongPressTimeout: Duration = 500.milliseconds
or
val DoubleTapTimeout: Duration = 300.milliseconds
. Would you consider allowing to make these only default parameter values where they are used? For an app targeting all demographics, I'd definitely allow the user to have a longer
DoubleTapTimeout
value for example, my GrandMa is probably not the only one slow to double tap.
m
Thanks for this idea, I think it would be nice to have this kind of flexibility. I'll ask in the team about how we can make it safe to use and also flexible
l
Having this value changeable and observed when used would be nice. The user can change long press duration on Android from Accessibility Settings, not just possible custom settings added in the app by the developers.
s
The constants in that file are really just temporary. My general hunch is that we want to let Android be the source of truth for those values in general. Allowing for configuration beyond that is indeed interesting. Thanks for the input!
👍 1