Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save yccheok/4bb6539c93fa39cf7dc7f08f0752d232 to your computer and use it in GitHub Desktop.

Select an option

Save yccheok/4bb6539c93fa39cf7dc7f08f0752d232 to your computer and use it in GitHub Desktop.
public class NoteViewModel extends ViewModel {
private LiveData<List<Note>> notesLiveData;
private LiveData<List<Note>> trashedNotesLiveData;
private Note newNote;
public NoteViewModel() {
init();
}
public void init() {
// SELECT * FROM plain_note where trashed = 0
notesLiveData = NoteRepository.INSTANCE.getNotes();
// SELECT * FROM plain_note where trashed = 1
trashedNotesLiveData = NoteRepository.INSTANCE.getTrashedNotes();
}
public LiveData<List<Note>> getNotesLiveData() {
return notesLiveData;
}
public LiveData<List<Note>> getTrashedNotesLiveData() {
return trashedNotesLiveData;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment