Skip to content

Instantly share code, notes, and snippets.

@2hamed
Created January 1, 2019 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2hamed/926355b85b5e793796fa50b22154794a to your computer and use it in GitHub Desktop.
Save 2hamed/926355b85b5e793796fa50b22154794a to your computer and use it in GitHub Desktop.
private var recordRadius: Float = 0f
private val recordRect = RectF()
private val recordPaint = Paint().apply {
color = Color.RED
}
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
if (measuredHeight > 0 && measuredWidth > 0) {
...
recordRadius = radius / 4f
recordRect.set(cx - recordRadius, cy - recordRadius, cx + recordRadius, cy + recordRadius)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment