Skip to content

Commit

Permalink
Merge pull request #681 from AbhilashG97/android-client-680
Browse files Browse the repository at this point in the history
fix: Empty Snackbar is displyed on tapping "Submit" button in the Disburse Loan Dialog fragment in the absence of Internet connection
  • Loading branch information
therajanmaurya authored Jun 26, 2017
2 parents 439e7e5 + eb161a4 commit a5f5c82
Showing 1 changed file with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.mifos.utils.Constants;
import com.mifos.utils.DateHelper;
import com.mifos.utils.FragmentConstants;
import com.mifos.utils.Network;
import com.mifos.utils.Utils;

import java.util.ArrayList;
Expand Down Expand Up @@ -119,19 +120,23 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle

@OnClick(R.id.btn_disburse_loan)
void onSubmitDisburse() {
// Notify the user if Amount field is blank
if (etDisbursedAmount.getEditableText().toString().isEmpty()) {
new RequiredFieldException(getString(R.string.amount), getString(R.string
.message_field_required)).notifyUserWithToast(getActivity());
return;
if (Network.isOnline(getContext())) {
// Notify the user if Amount field is blank
if (etDisbursedAmount.getEditableText().toString().isEmpty()) {
new RequiredFieldException(getString(R.string.amount), getString(R.string
.message_field_required)).notifyUserWithToast(getActivity());
return;
}
LoanDisbursement loanDisbursement = new LoanDisbursement();
loanDisbursement.setNote(etDisbursementNote.getEditableText().toString());
loanDisbursement.setActualDisbursementDate(disbursementDates);
loanDisbursement.setTransactionAmount(
Double.valueOf(etDisbursedAmount.getEditableText().toString()));
loanDisbursement.setPaymentId(paymentTypeId);
loanAccountDisbursementPresenter.disburseLoan(loanAccountNumber, loanDisbursement);
} else {
Toaster.show(rootView, R.string.error_network_not_available, Toaster.LONG);
}
LoanDisbursement loanDisbursement = new LoanDisbursement();
loanDisbursement.setNote(etDisbursementNote.getEditableText().toString());
loanDisbursement.setActualDisbursementDate(disbursementDates);
loanDisbursement.setTransactionAmount(
Double.valueOf(etDisbursedAmount.getEditableText().toString()));
loanDisbursement.setPaymentId(paymentTypeId);
loanAccountDisbursementPresenter.disburseLoan(loanAccountNumber, loanDisbursement);
}

@Override
Expand Down

0 comments on commit a5f5c82

Please sign in to comment.