Search in sources :

Example 1 with ToplistDetailResult

use of com.xinshang.audient.model.entities.ToplistDetailResult in project Audient by komamj.

the class ToplistDetailPresenter method loadToplistDetail.

@Override
public void loadToplistDetail(int topId, String showTime, int page, int pageCount) {
    mDisposables.clear();
    Disposable disposable = mRepository.getToplistDetail(topId, showTime, page, pageCount).map(new Function<ToplistDetailResult, List<Audient>>() {

        @Override
        public List<Audient> apply(ToplistDetailResult toplistDetailResult) throws Exception {
            return toplistDetailResult.dataBean.audients;
        }
    }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribeWith(new DisposableSubscriber<List<Audient>>() {

        @Override
        public void onNext(List<Audient> audients) {
            if (mView.isActive()) {
                mView.showToplistDetail(audients);
            }
        }

        @Override
        public void onError(Throwable t) {
            LogUtils.e(TAG, "getToplistDetail error :" + t.toString());
        }

        @Override
        public void onComplete() {
        }
    });
    mDisposables.add(disposable);
}
Also used : CompositeDisposable(io.reactivex.disposables.CompositeDisposable) Disposable(io.reactivex.disposables.Disposable) ToplistDetailResult(com.xinshang.audient.model.entities.ToplistDetailResult) Function(io.reactivex.functions.Function) List(java.util.List) Audient(com.xinshang.audient.model.entities.Audient)

Aggregations

Audient (com.xinshang.audient.model.entities.Audient)1 ToplistDetailResult (com.xinshang.audient.model.entities.ToplistDetailResult)1 CompositeDisposable (io.reactivex.disposables.CompositeDisposable)1 Disposable (io.reactivex.disposables.Disposable)1 Function (io.reactivex.functions.Function)1 List (java.util.List)1