package com.codeest.geeknews.presenter.zhihu;
import com.codeest.geeknews.base.RxPresenter;
import com.codeest.geeknews.model.DataManager;
import com.codeest.geeknews.model.bean.SectionListBean;
import com.codeest.geeknews.base.contract.zhihu.SectionContract;
import com.codeest.geeknews.util.RxUtil;
import com.codeest.geeknews.widget.CommonSubscriber;
import javax.inject.Inject;
/**
* Created by codeest on 16/8/12.
*/
public class SectionPresenter extends RxPresenter<SectionContract.View> implements SectionContract.Presenter{
private DataManager mDataManager;
@Inject
public SectionPresenter(DataManager mDataManager) {
this.mDataManager = mDataManager;
}
@Override
public void getSectionData() {
addSubscribe(mDataManager.fetchSectionListInfo()
.compose(RxUtil.<SectionListBean>rxSchedulerHelper())
.subscribeWith(new CommonSubscriber<SectionListBean>(mView) {
@Override
public void onNext(SectionListBean sectionListBean) {
mView.showContent(sectionListBean);
}
})
);
}
}