[Media] Reject seek bar scrubbing if too vertical.
If a drag gesture begins on the seek bar and that drag gesture ends up being more vertical than horizontal, don't commit the result of the scrubbing when the drag gesture ends. As it turns out, there's no support for this in the Slider composable from the Material library. It just reports onValueChangeFinished regardless of how vertical the drag was; it doesn't even have a mechanism by which to observe or receive the actual delta. Therefore, I went around it. I used .pointerInput which is the low-level user input API in Compose to just watch for all gestures on the Slider. Then, I collected and reported the drag delta to the view-model so it has the information it needs to make its own decision when it handles the onValueChangeFinished. Bug: 397989775 Test: manually verified in the Compose Gallery app - starting a drag in the bounds of the seek bar, dragging too far up or down, and releasing reverts the position back to where it first was. Also verified that doing the same but going more horizontally than vertically works correctly. Flag: EXEMPT - code not yet used in production code. Change-Id: I5998cc8dd161769036f7e3a654394df24c9f9b2d
Loading
Please register or sign in to comment
