mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
Add artist page
This commit is contained in:
parent
8b7e383dc2
commit
c2be2711b9
44 changed files with 1028 additions and 191 deletions
|
|
@ -6,9 +6,13 @@ import androidx.annotation.NonNull;
|
|||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LiveData;
|
||||
|
||||
import com.cappielloantonio.play.model.Album;
|
||||
import com.cappielloantonio.play.model.Artist;
|
||||
import com.cappielloantonio.play.model.Genre;
|
||||
import com.cappielloantonio.play.model.RecentSearch;
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
import com.cappielloantonio.play.repository.AlbumRepository;
|
||||
import com.cappielloantonio.play.repository.ArtistRepository;
|
||||
import com.cappielloantonio.play.repository.GenreRepository;
|
||||
import com.cappielloantonio.play.repository.RecentSearchRepository;
|
||||
import com.cappielloantonio.play.repository.SongRepository;
|
||||
|
|
@ -17,18 +21,21 @@ import java.util.List;
|
|||
|
||||
public class SearchViewModel extends AndroidViewModel {
|
||||
private SongRepository songRepository;
|
||||
private GenreRepository genreRepository;
|
||||
private AlbumRepository albumRepository;
|
||||
private ArtistRepository artistRepository;
|
||||
private RecentSearchRepository recentSearchRepository;
|
||||
|
||||
private LiveData<List<Song>> searchSong;
|
||||
private LiveData<List<Genre>> allGenres;
|
||||
private LiveData<List<Album>> searchAlbum;
|
||||
private LiveData<List<Artist>> searchArtist;
|
||||
private LiveData<List<RecentSearch>> recentSearches;
|
||||
|
||||
public SearchViewModel(@NonNull Application application) {
|
||||
super(application);
|
||||
|
||||
songRepository = new SongRepository(application);
|
||||
genreRepository = new GenreRepository(application);
|
||||
albumRepository = new AlbumRepository(application);
|
||||
artistRepository = new ArtistRepository(application);
|
||||
recentSearchRepository = new RecentSearchRepository(application);
|
||||
}
|
||||
|
||||
|
|
@ -37,9 +44,14 @@ public class SearchViewModel extends AndroidViewModel {
|
|||
return searchSong;
|
||||
}
|
||||
|
||||
public LiveData<List<Genre>> getGenreList() {
|
||||
allGenres = genreRepository.getListLiveGenres();
|
||||
return allGenres;
|
||||
public LiveData<List<Album>> searchAlbum(String name) {
|
||||
searchAlbum = albumRepository.searchListLiveAlbum(name);
|
||||
return searchAlbum;
|
||||
}
|
||||
|
||||
public LiveData<List<Artist>> searchArtist(String name) {
|
||||
searchArtist = artistRepository.searchListLiveArtist(name);
|
||||
return searchArtist;
|
||||
}
|
||||
|
||||
public LiveData<List<RecentSearch>> getSearchList() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue