mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
Fix redirection from album fragment to artist fragment on artist label click
This commit is contained in:
parent
9cf62c8c0c
commit
27acf968ad
1 changed files with 3 additions and 1 deletions
|
|
@ -21,6 +21,7 @@ public class AlbumPageViewModel extends AndroidViewModel {
|
||||||
private final AlbumRepository albumRepository;
|
private final AlbumRepository albumRepository;
|
||||||
private final ArtistRepository artistRepository;
|
private final ArtistRepository artistRepository;
|
||||||
private String albumId;
|
private String albumId;
|
||||||
|
private String artistId;
|
||||||
private final MutableLiveData<AlbumID3> album = new MutableLiveData<>(null);
|
private final MutableLiveData<AlbumID3> album = new MutableLiveData<>(null);
|
||||||
|
|
||||||
public AlbumPageViewModel(@NonNull Application application) {
|
public AlbumPageViewModel(@NonNull Application application) {
|
||||||
|
|
@ -41,6 +42,7 @@ public class AlbumPageViewModel extends AndroidViewModel {
|
||||||
public void setAlbum(LifecycleOwner owner, AlbumID3 album) {
|
public void setAlbum(LifecycleOwner owner, AlbumID3 album) {
|
||||||
this.albumId = album.getId();
|
this.albumId = album.getId();
|
||||||
this.album.postValue(album);
|
this.album.postValue(album);
|
||||||
|
this.artistId = album.getArtistId();
|
||||||
|
|
||||||
albumRepository.getAlbum(album.getId()).observe(owner, albums -> {
|
albumRepository.getAlbum(album.getId()).observe(owner, albums -> {
|
||||||
if (albums != null) this.album.setValue(albums);
|
if (albums != null) this.album.setValue(albums);
|
||||||
|
|
@ -48,7 +50,7 @@ public class AlbumPageViewModel extends AndroidViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public LiveData<ArtistID3> getArtist() {
|
public LiveData<ArtistID3> getArtist() {
|
||||||
return artistRepository.getArtistInfo(albumId);
|
return artistRepository.getArtistInfo(artistId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LiveData<AlbumInfo> getAlbumInfo() {
|
public LiveData<AlbumInfo> getAlbumInfo() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue