mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 18:03:33 +00:00
fix: forgot sync album dialog, bump version for release
This commit is contained in:
parent
eaf2710054
commit
6a16159cf0
7 changed files with 184 additions and 2 deletions
|
|
@ -47,6 +47,8 @@ public class HomeViewModel extends AndroidViewModel {
|
|||
private final PlaylistRepository playlistRepository;
|
||||
private final SharingRepository sharingRepository;
|
||||
|
||||
private final StarredAlbumsSyncViewModel albumsSyncViewModel;
|
||||
|
||||
private final MutableLiveData<List<Child>> dicoverSongSample = new MutableLiveData<>(null);
|
||||
private final MutableLiveData<List<AlbumID3>> newReleasedAlbum = new MutableLiveData<>(null);
|
||||
private final MutableLiveData<List<Child>> starredTracksSample = new MutableLiveData<>(null);
|
||||
|
|
@ -82,6 +84,8 @@ public class HomeViewModel extends AndroidViewModel {
|
|||
playlistRepository = new PlaylistRepository();
|
||||
sharingRepository = new SharingRepository();
|
||||
|
||||
albumsSyncViewModel = new StarredAlbumsSyncViewModel(application);
|
||||
|
||||
setOfflineFavorite();
|
||||
}
|
||||
|
||||
|
|
@ -166,6 +170,10 @@ public class HomeViewModel extends AndroidViewModel {
|
|||
return starredAlbums;
|
||||
}
|
||||
|
||||
public LiveData<List<Child>> getAllStarredAlbumSongs() {
|
||||
return albumsSyncViewModel.getAllStarredAlbumSongs();
|
||||
}
|
||||
|
||||
public LiveData<List<ArtistID3>> getStarredArtists(LifecycleOwner owner) {
|
||||
if (starredArtists.getValue() == null) {
|
||||
artistRepository.getStarredArtists(true, 20).observe(owner, starredArtists::postValue);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,22 @@ public class StarredAlbumsSyncViewModel extends AndroidViewModel {
|
|||
return starredAlbums;
|
||||
}
|
||||
|
||||
public LiveData<List<Child>> getAllStarredAlbumSongs() {
|
||||
albumRepository.getStarredAlbums(false, -1).observeForever(new Observer<List<AlbumID3>>() {
|
||||
@Override
|
||||
public void onChanged(List<AlbumID3> albums) {
|
||||
if (albums != null && !albums.isEmpty()) {
|
||||
collectAllAlbumSongs(albums, starredAlbumSongs::postValue);
|
||||
} else {
|
||||
starredAlbumSongs.postValue(new ArrayList<>());
|
||||
}
|
||||
albumRepository.getStarredAlbums(false, -1).removeObserver(this);
|
||||
}
|
||||
});
|
||||
|
||||
return starredAlbumSongs;
|
||||
}
|
||||
|
||||
public LiveData<List<Child>> getStarredAlbumSongs(Activity activity) {
|
||||
albumRepository.getStarredAlbums(false, -1).observe((LifecycleOwner) activity, albums -> {
|
||||
if (albums != null && !albums.isEmpty()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue