use of io.github.ryanhoo.music.event.FavoriteChangeEvent in project StylishMusicPlayer by ryanhoo.
the class MusicPlayerPresenter method setSongAsFavorite.
@Override
public void setSongAsFavorite(Song song, boolean favorite) {
Subscription subscription = mRepository.setSongAsFavorite(song, favorite).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Subscriber<Song>() {
@Override
public void onCompleted() {
// Empty
}
@Override
public void onError(Throwable e) {
mView.handleError(e);
}
@Override
public void onNext(Song song) {
mView.onSongSetAsFavorite(song);
RxBus.getInstance().post(new FavoriteChangeEvent(song));
}
});
mSubscriptions.add(subscription);
}
Aggregations