Last active
November 10, 2020 10:16
-
-
Save svinouze/51b23a3c497935fd49511ca5124f264a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SegmentedProgressBar @JvmOverloads constructor( | |
context: Context, | |
attrs: AttributeSet? = null, | |
defStyleAttr: Int = 0 | |
) : View(context, attrs, defStyleAttr) { | |
[...] | |
@get:ColorInt | |
var progressColor: Int = Color.GREEN | |
var progressAlpha: Float = 1f | |
var progress: Int = 0 | |
[...] | |
private val progressPath: Path = Path() | |
private val progressPaint: Paint = Paint(Paint.ANTI_ALIAS_FLAG) | |
override fun onDraw(canvas: Canvas) { | |
[...] | |
val progressCoordinates = segmentCoordinatesComputer.progressCoordinates(progress, segmentCount, w, spacing) | |
drawSegment(canvas, progressPath, progressPaint, progressCoordinates, progressColor, progressAlpha) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment