I find listeners for onClick
and onLongClick
and even onPress
but there is no event/listener for something like buttonDown
and buttonUp
, or onPress
and onRelease
.
Am I missing something? My current use case is that when a user presses a button I increment a count and when the user releases it I decrease the count. But in general I want something to start happening as soon as the user presses the button and stop when the user releases it. (For a real life example, see how Facebook Messenger records a video, you keep the button pressed to start and it stops when you release it.
I am using Jetpack Compose on Android.
Use .pointerInput modifier: