@Override public byte getRawNote() { return note.getId(); }
@Override public void saveNbt(CompoundTag tag) { super.saveNbt(tag); tag.putByte("note", note.getId()); }
@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(); }
sound = null; byte step = note.getId(); int octave = note.getOctave(); float pitch = (float) Math.pow(2, octave) / 2f;
for (Note note: notes) { realm.where(Note.class) .equalTo("id", note.getId()) .findFirst() .getTemplate() .deleteFromRealm(); } realm.copyToRealmOrUpdate(notes);
Note note = new Note(null, noteText, comment, new Date()); noteDao.insert(note); Log.d("DaoExample", "Inserted new note, ID: " + note.getId());
mRecyclerView.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() { @Override public boolean onInterceptTouchEvent(RecyclerView recyclerView, MotionEvent motionEvent) { View child = recyclerView.findChildViewUnder(motionEvent.getX(), motionEvent.getY()); if (child != null && mGestureDetector.onTouchEvent(motionEvent)) { int position = recyclerView.getChildLayoutPosition(child); Note selectedNote = mNotes.get(position); Intent editorIntent = new Intent(getActivity(), NoteEditorActivity.class); editorIntent.putExtra("id", selectedNote.getId()); startActivity(editorIntent); } System.out.print("Failed to load Editor class."); return false; }
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); } });
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); } } }