Search in sources :

Example 1 with DailyListBean

use of com.codeest.geeknews.model.bean.DailyListBean in project GeekNews by codeestX.

the class DailyPresenter method getDailyData.

@Override
public void getDailyData() {
    Subscription rxSubscription = mRetrofitHelper.fetchDailyListInfo().compose(RxUtil.<DailyListBean>rxSchedulerHelper()).map(new Func1<DailyListBean, DailyListBean>() {

        @Override
        public DailyListBean call(DailyListBean dailyListBean) {
            List<DailyListBean.StoriesBean> list = dailyListBean.getStories();
            for (DailyListBean.StoriesBean item : list) {
                item.setReadState(mRealmHelper.queryNewsId(item.getId()));
            }
            return dailyListBean;
        }
    }).subscribe(new CommonSubscriber<DailyListBean>(mView) {

        @Override
        public void onNext(DailyListBean dailyListBean) {
            topCount = dailyListBean.getTop_stories().size();
            mView.showContent(dailyListBean);
        }
    });
    addSubscrebe(rxSubscription);
}
Also used : DailyListBean(com.codeest.geeknews.model.bean.DailyListBean) Subscription(rx.Subscription) Func1(rx.functions.Func1)

Aggregations

DailyListBean (com.codeest.geeknews.model.bean.DailyListBean)1 Subscription (rx.Subscription)1 Func1 (rx.functions.Func1)1