public void updateNote(Note newNote, Note oldNote) { for (Note note : notes) { if (oldNote.getId().equals(note.getId())) { note.setTitle(newNote.getTitle()); note.setContent(newNote.getContent()); notes.remove(note); notes.add(0, note); notesRecyclerView.scrollToPosition(0); notesAdapter.notifyDataSetChanged(); break; } } }
public void addNoteToList(Note note, int position) { notes.add(position, note); notesAdapter.notifyItemInserted(position); }
public void addNoteToList(Note note) { emptyView.setVisibility(View.GONE); notes.add(0, note); notesAdapter.notifyItemInserted(0); }