use of com.codeest.geeknews.model.bean.GankSearchItemBean in project GeekNews by codeestX.
the class TechPresenter method getSearchTechData.
private void getSearchTechData() {
currentPage = 1;
Subscription rxSubscription = mRetrofitHelper.fetchGankSearchList(queryStr, currentTech, NUM_OF_PAGE, currentPage).compose(RxUtil.<GankHttpResponse<List<GankSearchItemBean>>>rxSchedulerHelper()).compose(RxUtil.<List<GankSearchItemBean>>handleResult()).map(new Func1<List<GankSearchItemBean>, List<GankItemBean>>() {
@Override
public List<GankItemBean> call(List<GankSearchItemBean> gankSearchItemBeen) {
List<GankItemBean> newList = new ArrayList<>();
for (GankSearchItemBean item : gankSearchItemBeen) {
GankItemBean bean = new GankItemBean();
bean.set_id(item.getGanhuo_id());
bean.setDesc(item.getDesc());
bean.setPublishedAt(item.getPublishedAt());
bean.setWho(item.getWho());
bean.setUrl(item.getUrl());
newList.add(bean);
}
return newList;
}
}).subscribe(new CommonSubscriber<List<GankItemBean>>(mView) {
@Override
public void onNext(List<GankItemBean> gankItemBeen) {
mView.showContent(gankItemBeen);
}
});
addSubscrebe(rxSubscription);
}
use of com.codeest.geeknews.model.bean.GankSearchItemBean in project GeekNews by codeestX.
the class TechPresenter method getMoreSearchGankData.
private void getMoreSearchGankData() {
Subscription rxSubscription = mRetrofitHelper.fetchGankSearchList(queryStr, currentTech, NUM_OF_PAGE, ++currentPage).compose(RxUtil.<GankHttpResponse<List<GankSearchItemBean>>>rxSchedulerHelper()).compose(RxUtil.<List<GankSearchItemBean>>handleResult()).map(new Func1<List<GankSearchItemBean>, List<GankItemBean>>() {
@Override
public List<GankItemBean> call(List<GankSearchItemBean> gankSearchItemBeen) {
List<GankItemBean> newList = new ArrayList<>();
for (GankSearchItemBean item : gankSearchItemBeen) {
GankItemBean bean = new GankItemBean();
bean.set_id(item.getGanhuo_id());
bean.setDesc(item.getDesc());
bean.setPublishedAt(item.getPublishedAt());
bean.setWho(item.getWho());
bean.setUrl(item.getUrl());
newList.add(bean);
}
return newList;
}
}).subscribe(new CommonSubscriber<List<GankItemBean>>(mView) {
@Override
public void onNext(List<GankItemBean> gankItemBeen) {
mView.showMoreContent(gankItemBeen);
}
});
addSubscrebe(rxSubscription);
}
use of com.codeest.geeknews.model.bean.GankSearchItemBean in project GeekNews by codeestX.
the class TechPresenter method getSearchTechData.
private void getSearchTechData() {
currentPage = 1;
addSubscribe(mDataManager.fetchGankSearchList(queryStr, currentTech, NUM_OF_PAGE, currentPage).compose(RxUtil.<GankHttpResponse<List<GankSearchItemBean>>>rxSchedulerHelper()).compose(RxUtil.<List<GankSearchItemBean>>handleResult()).map(new Function<List<GankSearchItemBean>, List<GankItemBean>>() {
@Override
public List<GankItemBean> apply(List<GankSearchItemBean> gankSearchItemBeen) {
List<GankItemBean> newList = new ArrayList<>();
for (GankSearchItemBean item : gankSearchItemBeen) {
GankItemBean bean = new GankItemBean();
bean.set_id(item.getGanhuo_id());
bean.setDesc(item.getDesc());
bean.setPublishedAt(item.getPublishedAt());
bean.setWho(item.getWho());
bean.setUrl(item.getUrl());
newList.add(bean);
}
return newList;
}
}).subscribeWith(new CommonSubscriber<List<GankItemBean>>(mView) {
@Override
public void onNext(List<GankItemBean> gankItemBeen) {
mView.showContent(gankItemBeen);
}
}));
}
Aggregations