@Override public void onNoteClick(@Nullable Note note) { if (note == null) { return; } notesBox.remove(note); Log.d(App.TAG, "Deleted note, ID: " + note.getId()); } };
private void addNote() { String noteText = editText.getText().toString(); editText.setText(""); final DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM); String comment = "Added on " + df.format(new Date()); Note note = new Note(0, noteText, comment, new Date()); noteDao.insert(note); Log.d(App.TAG, "Inserted new note, ID: " + note.getId()); updateNotes(); }
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Note note = notesAdapter.getItem(position); notesBox.remove(note); Log.d(App.TAG, "Deleted note, ID: " + note.getId()); updateNotes(); } };
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Note note = notesAdapter.getItem(position); notesBox.remove(note); Log.d(App.TAG, "Deleted note, ID: " + note.getId()); } };
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Note note = notesAdapter.getItem(position); Long noteId = note.getId(); noteDao.deleteByKey(noteId); Log.d(App.TAG, "Deleted note, ID: " + noteId); updateNotes(); } };
private void addNote() { String noteText = editText.getText().toString(); editText.setText(""); DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM); String comment = "Added on " + df.format(new Date()); Note note = new Note(); note.setText(noteText); note.setComment(comment); note.setDate(new Date()); notesBox.put(note); Log.d(App.TAG, "Inserted new note, ID: " + note.getId()); }
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Note note = notesAdapter.getItem(position); notesBox.remove(note); Log.d(App.TAG, "Deleted note, ID: " + note.getId()); } };
private void addNote() { String noteText = editText.getText().toString(); editText.setText(""); DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM); String comment = "Added on " + df.format(new Date()); Note note = new Note(); note.setText(noteText); note.setComment(comment); note.setDate(new Date()); notesBox.put(note); Log.d(App.TAG, "Inserted new note, ID: " + note.getId()); }
private void addNote() { String noteText = editText.getText().toString(); editText.setText(""); DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM); String comment = "Added on " + df.format(new Date()); Note note = new Note(); note.setText(noteText); note.setComment(comment); note.setDate(new Date()); notesBox.put(note); Log.d(App.TAG, "Inserted new note, ID: " + note.getId()); }
private void addNote() { String noteText = editText.getText().toString(); editText.setText(""); DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM); String comment = "Added on " + df.format(new Date()); Note note = new Note(); note.setText(noteText); note.setComment(comment); note.setDate(new Date()); notesBox.put(note); Log.d(App.TAG, "Inserted new note, ID: " + note.getId()); updateNotes(); }
@Test public void testParentAndChildren() { Box<Note> box = store.boxFor(Note.class); Note parent = new Note(); parent.setText("Parent"); Note note = new Note(); note.setText("Child"); note.setParent(parent); long childId = box.put(note); long parentId = note.getParent().getId(); assertTrue(parentId > 0); Note noteFromBox = box.get(childId); assertEquals("Child", noteFromBox.getText()); assertEquals("Parent", noteFromBox.getParent().getText()); Note parentNoteFromBox = box.get(parentId); assertEquals(1, parentNoteFromBox.getChildren().size()); assertEquals(childId, parentNoteFromBox.getChildren().get(0).getId()); } }