|
@ -7,6 +7,7 @@ import android.content.ClipData; |
|
|
import android.content.Intent; |
|
|
import android.content.Intent; |
|
|
import android.content.pm.PackageManager; |
|
|
import android.content.pm.PackageManager; |
|
|
import android.graphics.Bitmap; |
|
|
import android.graphics.Bitmap; |
|
|
|
|
|
import android.graphics.drawable.Drawable; |
|
|
import android.location.Address; |
|
|
import android.location.Address; |
|
|
import android.location.Geocoder; |
|
|
import android.location.Geocoder; |
|
|
import android.net.Uri; |
|
|
import android.net.Uri; |
|
@ -27,6 +28,7 @@ import android.widget.ImageView; |
|
|
import android.widget.LinearLayout; |
|
|
import android.widget.LinearLayout; |
|
|
import android.widget.TextView; |
|
|
import android.widget.TextView; |
|
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull; |
|
|
import androidx.annotation.Nullable; |
|
|
import androidx.annotation.Nullable; |
|
|
import androidx.core.app.ActivityCompat; |
|
|
import androidx.core.app.ActivityCompat; |
|
|
import androidx.core.content.FileProvider; |
|
|
import androidx.core.content.FileProvider; |
|
@ -35,6 +37,9 @@ import androidx.lifecycle.ViewModelProviders; |
|
|
import androidx.transition.AutoTransition; |
|
|
import androidx.transition.AutoTransition; |
|
|
import androidx.transition.TransitionManager; |
|
|
import androidx.transition.TransitionManager; |
|
|
|
|
|
|
|
|
|
|
|
import com.bumptech.glide.Glide; |
|
|
|
|
|
import com.bumptech.glide.request.target.CustomTarget; |
|
|
|
|
|
import com.bumptech.glide.request.transition.Transition; |
|
|
import com.gmeremit.online.gmeremittance_native.BuildConfig; |
|
|
import com.gmeremit.online.gmeremittance_native.BuildConfig; |
|
|
import com.gmeremit.online.gmeremittance_native.R; |
|
|
import com.gmeremit.online.gmeremittance_native.R; |
|
|
import com.gmeremit.online.gmeremittance_native.base.BaseFragment; |
|
|
import com.gmeremit.online.gmeremittance_native.base.BaseFragment; |
|
@ -273,36 +278,106 @@ public class CustomerDetailFragment extends BaseFragment implements KYCV3Present |
|
|
private void subscribeToCustomerRelatedData(KYCV3ViewModel kycv3ViewModel) { |
|
|
private void subscribeToCustomerRelatedData(KYCV3ViewModel kycv3ViewModel) { |
|
|
kycv3ViewModel.getCustomerDetailRelatedFormLiveData().observe(getViewLifecycleOwner(), val -> { |
|
|
kycv3ViewModel.getCustomerDetailRelatedFormLiveData().observe(getViewLifecycleOwner(), val -> { |
|
|
|
|
|
|
|
|
ed_firstname.setText(val.getPersonalInformation().getFullName()); |
|
|
|
|
|
ed_email.setText(val.getPersonalInformation().getEmail()); |
|
|
|
|
|
ed_gender.setText(val.getSelectedGenderFromGenderId(val.getPersonalInformation().getGender()).toString()); |
|
|
|
|
|
ed_address.setText(val.getPersonalInformation().getAddress()); |
|
|
|
|
|
ed_city.setText(val.getSelectedCityFromId(val.getPersonalInformation().getCity()).toString()); |
|
|
|
|
|
ed_dob.setText(val.getPersonalInformation().getDob()); |
|
|
|
|
|
|
|
|
|
|
|
form1ViewBindings.cityPublishSubject.onNext(val.getSelectedCityFromId(val.getPersonalInformation().getCity())); |
|
|
|
|
|
form1ViewBindings.genderPublishSubject.onNext(val.getSelectedGenderFromGenderId(val.getPersonalInformation().getGender())); |
|
|
|
|
|
form1ViewBindings.dobPublishSubject.onNext(val.getPersonalInformation().getDob()); |
|
|
|
|
|
|
|
|
|
|
|
ed_primaryBank.setText(val.getSelectedBankFromBankId(val.getPrimaryInformation().getBankId()).toString()); |
|
|
|
|
|
ed_primaryAccountNumber.setText(val.getPrimaryInformation().getBankAccount()); |
|
|
|
|
|
ed_passportId.setText(val.getPrimaryInformation().getPassportNumber()); |
|
|
|
|
|
ed_passportIdIssueDate.setText(val.getPrimaryInformation().getPassportIssueDate()); |
|
|
|
|
|
ed_passportIdExpiryDate.setText(val.getPrimaryInformation().getPassportExpiryDate()); |
|
|
|
|
|
ed_idType.setText(val.getSelectedIdTYpeFromId(val.getPrimaryInformation().getAnotherIDTypeId()).toString()); |
|
|
|
|
|
ed_anotherId.setText(val.getPrimaryInformation().getAnotherIDNumber()); |
|
|
|
|
|
ed_anotherIssueDate.setText(val.getPrimaryInformation().getPassportIssueDate()); |
|
|
|
|
|
ed_anotherExpiryDate.setText(val.getPrimaryInformation().getPassportExpiryDate()); |
|
|
|
|
|
ed_branch.setText(val.getSelectedGmeBranchFromId(val.getPrimaryInformation().getBranchId()).toString()); |
|
|
|
|
|
ed_referral.setText(val.getPrimaryInformation().getRefferalCode()); |
|
|
|
|
|
|
|
|
|
|
|
form2ViewBindings.passportNoIssuedDateSubject.onNext(val.getPrimaryInformation().getPassportIssueDate()); |
|
|
|
|
|
form2ViewBindings.passportNoExpiryDateSubject.onNext(val.getPrimaryInformation().getPassportExpiryDate()); |
|
|
|
|
|
form2ViewBindings.alternateIDNoIssuedDateSubject.onNext(val.getPrimaryInformation().getPassportIssueDate()); |
|
|
|
|
|
form2ViewBindings.alternateIDNoExpiryDateSubject.onNext(val.getPrimaryInformation().getPassportExpiryDate()); |
|
|
|
|
|
form2ViewBindings.primaryBankPublishSubject.onNext(val.getSelectedBankFromBankId(val.getPrimaryInformation().getBankId())); |
|
|
|
|
|
form2ViewBindings.idTypeSubject.onNext(val.getSelectedIdTYpeFromId(val.getPrimaryInformation().getAnotherIDTypeId())); |
|
|
|
|
|
form2ViewBindings.branchSubject.onNext(val.getSelectedGmeBranchFromId(val.getPrimaryInformation().getBranchId())); |
|
|
|
|
|
|
|
|
if (val.getPersonalInformation() != null) { |
|
|
|
|
|
ed_firstname.setText(val.getPersonalInformation().getFullName()); |
|
|
|
|
|
ed_email.setText(val.getPersonalInformation().getEmail()); |
|
|
|
|
|
|
|
|
|
|
|
IDTextDTO selectedGender = val.getSelectedGenderFromGenderId(val.getPersonalInformation().getGender()); |
|
|
|
|
|
if (selectedGender != null) { |
|
|
|
|
|
ed_gender.setText(selectedGender.toString()); |
|
|
|
|
|
form1ViewBindings.genderPublishSubject.onNext(selectedGender); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ed_address.setText(val.getPersonalInformation().getAddress()); |
|
|
|
|
|
|
|
|
|
|
|
IDTextDTO selectedCity = val.getSelectedCityFromId(val.getPersonalInformation().getCity()); |
|
|
|
|
|
if (selectedCity != null) { |
|
|
|
|
|
ed_city.setText(selectedCity.toString()); |
|
|
|
|
|
form1ViewBindings.cityPublishSubject.onNext(selectedCity); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ed_dob.setText(val.getPersonalInformation().getDob()); |
|
|
|
|
|
|
|
|
|
|
|
form1ViewBindings.dobPublishSubject.onNext(val.getPersonalInformation().getDob()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (val.getPrimaryInformation() != null) { |
|
|
|
|
|
IDTextDTO selectedPrimaryBank = val.getSelectedBankFromBankId(val.getPrimaryInformation().getBankId()); |
|
|
|
|
|
if (selectedPrimaryBank != null) { |
|
|
|
|
|
ed_primaryBank.setText(selectedPrimaryBank.toString()); |
|
|
|
|
|
form2ViewBindings.primaryBankPublishSubject.onNext(selectedPrimaryBank); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ed_primaryAccountNumber.setText(val.getPrimaryInformation().getBankAccount()); |
|
|
|
|
|
ed_passportId.setText(val.getPrimaryInformation().getPassportNumber()); |
|
|
|
|
|
ed_passportIdIssueDate.setText(val.getPrimaryInformation().getPassportIssueDate()); |
|
|
|
|
|
ed_passportIdExpiryDate.setText(val.getPrimaryInformation().getPassportExpiryDate()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IDTypeDTO selectedIDType = val.getSelectedIdTYpeFromId(val.getPrimaryInformation().getAnotherIDTypeId()); |
|
|
|
|
|
if (selectedIDType != null) { |
|
|
|
|
|
ed_idType.setText(selectedIDType.toString()); |
|
|
|
|
|
form2ViewBindings.idTypeSubject.onNext(selectedIDType); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ed_anotherId.setText(val.getPrimaryInformation().getAnotherIDNumber()); |
|
|
|
|
|
ed_anotherIssueDate.setText(val.getPrimaryInformation().getPassportIssueDate()); |
|
|
|
|
|
ed_anotherExpiryDate.setText(val.getPrimaryInformation().getPassportExpiryDate()); |
|
|
|
|
|
|
|
|
|
|
|
IDTextDTO selectedGmeBranch = val.getSelectedGmeBranchFromId(val.getPrimaryInformation().getBranchId()); |
|
|
|
|
|
if (selectedGmeBranch != null) { |
|
|
|
|
|
ed_branch.setText(selectedGmeBranch.toString()); |
|
|
|
|
|
form2ViewBindings.branchSubject.onNext(selectedGmeBranch); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
ed_referral.setText(val.getPrimaryInformation().getRefferalCode()); |
|
|
|
|
|
|
|
|
|
|
|
form2ViewBindings.passportNoIssuedDateSubject.onNext(val.getPrimaryInformation().getPassportIssueDate()); |
|
|
|
|
|
form2ViewBindings.passportNoExpiryDateSubject.onNext(val.getPrimaryInformation().getPassportExpiryDate()); |
|
|
|
|
|
form2ViewBindings.alternateIDNoIssuedDateSubject.onNext(val.getPrimaryInformation().getPassportIssueDate()); |
|
|
|
|
|
form2ViewBindings.alternateIDNoExpiryDateSubject.onNext(val.getPrimaryInformation().getPassportExpiryDate()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(val.getPictures().getPassportPicture()!=null&&val.getPictures().getPassportPicture().length()>0) |
|
|
|
|
|
{ |
|
|
|
|
|
Glide.with(iv_passport_id.getContext()) |
|
|
|
|
|
.asBitmap() |
|
|
|
|
|
.load(val.getPictures().getPassportPicture()) |
|
|
|
|
|
.into(new CustomTarget<Bitmap>() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) { |
|
|
|
|
|
iv_passport_id.setImageBitmap(resource); |
|
|
|
|
|
form3ViewBindings.passportIDDocPublishSubject.onNext(true); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void onLoadCleared(@Nullable Drawable placeholder) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(val.getPictures().getAnotherIDPicture()!=null&&val.getPictures().getAnotherIDPicture().length()>0) |
|
|
|
|
|
{ |
|
|
|
|
|
Glide.with(iv_alternate_id.getContext()) |
|
|
|
|
|
.asBitmap() |
|
|
|
|
|
.load(val.getPictures().getAnotherIDPicture()) |
|
|
|
|
|
.into(new CustomTarget<Bitmap>() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) { |
|
|
|
|
|
iv_alternate_id.setImageBitmap(resource); |
|
|
|
|
|
form3ViewBindings.alternateIDDocPublishSubject.onNext(true); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void onLoadCleared(@Nullable Drawable placeholder) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@ -384,7 +459,10 @@ public class CustomerDetailFragment extends BaseFragment implements KYCV3Present |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void onNext(String s) { |
|
|
public void onNext(String s) { |
|
|
ed_address.setText(s); |
|
|
|
|
|
|
|
|
if (s != null && s.length() > 0) |
|
|
|
|
|
ed_address.setText(s); |
|
|
|
|
|
else |
|
|
|
|
|
showToastMessage("Failed to obtain current adddress"); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -404,8 +482,6 @@ public class CustomerDetailFragment extends BaseFragment implements KYCV3Present |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void onStart() { |
|
|
public void onStart() { |
|
|
super.onStart(); |
|
|
super.onStart(); |
|
@ -1028,6 +1104,7 @@ public class CustomerDetailFragment extends BaseFragment implements KYCV3Present |
|
|
io.reactivex.subjects.PublishSubject<IDTypeDTO> idTypeSubject; |
|
|
io.reactivex.subjects.PublishSubject<IDTypeDTO> idTypeSubject; |
|
|
io.reactivex.subjects.PublishSubject<IDTextDTO> branchSubject; |
|
|
io.reactivex.subjects.PublishSubject<IDTextDTO> branchSubject; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Form2ViewBindings() { |
|
|
public Form2ViewBindings() { |
|
|
primaryBankPublishSubject = PublishSubject.create(); |
|
|
primaryBankPublishSubject = PublishSubject.create(); |
|
|
passportNoIssuedDateSubject = PublishSubject.create(); |
|
|
passportNoIssuedDateSubject = PublishSubject.create(); |
|
@ -1036,6 +1113,7 @@ public class CustomerDetailFragment extends BaseFragment implements KYCV3Present |
|
|
alternateIDNoExpiryDateSubject = PublishSubject.create(); |
|
|
alternateIDNoExpiryDateSubject = PublishSubject.create(); |
|
|
idTypeSubject = PublishSubject.create(); |
|
|
idTypeSubject = PublishSubject.create(); |
|
|
branchSubject = PublishSubject.create(); |
|
|
branchSubject = PublishSubject.create(); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public Observable<IDTextDTO> getPrimaryBankChangeEvent() { |
|
|
public Observable<IDTextDTO> getPrimaryBankChangeEvent() { |
|
|