Description: When I update the libray from com.google.android.material:material:1.2.0-alpha02 to com.google.android.material:material:1.2.0-alpha03,
but when I select a new value the tooltip didn't show and the method of onChange didn't work,the same problem occur in the catalog
Expected behavior: it should working like 1.20-alpha02
Source code:
<com.google.android.material.slider.Slider
android:id="@+id/slide"
android:layout_width="0dp"
android:layout_height="wrap_content"
/>
slide.valueFrom = 0f
slide.valueTo = 20f
slide.stepSize = 1f
slide.setOnChangeListener { slider, value ->
//do something
}
Android API version: Android Q
Material Library version: com.google.android.material:material:1.2.0-alpha03
Device: oneplus 6
It seems like the bug you're encountering is that _dragging_ the slider to a new value invokes the onChangeListener, but just _selecting_ a new value without dragging the slider to the new value does not invoke the onChangeListener. If that's not the case, please clarify the issue.
Assuming this is the issue, I was able to reproduce this and I'll bring it to the attention of the engineer currently developing the slider.
yes,as you say,not only dragging a new value but also selecting should invokes the onChangeListener.
Okay thank you for clarifying.
In 1.2.0-alpha03 we added a fix to prevent the Slider from intercepting scroll events from the parent. It looks like in this case it's no longer dispatching the change because we avoid handling the touch event unless there is enough horizontal movement. I'll take a look.
I also can't set slider to a value by selecting it. New value is selected only when I drag of swipe the slider. 1.2.0-alpha06
Most helpful comment
In
1.2.0-alpha03we added a fix to prevent the Slider from intercepting scroll events from the parent. It looks like in this case it's no longer dispatching the change because we avoid handling the touch event unless there is enough horizontal movement. I'll take a look.