Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Attachment actions
Unintended behavior
View staffing
Description
Jetpack Compose component(s) used:
- Slider - Material3
Android Studio Build:
- Android Studio Iguana | 2023.2.1
- Build #AI-232.10227.8.2321.11479570, built on February 21, 2024
Kotlin version:
- 1.9.22
Steps to Reproduce or Code Sample to Reproduce:
I started with a new Android Studio Project from the File menu and then added a hilt ViewModel to mimic what we are trying to do.
We are trying to implement a Media3 ExoPlayer UI with a slider for progress and allowing the user to drag the slider to their desired position in the audio file.
In the compose, I have a slider with a position from the viewModel that should be firing every 500ms, to mimic the behavior of a Media3 ExoPlayer progress listener.
If the onValueChange Slider handler, I update the position value and in the onValueChangeFinished Slider handler I send that value back to the viewModel to update the progressFlow. I have some logging in the video, as well as some short Toast messages to see both being fired before I release the interaction.
I have included a minimal project as well as a screen capture of the issue. When I start dragging, before I release the interaction, I see the print that the onValueChangeFinished was called, when it shouldn't be until I release the interaction. I am not able to drag the handle more than a small amount as well, as seen in the video.
I have tried several different approaches from examples I found online, but they all seem to fail the same way. Some of them are to have a flag that sets the value of the Slider to a temp value when dragging and use the flow value when not dragging. The flag can be set either with the interactionSource and querying it's "isPressed" or "isDragging" states or by setting the flag inside a pointerInteropFilter on the ACTION_DOWN motion event modifier on the Slider. Again, none of them worked and I can't figure out what is going on inside the composable that makes it think the drag has finished prematurely.