Refactoring - Removed most of the click listeners from the adapters and moved them into the appropriate fragments

This commit is contained in:
antonio 2023-01-04 09:14:15 +01:00
parent 29f56945c2
commit 754fc69eab
54 changed files with 1143 additions and 1137 deletions

View file

@ -52,6 +52,8 @@ public class HomeViewModel extends AndroidViewModel {
private final MutableLiveData<List<Media>> newestPodcastEpisodes = new MutableLiveData<>(null);
private final MutableLiveData<List<Chronology>> thisGridTopSong = new MutableLiveData<>(null);
private final MutableLiveData<List<Media>> mediaInstantMix = new MutableLiveData<>(null);
private final MutableLiveData<List<Media>> artistInstantMix = new MutableLiveData<>(null);
public HomeViewModel(@NonNull Application application) {
super(application);
@ -194,6 +196,22 @@ public class HomeViewModel extends AndroidViewModel {
return newestPodcastEpisodes;
}
public LiveData<List<Media>> getMediaInstantMix(LifecycleOwner owner, Media media) {
mediaInstantMix.setValue(Collections.emptyList());
songRepository.getInstantMix(media, 20).observe(owner, mediaInstantMix::postValue);
return mediaInstantMix;
}
public LiveData<List<Media>> getArtistInstantMix(LifecycleOwner owner, Artist artist) {
artistInstantMix.setValue(Collections.emptyList());
artistRepository.getInstantMix(artist, 20).observe(owner, artistInstantMix::postValue);
return artistInstantMix;
}
public void refreshDiscoverySongSample(LifecycleOwner owner) {
songRepository.getRandomSample(10, null, null).observe(owner, dicoverSongSample::postValue);
}