Skip to content

Commit

Permalink
Fix a bug about COLOR mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhpanvip committed May 3, 2020
1 parent 21f7e35 commit 9224155
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions indicator/src/main/java/com/zhpan/indicator/drawer/RectDrawer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,15 @@ open class RectDrawer internal constructor(indicatorOptions: IndicatorOptions) :
mRectF.set(left, 0f, left + minWidth, mIndicatorOptions.sliderHeight)
drawRoundRect(canvas, mIndicatorOptions.sliderHeight, mIndicatorOptions.sliderHeight)
}
if (currentPosition == mIndicatorOptions.pageSize - 1) {

} else {
if (slideProgress > 0.01) {
val evaluate = argbEvaluator?.evaluate(1 - slideProgress, mIndicatorOptions.checkedSliderColor, mIndicatorOptions.normalSliderColor)
mPaint.color = evaluate as Int
val nextSliderLeft = left + mIndicatorOptions.sliderGap + mIndicatorOptions.normalSliderWidth
mRectF.set(nextSliderLeft, 0f, nextSliderLeft + minWidth, mIndicatorOptions.sliderHeight)
drawRoundRect(canvas, mIndicatorOptions.sliderHeight, mIndicatorOptions.sliderHeight)
}
var nextSliderLeft = left + mIndicatorOptions.sliderGap + mIndicatorOptions.normalSliderWidth
if (currentPosition == mIndicatorOptions.pageSize - 1) {
nextSliderLeft = 0f;
}

val evaluate = argbEvaluator?.evaluate(1 - slideProgress, mIndicatorOptions.checkedSliderColor, mIndicatorOptions.normalSliderColor)
mPaint.color = evaluate as Int
mRectF.set(nextSliderLeft, 0f, nextSliderLeft + minWidth, mIndicatorOptions.sliderHeight)
drawRoundRect(canvas, mIndicatorOptions.sliderHeight, mIndicatorOptions.sliderHeight)
}

private fun drawWormSlider(canvas: Canvas) {
Expand Down

0 comments on commit 9224155

Please sign in to comment.