|
|
@ -306,27 +306,25 @@ public class CustomerDetailFragment extends BaseFragment implements KYCV3Present |
|
|
|
|
|
|
|
private void subscribeToSubmitButtonEnable(KYCV3ViewModel kycv3ViewModel) { |
|
|
|
kycv3ViewModel.getForm1SubmissionReadyLiveData().observe(getViewLifecycleOwner(), val -> btnSubmit1.setEnabled(val)); |
|
|
|
kycv3ViewModel.getForm2SubmissionReadyLiveData().observe(getViewLifecycleOwner(), val -> { |
|
|
|
btnSubmit2.setEnabled(val); |
|
|
|
// if (val) |
|
|
|
// btnSubmit2.requestFocus(); |
|
|
|
}); |
|
|
|
kycv3ViewModel.getForm3SubmissionReadyLiveData().observe(getViewLifecycleOwner(), val -> { |
|
|
|
btnSubmit3.setEnabled(val); |
|
|
|
// if (val) |
|
|
|
// btnSubmit3.requestFocus(); |
|
|
|
}); |
|
|
|
kycv3ViewModel.getForm2SubmissionReadyLiveData().observe(getViewLifecycleOwner(), val -> btnSubmit2.setEnabled(val)); |
|
|
|
kycv3ViewModel.getForm3SubmissionReadyLiveData().observe(getViewLifecycleOwner(), val -> btnSubmit3.setEnabled(val)); |
|
|
|
} |
|
|
|
|
|
|
|
private void subscribeToCustomerRelatedData(KYCV3ViewModel kycv3ViewModel) { |
|
|
|
kycv3ViewModel.getCustomerDetailRelatedFormLiveData().observe(getViewLifecycleOwner(), val -> { |
|
|
|
|
|
|
|
|
|
|
|
//Since we are pre-selecting branch as first item from list if no branch is selected. |
|
|
|
//So this data is always available to show to the user as preselected data |
|
|
|
IDTextDTO selectedGmeBranch = val.getSelectedGmeBranchFromId(val.getPrimaryInformation().getBranchId()); |
|
|
|
if (selectedGmeBranch != null) { |
|
|
|
ed_branch.setText(selectedGmeBranch.toString()); |
|
|
|
form2ViewBindings.branchSubject.onNext(selectedGmeBranch); |
|
|
|
|
|
|
|
} |
|
|
|
//We want to show segmented form if data are available to display. |
|
|
|
//Check data is available in cascading order. |
|
|
|
//Order: Personal Info > Primary Info > Pictures |
|
|
|
if (val.isPersonalInfoAvailable()) { |
|
|
|
ed_firstname.setText(val.getPersonalInformation().getFullName()); |
|
|
|
ed_email.setText(val.getPersonalInformation().getEmail()); |
|
|
@ -399,6 +397,8 @@ public class CustomerDetailFragment extends BaseFragment implements KYCV3Present |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
//Remaining data biding with corresponding views view |
|
|
|
|
|
|
|
kycv3ViewModel.getPassportImageLiveData().observe(getViewLifecycleOwner(), bitmap -> { |
|
|
|
if (bitmap != null) { |
|
|
|
Utility.showImageFromBitmap(getActivity(), iv_passport_id, bitmap); |
|
|
@ -454,7 +454,7 @@ public class CustomerDetailFragment extends BaseFragment implements KYCV3Present |
|
|
|
|
|
|
|
kycv3ViewModel.getPictureLabelForAnotherIDLiveData().observe(getViewLifecycleOwner(), label -> { |
|
|
|
if (label.length() == 0) { |
|
|
|
anotherIdPictureLabel.setText("Another ID(Optional)"); |
|
|
|
anotherIdPictureLabel.setText(getString(R.string.another_id_information_text)); |
|
|
|
iv_alternate_id.setImageResource(R.drawable.ic_another_id_picture); |
|
|
|
} else |
|
|
|
anotherIdPictureLabel.setText(label); |
|
|
@ -506,10 +506,8 @@ public class CustomerDetailFragment extends BaseFragment implements KYCV3Present |
|
|
|
|
|
|
|
kycv3ViewModel.getAlternateImageRequiredLiveData().observe(getViewLifecycleOwner(), action -> { |
|
|
|
if (action) { |
|
|
|
Log.d("ALTERNATEIMAGE", String.valueOf(action)); |
|
|
|
alternateIDImageViewContainer.setVisibility(View.VISIBLE); |
|
|
|
} else { |
|
|
|
Log.d("ALTERNATEIMAGE", String.valueOf(action)); |
|
|
|
alternateIDImageViewContainer.setVisibility(View.GONE); |
|
|
|
} |
|
|
|
|
|
|
@ -518,6 +516,7 @@ public class CustomerDetailFragment extends BaseFragment implements KYCV3Present |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//Error data binding with corresponding view elements in the form. |
|
|
|
private void subscribeToCustomerRelatedDataError(KYCV3ViewModel kycv3ViewModel) { |
|
|
|
kycv3ViewModel.getCustomerDetailRelatedFormErrorLiveData().getFullNameErrorLiveData().observe(getViewLifecycleOwner(), error -> fullNameWrapper.setError(error)); |
|
|
|
kycv3ViewModel.getCustomerDetailRelatedFormErrorLiveData().getGenderErrorLiveData().observe(getViewLifecycleOwner(), error -> genderListWrapper.setError(error)); |
|
|
@ -555,7 +554,9 @@ public class CustomerDetailFragment extends BaseFragment implements KYCV3Present |
|
|
|
RxUtils.getAddressFromGPS(getActivity()) |
|
|
|
.doOnSubscribe(sub -> showProgressBar(true, "")) |
|
|
|
.subscribeOn(Schedulers.io()) |
|
|
|
.map(address-> address.replaceAll("(?i)seoul", "")) |
|
|
|
.map(address->address.replaceAll("-"," ")) |
|
|
|
.map(address->address.replaceAll("[^a-zA-Z ]","")) |
|
|
|
.map(address-> address.replaceAll("(?i)seoul", "").trim()) |
|
|
|
.observeOn(AndroidSchedulers.mainThread()) |
|
|
|
.doFinally(() -> showProgressBar(false, "")) |
|
|
|
.subscribe(new Observer<String>() { |
|
|
@ -566,6 +567,7 @@ public class CustomerDetailFragment extends BaseFragment implements KYCV3Present |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onNext(String s) { |
|
|
|
Log.d("RXGPSAddress","Final Address: "+s); |
|
|
|
if (s != null && s.length() > 0) |
|
|
|
ed_address.setText(s); |
|
|
|
else |
|
|
@ -609,46 +611,22 @@ public class CustomerDetailFragment extends BaseFragment implements KYCV3Present |
|
|
|
@Override |
|
|
|
public void onStart() { |
|
|
|
super.onStart(); |
|
|
|
setImeActionOnEdittexts(true); |
|
|
|
rootView.setOnTouchListener((view, motionevent) -> { |
|
|
|
hideKeyBoard(); |
|
|
|
return true; |
|
|
|
}); |
|
|
|
// |
|
|
|
// rootView.setOnTouchListener((view, motionevent) -> { |
|
|
|
// hideKeyBoard(); |
|
|
|
// return true; |
|
|
|
// }); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onStop() { |
|
|
|
super.onStop(); |
|
|
|
setImeActionOnEdittexts(false); |
|
|
|
rootView.setOnTouchListener(null); |
|
|
|
} |
|
|
|
|
|
|
|
public void setImeActionOnEdittexts(boolean action) { |
|
|
|
// if(action) |
|
|
|
// { |
|
|
|
// ed_anotherId.setOnEditorActionListener((v, actionId, event) -> {new Handler().postDelayed(()-> promptDatePickerForIssueDate(ed_anotherId),250);return true;}); |
|
|
|
// } |
|
|
|
// else |
|
|
|
// { |
|
|
|
// ed_anotherId.setOnEditorActionListener(null); |
|
|
|
// |
|
|
|
// } |
|
|
|
// rootView.setOnTouchListener(null); |
|
|
|
} |
|
|
|
|
|
|
|
private boolean clearFocusableFields() { |
|
|
|
boolean hasPassportFieldFocus = false; |
|
|
|
boolean hasAlternateIDFieldFocus = false; |
|
|
|
if (ed_passportId.hasFocus()) { |
|
|
|
ed_passportId.clearFocus(); |
|
|
|
hasPassportFieldFocus = true; |
|
|
|
} |
|
|
|
if (ed_anotherId.hasFocus()) { |
|
|
|
ed_anotherId.clearFocus(); |
|
|
|
hasAlternateIDFieldFocus = true; |
|
|
|
} |
|
|
|
|
|
|
|
return hasPassportFieldFocus || hasAlternateIDFieldFocus; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@OnClick(R.id.btn_submit3) |
|
|
|
public void onClick3() { |
|
|
@ -888,7 +866,6 @@ public class CustomerDetailFragment extends BaseFragment implements KYCV3Present |
|
|
|
public void enablePassportNumberFocusChangeListener(boolean action) { |
|
|
|
if (action) { |
|
|
|
ed_passportId.setOnFocusChangeListener((v, hasFocus) -> { |
|
|
|
Log.d("KYCProcessPassport", String.valueOf(hasFocus)); |
|
|
|
if (!hasFocus) { |
|
|
|
ViewModelProviders.of(getActivity()).get(KYCV3ViewModel.class).validatePassportNumberFromServer(); |
|
|
|
ed_passportId.setOnFocusChangeListener(null); |
|
|
@ -905,7 +882,6 @@ public class CustomerDetailFragment extends BaseFragment implements KYCV3Present |
|
|
|
public void scrollToPassportNumberView() { |
|
|
|
scrollView.postDelayed(() -> { |
|
|
|
int scrollTo = ((View) passportIdWrapper.getParent().getParent()).getTop() + passportIdWrapper.getTop(); |
|
|
|
|
|
|
|
ObjectAnimator.ofInt(scrollView, "scrollY", scrollTo).setDuration(750).start(); |
|
|
|
}, 300); |
|
|
|
|
|
|
|