Search in sources :

Example 1 with WxarticleDetailItemBean

use of com.example.jingbin.cloudreader.bean.wanandroid.WxarticleDetailItemBean in project CloudReader by youlookwhat.

the class WanFindViewModel method getWxarticleDetail.

public void getWxarticleDetail(int id) {
    Disposable subscribe = HttpClient.Builder.getWanAndroidServer().getWxarticleDetail(id, mPage).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer<BaseResultBean<WxarticleDetailItemBean>>() {

        @Override
        public void accept(BaseResultBean<WxarticleDetailItemBean> naviJsonBean) throws Exception {
            if (naviJsonBean != null && naviJsonBean.getData() != null && naviJsonBean.getData().getDatas() != null && naviJsonBean.getData().getDatas().size() > 0) {
                // detail
                data.setValue(naviJsonBean.getData().getDatas());
            } else {
                data.setValue(null);
            }
        }
    }, new Consumer<Throwable>() {

        @Override
        public void accept(Throwable throwable) throws Exception {
            data.setValue(null);
        }
    });
    addDisposable(subscribe);
}
Also used : Disposable(io.reactivex.disposables.Disposable) BaseResultBean(com.example.jingbin.cloudreader.bean.wanandroid.BaseResultBean) WxarticleDetailItemBean(com.example.jingbin.cloudreader.bean.wanandroid.WxarticleDetailItemBean)

Aggregations

BaseResultBean (com.example.jingbin.cloudreader.bean.wanandroid.BaseResultBean)1 WxarticleDetailItemBean (com.example.jingbin.cloudreader.bean.wanandroid.WxarticleDetailItemBean)1 Disposable (io.reactivex.disposables.Disposable)1