mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 18:03:33 +00:00
Add catalogues
This commit is contained in:
parent
8c889f7a38
commit
8b7e383dc2
45 changed files with 1084 additions and 136 deletions
|
|
@ -14,17 +14,23 @@ import java.util.List;
|
|||
public class AlbumRepository {
|
||||
private AlbumDao albumDao;
|
||||
private LiveData<List<Album>> listLiveAlbums;
|
||||
private LiveData<List<Album>> listLiveSampleAlbum;
|
||||
|
||||
public AlbumRepository(Application application) {
|
||||
AppDatabase database = AppDatabase.getInstance(application);
|
||||
albumDao = database.albumDao();
|
||||
listLiveAlbums = albumDao.getAll();
|
||||
}
|
||||
|
||||
public LiveData<List<Album>> getListLiveAlbums() {
|
||||
listLiveAlbums = albumDao.getAll();
|
||||
return listLiveAlbums;
|
||||
}
|
||||
|
||||
public LiveData<List<Album>> getListLiveSampleAlbum() {
|
||||
listLiveSampleAlbum = albumDao.getSample(10);
|
||||
return listLiveSampleAlbum;
|
||||
}
|
||||
|
||||
public boolean exist(Album album) {
|
||||
boolean exist = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import androidx.lifecycle.LiveData;
|
|||
|
||||
import com.cappielloantonio.play.database.AppDatabase;
|
||||
import com.cappielloantonio.play.database.dao.ArtistDao;
|
||||
import com.cappielloantonio.play.model.Album;
|
||||
import com.cappielloantonio.play.model.Artist;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -14,17 +15,23 @@ import java.util.List;
|
|||
public class ArtistRepository {
|
||||
private ArtistDao artistDao;
|
||||
private LiveData<List<Artist>> listLiveArtists;
|
||||
private LiveData<List<Artist>> listLiveSampleArtist;
|
||||
|
||||
public ArtistRepository(Application application) {
|
||||
AppDatabase database = AppDatabase.getInstance(application);
|
||||
artistDao = database.artistDao();
|
||||
listLiveArtists = artistDao.getAll();
|
||||
}
|
||||
|
||||
public LiveData<List<Artist>> getListLiveArtists() {
|
||||
listLiveArtists = artistDao.getAll();
|
||||
return listLiveArtists;
|
||||
}
|
||||
|
||||
public LiveData<List<Artist>> getListLiveSampleArtist() {
|
||||
listLiveSampleArtist = artistDao.getSample(10);
|
||||
return listLiveSampleArtist;
|
||||
}
|
||||
|
||||
public boolean exist(Artist artist) {
|
||||
boolean exist = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import androidx.lifecycle.LiveData;
|
|||
|
||||
import com.cappielloantonio.play.database.AppDatabase;
|
||||
import com.cappielloantonio.play.database.dao.GenreDao;
|
||||
import com.cappielloantonio.play.model.Album;
|
||||
import com.cappielloantonio.play.model.Genre;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -14,17 +15,23 @@ import java.util.List;
|
|||
public class GenreRepository {
|
||||
private GenreDao genreDao;
|
||||
private LiveData<List<Genre>> listLiveGenres;
|
||||
private LiveData<List<Genre>> listLiveAlbumGenre;
|
||||
|
||||
public GenreRepository(Application application) {
|
||||
AppDatabase database = AppDatabase.getInstance(application);
|
||||
genreDao = database.genreDao();
|
||||
listLiveGenres = genreDao.getAll();
|
||||
}
|
||||
|
||||
public LiveData<List<Genre>> getListLiveGenres() {
|
||||
listLiveGenres = genreDao.getAll();
|
||||
return listLiveGenres;
|
||||
}
|
||||
|
||||
public LiveData<List<Genre>> getListLiveSampleGenre() {
|
||||
listLiveAlbumGenre = genreDao.getSample(6 * 3);
|
||||
return listLiveAlbumGenre;
|
||||
}
|
||||
|
||||
public boolean exist(Genre genre) {
|
||||
boolean exist = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import androidx.lifecycle.LiveData;
|
|||
|
||||
import com.cappielloantonio.play.database.AppDatabase;
|
||||
import com.cappielloantonio.play.database.dao.SongDao;
|
||||
import com.cappielloantonio.play.model.Album;
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -15,22 +16,42 @@ public class SongRepository {
|
|||
private SongDao songDao;
|
||||
private LiveData<List<Song>> listLiveSongs;
|
||||
private LiveData<List<Song>> searchListLiveSongs;
|
||||
private LiveData<List<Song>> listLiveSampleDiscoverSongs;
|
||||
private LiveData<List<Song>> listLiveSampleRecentlyAddedSongs;
|
||||
private LiveData<List<Song>> listLiveSampleRecentlyPlayedSongs;
|
||||
private LiveData<List<Song>> listLiveSampleMostPlayedSongs;
|
||||
|
||||
|
||||
public SongRepository(Application application) {
|
||||
AppDatabase database = AppDatabase.getInstance(application);
|
||||
songDao = database.songDao();
|
||||
}
|
||||
|
||||
public LiveData<List<Song>> getListLiveSongs() {
|
||||
listLiveSongs = songDao.getAll();
|
||||
return listLiveSongs;
|
||||
}
|
||||
|
||||
public LiveData<List<Song>> searchListLiveSongs(String title) {
|
||||
public LiveData<List<Song>> searchListLiveSong(String title) {
|
||||
searchListLiveSongs = songDao.searchSong(title);
|
||||
return searchListLiveSongs;
|
||||
}
|
||||
|
||||
public LiveData<List<Song>> getListLiveDiscoverSampleSong() {
|
||||
listLiveSampleDiscoverSongs = songDao.getDiscoverSample(5);
|
||||
return listLiveSampleDiscoverSongs;
|
||||
}
|
||||
|
||||
public LiveData<List<Song>> getListLiveRecentlyAddedSampleSong() {
|
||||
listLiveSampleRecentlyAddedSongs = songDao.getRecentlyAddedSample(20);
|
||||
return listLiveSampleRecentlyAddedSongs;
|
||||
}
|
||||
|
||||
public LiveData<List<Song>> getListLiveRecentlyPlayedSampleSong() {
|
||||
listLiveSampleRecentlyPlayedSongs = songDao.getRecentlyPlayedSample(20);
|
||||
return listLiveSampleRecentlyPlayedSongs;
|
||||
}
|
||||
|
||||
public LiveData<List<Song>> getListLiveMostPlayedSampleSong() {
|
||||
listLiveSampleMostPlayedSongs = songDao.getMostPlayedSample(20);
|
||||
return listLiveSampleMostPlayedSongs;
|
||||
}
|
||||
|
||||
public boolean exist(Song song) {
|
||||
boolean exist = false;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue