From 7e0768b3b275574d003a413896211248c408cf10 Mon Sep 17 00:00:00 2001 From: HearSilent Date: Fri, 12 Jul 2019 17:24:53 +0800 Subject: [PATCH] Fixed listener trigger in wrong time --- .../main/java/hearsilent/discreteslider/DiscreteSlider.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/discreteslider/src/main/java/hearsilent/discreteslider/DiscreteSlider.java b/discreteslider/src/main/java/hearsilent/discreteslider/DiscreteSlider.java index e725df7..add3a53 100644 --- a/discreteslider/src/main/java/hearsilent/discreteslider/DiscreteSlider.java +++ b/discreteslider/src/main/java/hearsilent/discreteslider/DiscreteSlider.java @@ -650,11 +650,10 @@ private boolean handleTouchEvent(MotionEvent event) { mMoveDetector.onTouchEvent(event); return true; } - if (mPaddingPosition != mMinProgress && mPaddingPosition != mMaxProgress && - !mSkipMove) { + if (mPaddingPosition != mMinProgress && mPaddingPosition != mMaxProgress) { float p = mOrientation == HORIZONTAL ? event.getX() : event.getY(); final int position = (int) getClosestPosition(p, length)[0]; - if (position == mPaddingPosition) { + if (position == mPaddingPosition && !mSkipMove) { if (mMaxProgress == -1 && mMode == MODE_NORMAL) { mPaddingPosition = mMinProgress; } else {