Skip to content

Instantly share code, notes, and snippets.

@ssaurel
Created March 20, 2018 10:26
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 ssaurel/673d9742b70abe059b8f6e475601d7e0 to your computer and use it in GitHub Desktop.
Save ssaurel/673d9742b70abe059b8f6e475601d7e0 to your computer and use it in GitHub Desktop.
onDraw method of the PianoView for the SSaurel's Channel
@Override
protected void onDraw(Canvas canvas) {
for (Key k : whites) {
canvas.drawRect(k.rect, k.down ? yellow : white);
}
for (int i = 1; i < NB; i++) {
canvas.drawLine(i * keyWidth, 0, i * keyWidth, height, black);
}
for (Key k : blacks) {
canvas.drawRect(k.rect, k.down ? yellow : black);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment