use of rx.Subscription in project ListenerMusicPlayer by hefuyicoder.
the class PlaylistDetailPresenter method loadPlaylistSongs.
@Override
public void loadPlaylistSongs(long playlistID) {
mCompositeSubscription.clear();
Subscription subscription = mUsecase.execute(new GetPlaylistSongs.RequestValues(playlistID)).getSongList().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<List<Song>>() {
@Override
public void call(List<Song> songList) {
mView.showPlaylistSongs(songList);
}
});
mCompositeSubscription.add(subscription);
}
use of rx.Subscription in project ListenerMusicPlayer by hefuyicoder.
the class PlaylistDetailFragment method subscribeMetaChangedEvent.
private void subscribeMetaChangedEvent() {
Subscription subscription = RxBus.getInstance().toObservable(MetaChangedEvent.class).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).distinctUntilChanged().subscribe(new Action1<MetaChangedEvent>() {
@Override
public void call(MetaChangedEvent event) {
mAdapter.notifyDataSetChanged();
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
}
});
RxBus.getInstance().addSubscription(this, subscription);
}
use of rx.Subscription in project ListenerMusicPlayer by hefuyicoder.
the class PlaylistFragment method subscribePlaylistUpdateEvent.
private void subscribePlaylistUpdateEvent() {
Subscription subscription = RxBus.getInstance().toObservable(PlaylistUpdateEvent.class).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<PlaylistUpdateEvent>() {
@Override
public void call(PlaylistUpdateEvent event) {
mPresenter.loadPlaylist();
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
}
});
RxBus.getInstance().addSubscription(this, subscription);
}
use of rx.Subscription in project ListenerMusicPlayer by hefuyicoder.
the class QuickControlsFragment method subscribeMetaChangedEvent.
private void subscribeMetaChangedEvent() {
Subscription subscription = RxBus.getInstance().toObservable(MetaChangedEvent.class).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<MetaChangedEvent>() {
@Override
public void call(MetaChangedEvent event) {
mPresenter.updateNowPlayingCard();
mPresenter.loadLyric();
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
}
});
RxBus.getInstance().addSubscription(this, subscription);
}
use of rx.Subscription in project ListenerMusicPlayer by hefuyicoder.
the class FoldersFragment method subscribeMetaChangedEvent.
private void subscribeMetaChangedEvent() {
Subscription subscription = RxBus.getInstance().toObservable(MetaChangedEvent.class).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).distinctUntilChanged().subscribe(new Action1<MetaChangedEvent>() {
@Override
public void call(MetaChangedEvent event) {
mAdapter.notifyDataSetChanged();
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
}
});
RxBus.getInstance().addSubscription(this, subscription);
}
Aggregations