Skip to content

Instantly share code, notes, and snippets.

@Krishan14sharma
Created November 10, 2017 12:40
Show Gist options
  • Save Krishan14sharma/507933f8f1623634218c0facb93913ff to your computer and use it in GitHub Desktop.
Save Krishan14sharma/507933f8f1623634218c0facb93913ff to your computer and use it in GitHub Desktop.
..
highLightPaint.color = ContextCompat.getColor(context, R.color.highlight_color)
highLightPaint.style = Paint.Style.FILL
highLightPaint.isAntiAlias = true
..
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
drawVerticalLines(canvas)
drawHorizontalLines(canvas)
if (touching) {
drawHighlightRectangle(canvas)
}
}
private fun drawHighlightRectangle(canvas: Canvas) {
canvas.drawRect(squares[rectIndex.first][rectIndex.second], highLightPaint)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment