Skip to content

Instantly share code, notes, and snippets.

@2hamed
Created January 1, 2019 11:46
Show Gist options
  • Save 2hamed/cb5fcb2580b410163ed1f5b0bb024069 to your computer and use it in GitHub Desktop.
Save 2hamed/cb5fcb2580b410163ed1f5b0bb024069 to your computer and use it in GitHub Desktop.
var mode: Mode = Mode.Idle
override fun onDraw(canvas: Canvas) {
when (mode) {
Mode.Ready -> {
canvas.drawCircle(cx, cy, radius, outerPaint)
canvas.drawCircle(cx, cy, radius - radiusDiff, innerPaint)
canvas.drawCircle(cx, cy, recordRadius, recordPaint)
}
Mode.Recording -> {
canvas.drawCircle(cx, cy, radius, outerPaint)
canvas.drawCircle(cx, cy, radius - radiusDiff, innerPaint)
canvas.drawRect(recordRect, recordPaint)
}
Mode.Idle -> {
canvas.drawCircle(cx, cy, radius, outerPaint)
canvas.drawCircle(cx, cy, radius - radiusDiff, innerPaint)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment