use of io.github.ryanhoo.music.event.PlayListUpdatedEvent in project StylishMusicPlayer by ryanhoo.
the class PlayListDetailsPresenter method delete.
@Override
public void delete(final Song song, PlayList playList) {
playList.removeSong(song);
Subscription subscription = mRepository.update(playList).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Subscriber<PlayList>() {
@Override
public void onStart() {
mView.showLoading();
}
@Override
public void onCompleted() {
mView.hideLoading();
}
@Override
public void onError(Throwable e) {
mView.hideLoading();
mView.handleError(e);
}
@Override
public void onNext(PlayList playList) {
mView.onSongDeleted(song);
RxBus.getInstance().post(new PlayListUpdatedEvent(playList));
}
});
mSubscriptions.add(subscription);
}
use of io.github.ryanhoo.music.event.PlayListUpdatedEvent in project StylishMusicPlayer by ryanhoo.
the class FolderPresenter method addFolderToPlayList.
@Override
public void addFolderToPlayList(final Folder folder, PlayList playList) {
if (folder.getSongs().isEmpty())
return;
if (playList.isFavorite()) {
for (Song song : folder.getSongs()) {
song.setFavorite(true);
}
}
playList.addSong(folder.getSongs(), 0);
Subscription subscription = mRepository.update(playList).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Subscriber<PlayList>() {
@Override
public void onStart() {
mView.showLoading();
}
@Override
public void onCompleted() {
mView.hideLoading();
}
@Override
public void onError(Throwable e) {
mView.hideLoading();
mView.handleError(e);
}
@Override
public void onNext(PlayList playList) {
RxBus.getInstance().post(new PlayListUpdatedEvent(playList));
}
});
mSubscriptions.add(subscription);
}
use of io.github.ryanhoo.music.event.PlayListUpdatedEvent in project StylishMusicPlayer by ryanhoo.
the class PlayListDetailsPresenter method addSongToPlayList.
@Override
public void addSongToPlayList(Song song, PlayList playList) {
if (playList.isFavorite()) {
song.setFavorite(true);
}
playList.addSong(song, 0);
Subscription subscription = mRepository.update(playList).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Subscriber<PlayList>() {
@Override
public void onStart() {
mView.showLoading();
}
@Override
public void onCompleted() {
mView.hideLoading();
}
@Override
public void onError(Throwable e) {
mView.hideLoading();
mView.handleError(e);
}
@Override
public void onNext(PlayList playList) {
RxBus.getInstance().post(new PlayListUpdatedEvent(playList));
}
});
mSubscriptions.add(subscription);
}
Aggregations