use of rx.Subscription in project GeekNews by codeestX.
the class WechatPresenter method getWechatData.
@Override
public void getWechatData() {
queryStr = null;
currentPage = 1;
Subscription rxSubscription = mRetrofitHelper.fetchWechatListInfo(NUM_OF_PAGE, currentPage).compose(RxUtil.<WXHttpResponse<List<WXItemBean>>>rxSchedulerHelper()).compose(RxUtil.<List<WXItemBean>>handleWXResult()).subscribe(new CommonSubscriber<List<WXItemBean>>(mView) {
@Override
public void onNext(List<WXItemBean> wxItemBeen) {
mView.showContent(wxItemBeen);
}
});
addSubscrebe(rxSubscription);
}
use of rx.Subscription in project GeekNews by codeestX.
the class WelcomePresenter method getWelcomeData.
@Override
public void getWelcomeData() {
Subscription rxSubscription = mRetrofitHelper.fetchWelcomeInfo(RES).compose(RxUtil.<WelcomeBean>rxSchedulerHelper()).subscribe(new Action1<WelcomeBean>() {
@Override
public void call(WelcomeBean welcomeBean) {
mView.showContent(welcomeBean);
startCountDown();
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
mView.jumpToMain();
}
});
addSubscrebe(rxSubscription);
}
use of rx.Subscription in project GeekNews by codeestX.
the class ZhihuDetailPresenter method getDetailData.
@Override
public void getDetailData(int id) {
Subscription rxSubscription = mRetrofitHelper.fetchDetailInfo(id).compose(RxUtil.<ZhihuDetailBean>rxSchedulerHelper()).subscribe(new CommonSubscriber<ZhihuDetailBean>(mView) {
@Override
public void onNext(ZhihuDetailBean zhihuDetailBean) {
mData = zhihuDetailBean;
mView.showContent(zhihuDetailBean);
}
});
addSubscrebe(rxSubscription);
}
use of rx.Subscription in project GeekNews by codeestX.
the class ZhihuDetailPresenter method getExtraData.
@Override
public void getExtraData(int id) {
Subscription rxSubscription = mRetrofitHelper.fetchDetailExtraInfo(id).compose(RxUtil.<DetailExtraBean>rxSchedulerHelper()).subscribe(new CommonSubscriber<DetailExtraBean>(mView, "加载额外信息失败ヽ(≧Д≦)ノ") {
@Override
public void onNext(DetailExtraBean detailExtraBean) {
mView.showExtraInfo(detailExtraBean);
}
});
addSubscrebe(rxSubscription);
}
use of rx.Subscription 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);
}
Aggregations