in app/src/main/java/org/apache/fineract/ui/online/loanaccounts/loanaccountlist/LoanAccountsPresenter.java [66:110]
public void fetchCustomerLoanAccounts(String customerIdentifier, Integer pageIndex) {
checkViewAttached();
getMvpView().showProgressbar();
compositeDisposable.add(dataManagerLoans.fetchCustomerLoanAccounts(customerIdentifier,
pageIndex, CUSTOMER_LOAN_LIST_SIZE)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribeWith(new DisposableObserver<LoanAccountPage>() {
@Override
public void onNext(LoanAccountPage loanAccountPage) {
getMvpView().hideProgressbar();
if (!loadmore && loanAccountPage.getTotalElements() == 0) {
getMvpView().showEmptyLoanAccounts(
context.getString(R.string.empty_customer_loans));
} else if (loadmore && loanAccountPage.getLoanAccounts().size() == 0) {
getMvpView().showMessage(
context.getString(R.string.no_more_loans_available));
} else {
showCustomerLoanAccounts(loanAccountPage.getLoanAccounts());
}
}
@Override
public void onError(Throwable throwable) {
getMvpView().hideProgressbar();
if (loadmore && !(throwable instanceof NoConnectivityException)) {
getMvpView().showMessage(
context.getString(R.string.error_loading_customer_loans));
} else if (loadmore && (throwable instanceof NoConnectivityException)) {
getMvpView().showMessage(
context.getString(R.string.no_internet_connection));
} else {
showExceptionError(throwable,
context.getString(R.string.error_loading_customer_loans));
}
}
@Override
public void onComplete() {
}
})
);
}