From f89c67dfca0209d11d5f9663d833462febf8d655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=B6=9B?= Date: Mon, 18 Sep 2023 11:03:40 +0800 Subject: [PATCH] fix bug #5 Allow users to change the enable state during the dragging process --- slider/src/main/java/com/litao/slider/BaseSlider.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/slider/src/main/java/com/litao/slider/BaseSlider.kt b/slider/src/main/java/com/litao/slider/BaseSlider.kt index 5aa81c1..c593ea0 100644 --- a/slider/src/main/java/com/litao/slider/BaseSlider.kt +++ b/slider/src/main/java/com/litao/slider/BaseSlider.kt @@ -1516,6 +1516,11 @@ abstract class BaseSlider constructor(context: Context, attrs: AttributeSet? = n override fun onTouchEvent(event: MotionEvent): Boolean { if (!enableTouch()) { + //Users may change the enabled state of this Slider during the dragging process + if (isDragging){ + isDragging = false + stopTacking(event) + } return false }