/** * Creates a new note for a sharp tone, such as A-sharp. * * @param octave The octave where the note is in. Has to be 0 - 2. * @param tone The tone within the octave. If the octave is 2 the note has * to be F#. * @return The new note. */ public static Note sharp(int octave, Tone tone) { return new Note(octave, tone, true); }
@Override public boolean blockInteract(GlowPlayer player, GlowBlock block, BlockFace face, Vector clickedLoc) { NoteBlock noteBlock = (NoteBlock) block.getState(); Note note = noteBlock.getNote(); noteBlock.setNote(new Note(note.getId() == 24 ? 0 : note.getId() + 1)); noteBlock.update(); return noteBlock.play(); }
@Override public byte getRawNote() { return note.getId(); }
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Note note = posts.get(position); Intent intent = new Intent(this, EditNoteActivity.class); intent.putExtra("noteId", note.getId()); intent.putExtra("noteTitle", note.getTitle()); intent.putExtra("noteContent", note.getContent()); startActivity(intent); } });
/** * Returns the tone of this note. * * @return the tone of this note. */ public Tone getTone() { return Tone.getById(getToneByte()); }
@Override public boolean isSharped() { return n.isSharped(); }
public class BootReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { List<Note> notes = dbHelper.getAllNotesAlarms(); for (Note note : notes) { Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(note.getAlarm()); Intent intent = new Intent(App.getAppContext(), AlarmService.class); intent.putExtra("NOTE_ID", note.getId()); PendingIntent pendingIntent = PendingIntent.getService(App.getAppContext(), (int) note.getId(), intent, PendingIntent.FLAG_CANCEL_CURRENT); AlarmManager am = (AlarmManager) App.getAppContext().getSystemService(Activity.ALARM_SERVICE); am.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pendingIntent); } } }
@Override public MCTone getTone() { return MCTone.valueOf(n.getTone().toString()); }
@Override public int getOctave() { return n.getOctave(); }
@Override public void saveNbt(CompoundTag tag) { super.saveNbt(tag); tag.putByte("note", note.getId()); }
/** * Returns if this note is sharped. * * @return if this note is sharped. */ public boolean isSharped() { byte note = getToneByte(); return Tone.getById(note).isSharped(note); }
@Override public void setRawNote(byte note) { this.note = new Note(note); }
for (Note note: notes) { realm.where(Note.class) .equalTo("id", note.getId()) .findFirst() .getTemplate() .deleteFromRealm(); } realm.copyToRealmOrUpdate(notes);
/** * Returns the tone of this note. * * @return the tone of this note. */ public Tone getTone() { return Tone.getById(getToneByte()); }
/** * @return The note a semitone below this one. */ public Note flattened() { Validate.isTrue(note > 0, "This note cannot be flattened because it is the lowest known note!"); return new Note(note - 1); }
Note note = new Note(null, noteText, comment, new Date()); noteDao.insert(note); Log.d("DaoExample", "Inserted new note, ID: " + note.getId());
/** * Returns if this note is sharped. * * @return if this note is sharped. */ public boolean isSharped() { byte note = getToneByte(); return Tone.getById(note).isSharped(note); }