mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 18:03:33 +00:00
Add favorite view
This commit is contained in:
parent
ae23d268cd
commit
01bdbf49b2
52 changed files with 1064 additions and 317 deletions
|
|
@ -17,6 +17,7 @@ public class SongRepository {
|
|||
private SongDao songDao;
|
||||
private SongGenreCrossDao songGenreCrossDao;
|
||||
private LiveData<List<Song>> searchListLiveSongs;
|
||||
private LiveData<Song> liveDataSong;
|
||||
private LiveData<List<Song>> listLiveSampleRecentlyAddedSongs;
|
||||
private LiveData<List<Song>> listLiveSampleRecentlyPlayedSongs;
|
||||
private LiveData<List<Song>> listLiveSampleMostPlayedSongs;
|
||||
|
|
@ -25,6 +26,8 @@ public class SongRepository {
|
|||
private LiveData<List<Song>> listLiveSongByGenre;
|
||||
private LiveData<List<Song>> listLiveFilteredSongs;
|
||||
private LiveData<List<Song>> listLiveSongByYear;
|
||||
private LiveData<List<Song>> listLiveSampleFavoritesSong;
|
||||
private LiveData<List<Song>> listLiveFavoritesSong;
|
||||
|
||||
|
||||
public SongRepository(Application application) {
|
||||
|
|
@ -38,6 +41,11 @@ public class SongRepository {
|
|||
return searchListLiveSongs;
|
||||
}
|
||||
|
||||
public LiveData<Song> getLiveDataSong(String id) {
|
||||
liveDataSong = songDao.getOne(id);
|
||||
return liveDataSong;
|
||||
}
|
||||
|
||||
public LiveData<List<Song>> getListLiveRecentlyAddedSampleSong(int number) {
|
||||
listLiveSampleRecentlyAddedSongs = songDao.getRecentlyAddedSample(number);
|
||||
return listLiveSampleRecentlyAddedSongs;
|
||||
|
|
@ -138,6 +146,16 @@ public class SongRepository {
|
|||
return listLiveSongByYear;
|
||||
}
|
||||
|
||||
public LiveData<List<Song>> getListLiveFavoritesSampleSong(int number) {
|
||||
listLiveSampleFavoritesSong = songDao.getFavoriteSongSample(number);
|
||||
return listLiveSampleFavoritesSong;
|
||||
}
|
||||
|
||||
public LiveData<List<Song>> getListLiveFavoritesSong() {
|
||||
listLiveFavoritesSong = songDao.getFavoriteSong();
|
||||
return listLiveFavoritesSong;
|
||||
}
|
||||
|
||||
public boolean exist(Song song) {
|
||||
boolean exist = false;
|
||||
|
||||
|
|
@ -173,7 +191,7 @@ public class SongRepository {
|
|||
thread.start();
|
||||
}
|
||||
|
||||
public void update(Song song) {
|
||||
public void increasePlayCount(Song song) {
|
||||
song.nowPlaying();
|
||||
|
||||
UpdateThreadSafe update = new UpdateThreadSafe(songDao, song);
|
||||
|
|
@ -181,6 +199,12 @@ public class SongRepository {
|
|||
thread.start();
|
||||
}
|
||||
|
||||
public void setFavoriteStatus(Song song) {
|
||||
UpdateThreadSafe update = new UpdateThreadSafe(songDao, song);
|
||||
Thread thread = new Thread(update);
|
||||
thread.start();
|
||||
}
|
||||
|
||||
public void getAll() {
|
||||
GetCatalogueThreadSafe catalogue = new GetCatalogueThreadSafe(songDao);
|
||||
Thread thread = new Thread(catalogue);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue