diff --git a/progressview/src/main/java/com/skydoves/progressview/HighlightView.kt b/progressview/src/main/java/com/skydoves/progressview/HighlightView.kt index 91ed8de..7b82d57 100644 --- a/progressview/src/main/java/com/skydoves/progressview/HighlightView.kt +++ b/progressview/src/main/java/com/skydoves/progressview/HighlightView.kt @@ -91,11 +91,19 @@ class HighlightView( updateHighlightView() } - @ColorInt var colorGradientEnd: Int = NO_COLOR - set(value) { - field = value - updateHighlightView() - } + @ColorInt + var colorGradientCenter: Int = NO_COLOR + set(value) { + field = value + updateHighlightView() + } + + @ColorInt + var colorGradientEnd: Int = NO_COLOR + set(value) { + field = value + updateHighlightView() + } var highlight: Drawable? = null set(value) { @@ -132,12 +140,13 @@ class HighlightView( if (orientation == ProgressViewOrientation.VERTICAL) { gradientOrientation = GradientDrawable.Orientation.TOP_BOTTOM } - GradientDrawable( - gradientOrientation, - intArrayOf(colorGradientStart, colorGradientEnd) - ).apply { - applyRadius(this) - } + GradientDrawable( + gradientOrientation, + intArrayOf(colorGradientStart, colorGradientCenter, colorGradientEnd) + .filter { it != NO_COLOR }.toIntArray() + ).apply { + applyRadius(this) + } } else if (highlight == null) { GradientDrawable().apply { setColor(this@HighlightView.color) diff --git a/progressview/src/main/java/com/skydoves/progressview/ProgressView.kt b/progressview/src/main/java/com/skydoves/progressview/ProgressView.kt index 608272f..45a0902 100644 --- a/progressview/src/main/java/com/skydoves/progressview/ProgressView.kt +++ b/progressview/src/main/java/com/skydoves/progressview/ProgressView.kt @@ -349,6 +349,8 @@ class ProgressView : FrameLayout { color = a.getColor(R.styleable.ProgressView_progressView_colorProgress, color) colorGradientStart = a.getColor(R.styleable.ProgressView_progressView_colorGradientStart, NO_COLOR) + colorGradientCenter = + a.getColor(R.styleable.ProgressView_progressView_colorGradientCenter, NO_COLOR) colorGradientEnd = a.getColor(R.styleable.ProgressView_progressView_colorGradientEnd, NO_COLOR) radius = this@ProgressView.radius @@ -694,6 +696,10 @@ class ProgressView : FrameLayout { this.progressView.highlightView.colorGradientStart = value } + fun setProgressbarColorGradientCenter(@ColorInt value: Int): Builder = apply { + this.progressView.highlightView.colorGradientCenter = value + } + fun setProgressbarColorGradientEnd(@ColorInt value: Int): Builder = apply { this.progressView.highlightView.colorGradientEnd = value } diff --git a/progressview/src/main/res/values/attrs_progressview.xml b/progressview/src/main/res/values/attrs_progressview.xml index 0cfd82f..dc6a37c 100644 --- a/progressview/src/main/res/values/attrs_progressview.xml +++ b/progressview/src/main/res/values/attrs_progressview.xml @@ -66,6 +66,8 @@ + +