use of com.xinshang.audient.model.entities.Store in project Audient by komamj.
the class MainPresenter method loadStoreInfo.
@Override
public void loadStoreInfo() {
Disposable disposable = mRepository.getStoreInfo(mRepository.getStoreId()).map(new Function<ApiResponse<Store>, Store>() {
@Override
public Store apply(ApiResponse<Store> storeApiResponse) throws Exception {
return storeApiResponse.data;
}
}).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribeWith(new DisposableSubscriber<Store>() {
@Override
public void onNext(Store store) {
if (mView != null) {
mView.showStoreInfo(store);
}
}
@Override
public void onError(Throwable t) {
LogUtils.e(TAG, "loadStoreInfo error : " + t.getMessage());
}
@Override
public void onComplete() {
}
});
mDisposables.add(disposable);
}
use of com.xinshang.audient.model.entities.Store in project Audient by komamj.
the class SplashFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
LogUtils.i(TAG, "onViewCreated");
setLoadingIndicator(false);
mAdapter = new StoresAdapter(mContext);
mAdapter.setListener(new StoresAdapter.OnItemClickListener() {
@Override
public void onItemClick(Store store) {
if (mPresenter != null) {
mPresenter.persistenceStore(store);
}
}
});
mRecyclerView.setHasFixedSize(true);
LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.addItemDecoration(new AudientItemDecoration(mContext));
mRecyclerView.setAdapter(mAdapter);
if (mPresenter != null) {
mPresenter.subscribe();
}
}
use of com.xinshang.audient.model.entities.Store 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