mirror of
https://github.com/gabehf/tempus.git
synced 2026-03-11 08:21:06 -07:00
project upload
This commit is contained in:
parent
e1749a3123
commit
6eff64e7e1
105 changed files with 5907 additions and 0 deletions
|
|
@ -0,0 +1,40 @@
|
|||
package com.cappielloantonio.play.viewmodel;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LiveData;
|
||||
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
import com.cappielloantonio.play.repository.SongRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SongViewModel extends AndroidViewModel {
|
||||
private SongRepository repository;
|
||||
private LiveData<List<Song>> allSongs;
|
||||
|
||||
public SongViewModel(@NonNull Application application) {
|
||||
super(application);
|
||||
|
||||
repository = new SongRepository(application);
|
||||
allSongs = repository.getListLiveSongs();
|
||||
}
|
||||
|
||||
public boolean exist(Song song) {
|
||||
return repository.exist(song);
|
||||
}
|
||||
|
||||
public void insert(Song song) {
|
||||
repository.insert(song);
|
||||
}
|
||||
|
||||
public void delete(Song song) {
|
||||
repository.delete(song);
|
||||
}
|
||||
|
||||
public LiveData<List<Song>> getAllSongs() {
|
||||
return allSongs;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue