Open nordfalk opened 3 years ago
Here is a workaround that simply disables the swipeRefresh while using the slider:
rangeSlider.addOnSliderTouchListener( object : RangeSlider.OnSliderTouchListener{
override fun onStartTrackingTouch(slider: RangeSlider) {
swipeRefresh.isEnabled = false
}
override fun onStopTrackingTouch(slider: RangeSlider) {
swipeRefresh.isEnabled = true
}
})
The issue seems caused by SwipeRefreshLayout.
What JetPack version are you using?
I am using swiperefreshlayout-1.0.0 and material-1.2.1.
Here is a better workaround:
private var rangeSliderIsInUse = false
...
swipeRefresh.setOnChildScrollUpCallback { parent, child ->
val blockSwipeToRefresh = amountRangeSliderIsInUse || layoutManager.findFirstCompletelyVisibleItemPosition() > 0
blockSwipeToRefresh // return true if "swipe to refresh" should be blocked, becaurse it is possible to scroll up, or range sliders are in use right now
}
rangeSlider.addOnSliderTouchListener(object : RangeSlider.OnSliderTouchListener {
override fun onStartTrackingTouch(slider: RangeSlider) {
rangeSliderIsInUse = true
}
override fun onStopTrackingTouch(slider: RangeSlider) {
rangeSliderIsInUse = false
}
})
Description: If I drag down while adjustring the knobs on a RangeSlider which is inside a androidx.swiperefreshlayout.widget.SwipeRefreshLayout , then the knobs stays there forever.
See this video https://youtu.be/mtM-h6Rz78M
Expected behavior: Knobs should disappear when I drag down. Instead the SwipeRefreshLayout appears and the knobs stays forever
Source code:
Setting
in @+id/swipeRefresh makes the problem go away (but also the swipe to refresh ability)
Android API version: It has been verified on API 23 and API 30
Material Library version: It has been verified on com.google.android.material:material:1.3.0 and com.google.android.material:material:1.2.1
Device: Many physical and virtual devices