mirror of
https://github.com/CappielloAntonio/tempo.git
synced 2026-02-05 08:33:07 +00:00
added db function to retrieve pseudo random elements
This commit is contained in:
@@ -24,6 +24,9 @@ public interface SongDao {
|
|||||||
@Query("SELECT * FROM song WHERE title LIKE '%' || :title || '%'")
|
@Query("SELECT * FROM song WHERE title LIKE '%' || :title || '%'")
|
||||||
LiveData<List<Song>> searchSong(String title);
|
LiveData<List<Song>> searchSong(String title);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM song WHERE key IN (:pseudoRandomNumber)")
|
||||||
|
LiveData<List<Song>> getDiscoverySample(List<Integer> pseudoRandomNumber);
|
||||||
|
|
||||||
@Query("SELECT * FROM song ORDER BY added DESC LIMIT :number")
|
@Query("SELECT * FROM song ORDER BY added DESC LIMIT :number")
|
||||||
LiveData<List<Song>> getRecentlyAddedSample(int number);
|
LiveData<List<Song>> getRecentlyAddedSample(int number);
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ public class SongRepository {
|
|||||||
private SongDao songDao;
|
private SongDao songDao;
|
||||||
private SongGenreCrossDao songGenreCrossDao;
|
private SongGenreCrossDao songGenreCrossDao;
|
||||||
private LiveData<List<Song>> searchListLiveSongs;
|
private LiveData<List<Song>> searchListLiveSongs;
|
||||||
|
private LiveData<List<Song>> listLiveSampleDiscoverSongs;
|
||||||
private LiveData<List<Song>> listLiveSampleRecentlyAddedSongs;
|
private LiveData<List<Song>> listLiveSampleRecentlyAddedSongs;
|
||||||
private LiveData<List<Song>> listLiveSampleRecentlyPlayedSongs;
|
private LiveData<List<Song>> listLiveSampleRecentlyPlayedSongs;
|
||||||
private LiveData<List<Song>> listLiveSampleMostPlayedSongs;
|
private LiveData<List<Song>> listLiveSampleMostPlayedSongs;
|
||||||
@@ -44,6 +45,11 @@ public class SongRepository {
|
|||||||
return searchListLiveSongs;
|
return searchListLiveSongs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LiveData<List<Song>> getListLiveDiscoverSampleSong(List<Integer> pseudoRandomNumber) {
|
||||||
|
listLiveSampleDiscoverSongs = songDao.getDiscoverySample(pseudoRandomNumber);
|
||||||
|
return listLiveSampleDiscoverSongs;
|
||||||
|
}
|
||||||
|
|
||||||
public LiveData<List<Song>> getListLiveRecentlyAddedSampleSong(int number) {
|
public LiveData<List<Song>> getListLiveRecentlyAddedSampleSong(int number) {
|
||||||
listLiveSampleRecentlyAddedSongs = songDao.getRecentlyAddedSample(number);
|
listLiveSampleRecentlyAddedSongs = songDao.getRecentlyAddedSample(number);
|
||||||
return listLiveSampleRecentlyAddedSongs;
|
return listLiveSampleRecentlyAddedSongs;
|
||||||
|
|||||||
Reference in New Issue
Block a user