use of com.codeest.geeknews.model.http.response.GoldHttpResponse in project GeekNews by codeestX.
the class GoldPresenter method getGoldData.
@Override
public void getGoldData(String type) {
mType = type;
currentPage = 0;
totalList.clear();
Observable<List<GoldListBean>> list = mRetrofitHelper.fetchGoldList(type, NUM_EACH_PAGE, currentPage++).compose(RxUtil.<GoldHttpResponse<List<GoldListBean>>>rxSchedulerHelper()).compose(RxUtil.<List<GoldListBean>>handleGoldResult());
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -3);
Observable<List<GoldListBean>> hotList = mRetrofitHelper.fetchGoldHotList(type, new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime()), NUM_HOT_LIMIT).compose(RxUtil.<GoldHttpResponse<List<GoldListBean>>>rxSchedulerHelper()).compose(RxUtil.<List<GoldListBean>>handleGoldResult());
Subscription rxSubscription = Observable.concat(hotList, list).subscribe(new CommonSubscriber<List<GoldListBean>>(mView) {
@Override
public void onNext(List<GoldListBean> goldListBean) {
if (isHotList) {
isHotList = false;
totalList.addAll(goldListBean);
} else {
isHotList = true;
totalList.addAll(goldListBean);
mView.showContent(totalList);
}
}
});
addSubscrebe(rxSubscription);
}
use of com.codeest.geeknews.model.http.response.GoldHttpResponse in project GeekNews by codeestX.
the class GoldPresenter method getGoldData.
@Override
public void getGoldData(String type) {
mType = type;
currentPage = 0;
totalList.clear();
Flowable<List<GoldListBean>> list = mDataManager.fetchGoldList(type, NUM_EACH_PAGE, currentPage++).compose(RxUtil.<GoldHttpResponse<List<GoldListBean>>>rxSchedulerHelper()).compose(RxUtil.<List<GoldListBean>>handleGoldResult());
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -3);
Flowable<List<GoldListBean>> hotList = mDataManager.fetchGoldHotList(type, new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime()), NUM_HOT_LIMIT).compose(RxUtil.<GoldHttpResponse<List<GoldListBean>>>rxSchedulerHelper()).compose(RxUtil.<List<GoldListBean>>handleGoldResult());
addSubscribe(Flowable.concat(hotList, list).subscribeWith(new CommonSubscriber<List<GoldListBean>>(mView) {
@Override
public void onNext(List<GoldListBean> goldListBean) {
if (isHotList) {
isHotList = false;
totalList.addAll(goldListBean);
} else {
isHotList = true;
totalList.addAll(goldListBean);
mView.showContent(totalList);
}
}
}));
}
Aggregations