mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 01:53:31 +00:00
feat: add ability to add podcast channels
This commit is contained in:
parent
0248187f41
commit
7f4be7ad3e
10 changed files with 204 additions and 2 deletions
|
|
@ -0,0 +1,28 @@
|
|||
package com.cappielloantonio.play.viewmodel;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
|
||||
import com.cappielloantonio.play.repository.PodcastRepository;
|
||||
import com.cappielloantonio.play.repository.RadioRepository;
|
||||
import com.cappielloantonio.play.subsonic.models.InternetRadioStation;
|
||||
|
||||
public class PodcastChannelEditorViewModel extends AndroidViewModel {
|
||||
private static final String TAG = "RadioEditorViewModel";
|
||||
|
||||
private final PodcastRepository podcastRepository;
|
||||
|
||||
private InternetRadioStation toEdit;
|
||||
|
||||
public PodcastChannelEditorViewModel(@NonNull Application application) {
|
||||
super(application);
|
||||
|
||||
podcastRepository = new PodcastRepository();
|
||||
}
|
||||
|
||||
public void createChannel(String url) {
|
||||
podcastRepository.createPodcastChannel(url);
|
||||
}
|
||||
}
|
||||
|
|
@ -41,4 +41,12 @@ public class PodcastViewModel extends AndroidViewModel {
|
|||
|
||||
return podcastChannels;
|
||||
}
|
||||
|
||||
public void refreshNewestPodcastEpisodes(LifecycleOwner owner) {
|
||||
podcastRepository.getNewestPodcastEpisodes(20).observe(owner, newestPodcastEpisodes::postValue);
|
||||
}
|
||||
|
||||
public void refreshPodcastChannels(LifecycleOwner owner) {
|
||||
podcastRepository.getPodcastChannels(false, null).observe(owner, podcastChannels::postValue);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue