use of com.xinshang.audient.model.entities.StoreDataBean in project Audient by komamj.
the class SplashPresenter method loadStores.
@Override
public void loadStores() {
if (mView.isActive()) {
mView.setLoadingIndicator(true);
}
Disposable disposable = mRepository.getStores(true, 0, 20, null).map(new Function<ApiResponse<StoreDataBean>, List<Store>>() {
@Override
public List<Store> apply(ApiResponse<StoreDataBean> storeDataBeanApiResponse) throws Exception {
return storeDataBeanApiResponse.data.stores;
}
}).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribeWith(new DisposableSubscriber<List<Store>>() {
@Override
public void onNext(List<Store> stores) {
if (mView.isActive()) {
mView.showStores(stores);
}
}
@Override
public void onError(Throwable t) {
LogUtils.e(TAG, "getStores error : " + t.getMessage());
if (mView.isActive()) {
mView.setLoadingIndicator(false);
}
}
@Override
public void onComplete() {
if (mView.isActive()) {
mView.setLoadingIndicator(false);
}
}
});
mDisposables.add(disposable);
}
Aggregations