Add favorite view

This commit is contained in:
Antonio Cappiello 2020-11-30 20:54:05 +01:00
parent ae23d268cd
commit 01bdbf49b2
52 changed files with 1064 additions and 317 deletions

View file

@ -18,6 +18,9 @@ public interface SongDao {
@Query("SELECT * FROM song")
LiveData<List<Song>> getAll();
@Query("SELECT * FROM song WHERE id = :id")
LiveData<Song> getOne(String id);
@Query("SELECT * FROM song")
List<Song> getAllList();
@ -33,7 +36,7 @@ public interface SongDao {
@Query("SELECT * FROM song WHERE play_count != 0 ORDER BY play_count DESC LIMIT :number")
LiveData<List<Song>> getMostPlayedSample(int number);
@Query("SELECT * FROM song WHERE play_count != 0 AND artistId = :artistID ORDER BY play_count DESC LIMIT :number")
@Query("SELECT * FROM song WHERE artistId = :artistID ORDER BY play_count DESC LIMIT :number")
LiveData<List<Song>> getArtistTopSongsSample(String artistID, int number);
@Query("SELECT * FROM song WHERE artistId = :artistID ORDER BY play_count DESC")
@ -48,6 +51,12 @@ public interface SongDao {
@Query("SELECT * FROM song INNER Join song_genre_cross ON song.id = song_genre_cross.song_id AND song_genre_cross.genre_id IN (:filters) GROUP BY song.id")
LiveData<List<Song>> getFilteredSong(ArrayList<String> filters);
@Query("SELECT * FROM song WHERE favorite = 1 ORDER BY play_count DESC LIMIT :number")
LiveData<List<Song>> getFavoriteSongSample(int number);
@Query("SELECT * FROM song WHERE favorite = 1 ORDER BY play_count DESC")
LiveData<List<Song>> getFavoriteSong();
@Query("SELECT EXISTS(SELECT * FROM song WHERE id = :id)")
boolean exist(String id);