Android Open Source - dynamic-sound-android Key






From Project

Back to project page dynamic-sound-android.

License

The source code is released under:

MIT License

If you think the Android project dynamic-sound-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.tackmobile.androidpiano.view;
// w  w w.j  ava 2  s.  c  om
import android.content.Context;
import android.view.View;

public class Key extends View {

  private int midiNote;
  private boolean blackKey;

  public Key(Context context, int midiNote, boolean blackKey) {
    super(context);
    this.setMidiNote(midiNote);
    this.setBlackKey(blackKey);
  }

  public int getMidiNote() {
    return midiNote;
  }

  public void setMidiNote(int midiNote) {
    this.midiNote = midiNote;
  }

  public boolean isBlackKey() {
    return blackKey;
  }

  public void setBlackKey(boolean blackKey) {
    int colorResource = (blackKey) ? android.R.color.black : android.R.color.white;
    this.setBackgroundColor(getResources().getColor(colorResource));
    this.blackKey = blackKey;
  }

}




Java Source Code List

com.tackmobile.androidpiano.MainActivity.java
com.tackmobile.androidpiano.audio.PdInterface.java
com.tackmobile.androidpiano.view.Key.java
com.tackmobile.androidpiano.view.KeysView.java
com.tackmobile.spacerocks.GameBoard.java
com.tackmobile.spacerocks.MainActivity.java
com.tackmobile.spacerocks.audio.PdInterface.java
com.tackmobile.spacerocks.models.Asteroid.java
com.tackmobile.spacerocks.models.Missile.java