mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 01:53:31 +00:00
Implementation of album and artist catalog recovery
This commit is contained in:
parent
64cd8ed0ac
commit
98ffec9b72
15 changed files with 330 additions and 160 deletions
|
|
@ -5,10 +5,12 @@ import android.app.Application;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.cappielloantonio.play.model.Album;
|
||||
import com.cappielloantonio.play.model.Artist;
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
import com.cappielloantonio.play.repository.AlbumRepository;
|
||||
import com.cappielloantonio.play.repository.ArtistRepository;
|
||||
import com.cappielloantonio.play.repository.SongRepository;
|
||||
|
||||
|
|
@ -16,9 +18,10 @@ import java.util.List;
|
|||
|
||||
public class AlbumPageViewModel extends AndroidViewModel {
|
||||
private SongRepository songRepository;
|
||||
private AlbumRepository albumRepository;
|
||||
private ArtistRepository artistRepository;
|
||||
|
||||
private LiveData<List<Song>> songLiveList;
|
||||
private LiveData<List<Song>> songLiveList = new MutableLiveData<>();
|
||||
|
||||
private Album album;
|
||||
|
||||
|
|
@ -26,19 +29,15 @@ public class AlbumPageViewModel extends AndroidViewModel {
|
|||
super(application);
|
||||
|
||||
songRepository = new SongRepository(application);
|
||||
albumRepository = new AlbumRepository(application);
|
||||
artistRepository = new ArtistRepository(application);
|
||||
}
|
||||
|
||||
public LiveData<List<Song>> getAlbumSongLiveList() {
|
||||
// songLiveList = songRepository.getAlbumListLiveSong(album.getId());
|
||||
songLiveList = albumRepository.getAlbumTracks(album.getId());
|
||||
return songLiveList;
|
||||
}
|
||||
|
||||
public List<Song> getAlbumSongList() {
|
||||
// return songRepository.getAlbumListSong(album.getId(), false);
|
||||
return null;
|
||||
}
|
||||
|
||||
public Album getAlbum() {
|
||||
return album;
|
||||
}
|
||||
|
|
@ -47,8 +46,7 @@ public class AlbumPageViewModel extends AndroidViewModel {
|
|||
this.album = album;
|
||||
}
|
||||
|
||||
public Artist getArtist() {
|
||||
// return artistRepository.getArtistByID(album.getArtistId());
|
||||
return null;
|
||||
public LiveData<Artist> getArtist() {
|
||||
return artistRepository.getArtistInfo(album.getArtistId());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue