From 26ede8fc068fc72decb557f7d2eaac0860c4f932 Mon Sep 17 00:00:00 2001 From: Preyea Regmi Date: Wed, 21 Aug 2019 11:18:59 +0900 Subject: [PATCH] Recipient Add/Edit View input fields updated --- .../main/assets/mockeddynamicvalidation.json | 4 +- .../ValidationRuleModel.java | 16 +- .../ReceiverInfoV3Model.java | 1 + .../RecipientAddV3ContractInterface.java | 4 + .../RecipientDetailValidaitorV3.java | 49 +- .../RecipientPresenterInterface.java | 27 +- .../add/RecipientAddV3Presenter.java | 81 +++- .../edit/RecipientEditV3Presenter.java | 78 +++- .../RecipientAddEditV3Activity.java | 434 +++++++++++++++++- .../layout/activity_recipient_add_edit_v3.xml | 302 +++++++++++- 10 files changed, 940 insertions(+), 56 deletions(-) diff --git a/app/src/main/assets/mockeddynamicvalidation.json b/app/src/main/assets/mockeddynamicvalidation.json index 33ec0819..c7b7c734 100644 --- a/app/src/main/assets/mockeddynamicvalidation.json +++ b/app/src/main/assets/mockeddynamicvalidation.json @@ -2,8 +2,8 @@ { "Field": "Local Name", "FieldRequired": "M", - "MinLength": "1", - "MaxLength": "50", + "MinLength": "3", + "MaxLength": "10", "Keyboard": "ANS" }, { diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/model/recipientaddeditV3/dynamicvalidation/ValidationRuleModel.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/model/recipientaddeditV3/dynamicvalidation/ValidationRuleModel.java index b8ab05e4..2007afe0 100644 --- a/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/model/recipientaddeditV3/dynamicvalidation/ValidationRuleModel.java +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/model/recipientaddeditV3/dynamicvalidation/ValidationRuleModel.java @@ -100,21 +100,7 @@ public class ValidationRuleModel { } -// -// public boolean validateValueAndReturnErrorMessageOnFail(String value) { -// if (fieldRequired) { -// -// //maxFieldLength is applied -// if (maxfieldLength > 0) { -// //value length is within the bound -// return value.length() <= maxfieldLength&&value.length()>0; -// } else { -// return value.length() > 0; -// } -// } -// //If field is not required then just relay the value, backend will handle -// return true; -// } + public String validateValueAndReturnErrorMessageOnFail(String value) { if (isFieldRequired()) { diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/model/recipientlistingV3/ReceiverInfoV3Model.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/model/recipientlistingV3/ReceiverInfoV3Model.java index e81d0347..99aef8ef 100644 --- a/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/model/recipientlistingV3/ReceiverInfoV3Model.java +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/model/recipientlistingV3/ReceiverInfoV3Model.java @@ -193,6 +193,7 @@ public class ReceiverInfoV3Model implements Parcelable { } public String getName() { + return name; } diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/RecipientAddV3ContractInterface.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/RecipientAddV3ContractInterface.java index 8c7c9260..a5b69b35 100644 --- a/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/RecipientAddV3ContractInterface.java +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/RecipientAddV3ContractInterface.java @@ -5,6 +5,8 @@ import com.gmeremit.online.gmeremittance_native.base.BaseContractInterface; public interface RecipientAddV3ContractInterface extends BaseContractInterface { + void registerTextWatchers(boolean action); + void updateValidationRuleToWidgetFullName(boolean visiblity, boolean shouldAllowSpecialCharacters, int maxLength); void updateValueToWidgetFullName(String name); void setErrorOnWidgetFullName(String error); @@ -19,4 +21,6 @@ public interface RecipientAddV3ContractInterface extends BaseContractInterface void updateValidationRuleToWidgetPaymentMethodSelection(boolean visiblity); void hideAllViewExceptCountry(); + + void hideAllFormInputFields(); } diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/RecipientDetailValidaitorV3.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/RecipientDetailValidaitorV3.java index 1c93b088..f35dd2e2 100644 --- a/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/RecipientDetailValidaitorV3.java +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/RecipientDetailValidaitorV3.java @@ -43,7 +43,7 @@ public class RecipientDetailValidaitorV3 { } - public void validateRecipientName(String fullName) + public void validateLocalName(String fullName) { ValidationRuleModel validationRuleModel=validationRuleModelMap.get(FIELD_FULL_NAME); if(validationRuleModel!=null&&validationRuleModel.validateValueAndReturnErrorMessageOnFail(fullName)==null) { @@ -69,4 +69,51 @@ public class RecipientDetailValidaitorV3 { public static final String FIELD_FULL_NAME="Full Name"; + public void validateAccountNo(String text) { + + } + + public void validateFirstName(String text) { + + } + + public void validateMiddleName(String text) { + + } + + public void validateLastName(String text) { + + } + + public void validateCity(String text) { + + } + + public void validateAddress(String text) { + + } + + public void validateMobileNumber(String text) { + + } + + public void validateEmail(String text) { + + } + + public void validateIdNumber(String text) { + + } + + public void validateFirstNameLocal(String text) { + + } + + public void validateMiddleNameLocal(String text) { + + } + + public void validateLastNameLocal(String text) { + + } } diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/RecipientPresenterInterface.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/RecipientPresenterInterface.java index e38dba9d..4e50b1d9 100644 --- a/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/RecipientPresenterInterface.java +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/RecipientPresenterInterface.java @@ -10,11 +10,36 @@ public interface RecipientPresenterInterface extends BasePresenterInterface { void onCountryServiceSelected(CountryServiceModel selectedCountry); - void onRecipientNameChanged(String rec); + void onRecipientLocalNameChanged(String rec); void onServiceTypeSelected(ServiceTypeModel selectedServiceType); List getAvailableCountryServiceData(); List getAvailableServiceMethodList(); + + + void onRecipientAccountNoChanged(String text); + + void onRecipientFirstNameChanged(String text); + + void onRecipientMiddleNameChanged(String text); + + void onRecipientLastNameChanged(String text); + + void onRecipientCityChanged(String text); + + void onRecipientAddressChanged(String text); + + void onRecipientMobileNumberChanged(String text); + + void onRecipientEmailChanged(String text); + + void onRecipientIdNumberChanged(String text); + + void onRecipientFirstNameLocalChanged(String text); + + void onRecipientMiddleNameLocalChanged(String text); + + void onRecipientLastNameLocalChanged(String text); } diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/add/RecipientAddV3Presenter.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/add/RecipientAddV3Presenter.java index 4f28376e..e1f2e94a 100644 --- a/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/add/RecipientAddV3Presenter.java +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/add/RecipientAddV3Presenter.java @@ -54,6 +54,7 @@ public class RecipientAddV3Presenter extends BasePresenter implements RecipientA private void init() { this.compositeDisposable = new CompositeDisposable(); mockCountryServiceDetail(); + view.hideAllViewExceptCountry(); } /** @@ -126,10 +127,13 @@ public class RecipientAddV3Presenter extends BasePresenter implements RecipientA * @param data */ private void applyValidationRulesToView(List data) { - if (data != null) + if (data != null) { + view.registerTextWatchers(false); for (ValidationRuleModel rule : data) { validator.applyDynamicValidationRuleToView(rule); } + view.registerTextWatchers(true); + } } /** @@ -166,11 +170,6 @@ public class RecipientAddV3Presenter extends BasePresenter implements RecipientA } - @Override - public void onRecipientNameChanged(String recipientName) { - validator.validateRecipientName(recipientName); - } - @Override public List getAvailableCountryServiceData() { return this.availableCountryServiceData; @@ -183,6 +182,76 @@ public class RecipientAddV3Presenter extends BasePresenter implements RecipientA return null; } + @Override + public void onRecipientAccountNoChanged(String text) { + validator.validateAccountNo(text); + } + + @Override + public void onRecipientFirstNameChanged(String text) { + validator.validateFirstName(text); + + } + + @Override + public void onRecipientMiddleNameChanged(String text) { + validator.validateMiddleName(text); + + } + + @Override + public void onRecipientLastNameChanged(String text) { + validator.validateLastName(text); + + } + + @Override + public void onRecipientLocalNameChanged(String recipientName) { + validator.validateLocalName(recipientName); + } + + @Override + public void onRecipientCityChanged(String text) { + validator.validateCity(text); + + } + + @Override + public void onRecipientAddressChanged(String text) { + validator.validateAddress(text); + + } + + @Override + public void onRecipientMobileNumberChanged(String text) { + validator.validateMobileNumber(text); + } + + @Override + public void onRecipientEmailChanged(String text) { + validator.validateEmail(text); + } + + @Override + public void onRecipientIdNumberChanged(String text) { + validator.validateIdNumber(text); + } + + @Override + public void onRecipientFirstNameLocalChanged(String text) { + validator.validateFirstNameLocal(text); + } + + @Override + public void onRecipientMiddleNameLocalChanged(String text) { + validator.validateMiddleNameLocal(text); + } + + @Override + public void onRecipientLastNameLocalChanged(String text) { + validator.validateLastNameLocal(text); + } + public class DynamicListObserver extends GenericApiObserverResponseV2> { diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/edit/RecipientEditV3Presenter.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/edit/RecipientEditV3Presenter.java index 26be49b5..f89bd622 100644 --- a/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/edit/RecipientEditV3Presenter.java +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/presenter/recipientaddeditV3/edit/RecipientEditV3Presenter.java @@ -104,11 +104,6 @@ public class RecipientEditV3Presenter extends BasePresenter implements Recipient this.selectedCountry=selectedCountry; } - @Override - public void onRecipientNameChanged(String recipientName) { - validator.validateRecipientName(recipientName); - } - @Override public void onServiceTypeSelected(ServiceTypeModel selectedServiceType) { this.selectedServiceType=selectedServiceType; @@ -117,6 +112,79 @@ public class RecipientEditV3Presenter extends BasePresenter implements Recipient } + + @Override + public void onRecipientAccountNoChanged(String text) { + validator.validateAccountNo(text); + } + + @Override + public void onRecipientFirstNameChanged(String text) { + validator.validateFirstName(text); + + } + + @Override + public void onRecipientMiddleNameChanged(String text) { + validator.validateMiddleName(text); + + } + + @Override + public void onRecipientLastNameChanged(String text) { + validator.validateLastName(text); + + } + + @Override + public void onRecipientLocalNameChanged(String recipientName) { + validator.validateLocalName(recipientName); + } + + @Override + public void onRecipientCityChanged(String text) { + validator.validateCity(text); + + } + + @Override + public void onRecipientAddressChanged(String text) { + validator.validateAddress(text); + + } + + @Override + public void onRecipientMobileNumberChanged(String text) { + validator.validateMobileNumber(text); + } + + @Override + public void onRecipientEmailChanged(String text) { + validator.validateEmail(text); + } + + @Override + public void onRecipientIdNumberChanged(String text) { + validator.validateIdNumber(text); + } + + @Override + public void onRecipientFirstNameLocalChanged(String text) { + validator.validateFirstNameLocal(text); + } + + @Override + public void onRecipientMiddleNameLocalChanged(String text) { + validator.validateMiddleNameLocal(text); + } + + @Override + public void onRecipientLastNameLocalChanged(String text) { + validator.validateLastNameLocal(text); + } + + + @Override public List getAvailableCountryServiceData() { return this.availableCountryServiceData; diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/view/recipientaddeditV3/RecipientAddEditV3Activity.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/view/recipientaddeditV3/RecipientAddEditV3Activity.java index 150fee16..7e11c51d 100644 --- a/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/view/recipientaddeditV3/RecipientAddEditV3Activity.java +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/recipientV3/view/recipientaddeditV3/RecipientAddEditV3Activity.java @@ -2,6 +2,7 @@ package com.gmeremit.online.gmeremittance_native.recipientV3.view.recipientadded import android.os.Bundle; import android.view.View; +import android.widget.LinearLayout; import com.gmeremit.online.gmeremittance_native.R; import com.gmeremit.online.gmeremittance_native.base.BaseActivity; @@ -25,11 +26,10 @@ import static android.view.View.GONE; public class RecipientAddEditV3Activity extends BaseActivity implements RecipientAddV3ContractInterface, View.OnClickListener { - @BindView(R.id.recieverNameFormInputField) - GMEFormInputField recieverNameFormInputField; - @BindView(R.id.recieverAddressFormInputField) - GMEFormInputField recieverAddressFormInputField; + @BindView(R.id.receiverFromViewContainer) + LinearLayout receiverFormViewContainer; + @BindView(R.id.recieverCountryViewContainer) View recieverCountryViewContainer; @@ -43,16 +43,114 @@ public class RecipientAddEditV3Activity extends BaseActivity implements Recipien @BindView(R.id.recieverPaymentMethodSelectionFormInputField) GMEFormInputField recieverPaymentMethodSelectionFormInputField; + @BindView(R.id.receiverBankViewContainer) + View receiverBankViewContainer; + + @BindView(R.id.recieverBankSelectionFormInputField) + GMEFormInputField recieverBankSelectionFormInputField; + + @BindView(R.id.receiverBranchViewContainer) + View receiverBranchViewContainer; + + @BindView(R.id.recieverBranchSelectionFormInputField) + GMEFormInputField recieverBranchSelectionFormInputField; + + + @BindView(R.id.recieverAccountNoFormInputField) + GMEFormInputField recieverAccountNoFormInputField; + + @BindView(R.id.recieverFirstNameFormInputField) + GMEFormInputField recieverFirstNameFormInputField; + + @BindView(R.id.recieverMiddleNameFormInputField) + GMEFormInputField recieverMiddleNameFormInputField; + + @BindView(R.id.recieverLastNameFormInputField) + GMEFormInputField recieverLastNameFormInputField; + + @BindView(R.id.recieverFirstNameLocalFormInputField) + GMEFormInputField recieverFirstNameLocalFormInputField; + + @BindView(R.id.recieverMiddleNameLocalFormInputField) + GMEFormInputField recieverMiddleNameLocalFormInputField; + + @BindView(R.id.recieverLastNameLocalFormInputField) + GMEFormInputField recieverLastNameLocalFormInputField; + + + @BindView(R.id.recieverLocalNameFormInputField) + GMEFormInputField recieverLocalNameFormInputField; + + + @BindView(R.id.receiverStateViewContainer) + View receiverStateViewContainer; + + @BindView(R.id.recieverStateSelectionFormInputField) + GMEFormInputField recieverStateSelectionFormInputField; + + @BindView(R.id.receiverDistrictViewContainer) + View receiverDistrictViewContainer; + + @BindView(R.id.recieverDistrictSelectionFormInputField) + GMEFormInputField recieverDistrictSelectionFormInputField; + + @BindView(R.id.recieverCityFormInputField) + GMEFormInputField recieverCityFormInputField; + + @BindView(R.id.recieverAddressFormInputField) + GMEFormInputField recieverAddressFormInputField; + + @BindView(R.id.receiverRelationViewContainer) + View receiverRelationViewContainer; + + @BindView(R.id.recieverRelationSelectionFormInputField) + GMEFormInputField recieverRelationSelectionFormInputField; + + @BindView(R.id.recieverMobileNoFormInputField) + GMEFormInputField recieverMobileNoFormInputField; + + @BindView(R.id.recieverEmailFormInputField) + GMEFormInputField recieverEmailFormInputField; + + @BindView(R.id.receiverTransferReasonViewContainer) + View receiverTransferReasonViewContainer; + + @BindView(R.id.recieverTransferReasonSelectionFormInputField) + GMEFormInputField recieverTransferReasonSelectionFormInputField; + + @BindView(R.id.receiverIDTypeViewContainer) + View receiverIDTypeViewContainer; + + @BindView(R.id.recieverIDTypeSelectionFormInputField) + GMEFormInputField recieverIDTypeSelectionFormInputField; + + @BindView(R.id.recieverIdNumberFormInputField) + GMEFormInputField recieverIdNumberFormInputField; + GenericTextListingDialog countryListingDialog; GenericTextListingDialog serviceMethodListingDialog; - RecipientNameTextWatcher recieverNameTextWatcher; public static String RECIPIENT_INFO_BUNDLE_KEY = "recipientInfoKey"; private RecipientPresenterInterface presenter; + private RecipientLocalNameTextWatcher recieverNameTextWatcher; + private RecipientAccountNoTextWatcher recieverAccountNoTextWatcher; + private RecipientFirstNameTextWatcher recieverFirstNameTextWatcher; + private RecipientMiddleNameTextWatcher recieverMiddleNameTextWatcher; + private RecipientLastNameTextWatcher recieverLastNameTextWatcher; + private RecipientFirstNameLocalTextWatcher recieverFirstNameLocalTextWatcher; + private RecipientMiddleNameLocalTextWatcher recieverMiddleNameLocalTextWatcher; + private RecipientLastNameLocalTextWatcher recieverLastNameLocalTextWatcher; + private RecipientLocalNameTextWatcher recieverLocalNameTextWatcher; + private RecipientCityTextWatcher recieverCityTextWatcher; + private RecipientAddressTextWatcher recieverAddressTextWatcher; + private RecipientMobileNumberTextWatcher recieverMobileNoTextWatcher; + private RecipientEmailTextWatcher recieverEmailTextWatcher; + private RecipientIdNumberTextWatcher recieverIdNumberTextWatcher; + @Override protected void onCreate(Bundle savedInstanceState) { @@ -78,14 +176,55 @@ public class RecipientAddEditV3Activity extends BaseActivity implements Recipien } private void initTextWatchers() { - recieverNameTextWatcher = new RecipientNameTextWatcher(); + recieverNameTextWatcher = new RecipientLocalNameTextWatcher(); + recieverAccountNoTextWatcher= new RecipientAccountNoTextWatcher(); + recieverFirstNameTextWatcher= new RecipientFirstNameTextWatcher(); + recieverMiddleNameTextWatcher= new RecipientMiddleNameTextWatcher(); + recieverLastNameTextWatcher= new RecipientLastNameTextWatcher(); + recieverFirstNameLocalTextWatcher= new RecipientFirstNameLocalTextWatcher(); + recieverMiddleNameLocalTextWatcher= new RecipientMiddleNameLocalTextWatcher(); + recieverLastNameLocalTextWatcher= new RecipientLastNameLocalTextWatcher(); + recieverLocalNameTextWatcher= new RecipientLocalNameTextWatcher(); + recieverCityTextWatcher= new RecipientCityTextWatcher(); + recieverAddressTextWatcher= new RecipientAddressTextWatcher(); + recieverMobileNoTextWatcher= new RecipientMobileNumberTextWatcher(); + recieverEmailTextWatcher= new RecipientEmailTextWatcher(); + recieverIdNumberTextWatcher= new RecipientIdNumberTextWatcher(); + } - private void registerTextWatchers(boolean action) { + @Override + public void registerTextWatchers(boolean action) { if (action) { - recieverNameFormInputField.addTextWatchers(recieverNameTextWatcher); + recieverLocalNameFormInputField.addTextWatchers(recieverNameTextWatcher); + recieverAccountNoFormInputField.addTextWatchers(recieverAccountNoTextWatcher); + recieverFirstNameFormInputField.addTextWatchers(recieverFirstNameTextWatcher); + recieverMiddleNameFormInputField.addTextWatchers(recieverMiddleNameTextWatcher); + recieverLastNameFormInputField.addTextWatchers(recieverLastNameTextWatcher); + recieverFirstNameLocalFormInputField.addTextWatchers(recieverFirstNameLocalTextWatcher); + recieverMiddleNameLocalFormInputField.addTextWatchers(recieverMiddleNameLocalTextWatcher); + recieverLastNameLocalFormInputField.addTextWatchers(recieverLastNameLocalTextWatcher); + recieverLocalNameFormInputField.addTextWatchers(recieverLocalNameTextWatcher); + recieverCityFormInputField.addTextWatchers(recieverCityTextWatcher); + recieverAddressFormInputField.addTextWatchers(recieverAddressTextWatcher); + recieverMobileNoFormInputField.addTextWatchers(recieverMobileNoTextWatcher); + recieverEmailFormInputField.addTextWatchers(recieverEmailTextWatcher); + recieverIdNumberFormInputField.addTextWatchers(recieverIdNumberTextWatcher); } else { - recieverNameFormInputField.removeTextWatchers(recieverNameTextWatcher); + recieverLocalNameFormInputField.removeTextWatchers(recieverNameTextWatcher); + recieverAccountNoFormInputField.removeTextWatchers(recieverAccountNoTextWatcher); + recieverFirstNameFormInputField.removeTextWatchers(recieverFirstNameTextWatcher); + recieverMiddleNameFormInputField.removeTextWatchers(recieverMiddleNameTextWatcher); + recieverLastNameFormInputField.removeTextWatchers(recieverLastNameTextWatcher); + recieverFirstNameLocalFormInputField.removeTextWatchers(recieverFirstNameLocalTextWatcher); + recieverMiddleNameLocalFormInputField.removeTextWatchers(recieverMiddleNameLocalTextWatcher); + recieverLastNameLocalFormInputField.removeTextWatchers(recieverLastNameLocalTextWatcher); + recieverLocalNameFormInputField.removeTextWatchers(recieverLocalNameTextWatcher); + recieverCityFormInputField.removeTextWatchers(recieverCityTextWatcher); + recieverAddressFormInputField.removeTextWatchers(recieverAddressTextWatcher); + recieverMobileNoFormInputField.removeTextWatchers(recieverMobileNoTextWatcher); + recieverEmailFormInputField.removeTextWatchers(recieverEmailTextWatcher); + recieverIdNumberFormInputField.removeTextWatchers(recieverIdNumberTextWatcher); } } private void registerClickListener(boolean action) { @@ -93,18 +232,31 @@ public class RecipientAddEditV3Activity extends BaseActivity implements Recipien { recieverCountrySelectionFormInputField.getEditTextView().setOnClickListener(new CountrySelectionClickListener()); recieverPaymentMethodSelectionFormInputField.getEditTextView().setOnClickListener(new PaymentMethodSelectionClickListener()); + recieverBankSelectionFormInputField.getEditTextView().setOnClickListener(new BankSelectionClickListener()); + recieverBranchSelectionFormInputField.getEditTextView().setOnClickListener(new BranchSelectionClickListener()); + recieverStateSelectionFormInputField.getEditTextView().setOnClickListener(new StateSelectionClickListener()); + recieverDistrictSelectionFormInputField.getEditTextView().setOnClickListener(new DistrictSelectionClickListener()); + recieverRelationSelectionFormInputField.getEditTextView().setOnClickListener(new RelationSelectionClickListener()); + recieverTransferReasonSelectionFormInputField.getEditTextView().setOnClickListener(new TransferReasonSelectionClickListener()); + recieverIDTypeSelectionFormInputField.getEditTextView().setOnClickListener(new IDTypeSelectionClickListener()); } else { recieverCountrySelectionFormInputField.getEditTextView().setOnClickListener(null); recieverPaymentMethodSelectionFormInputField.getEditTextView().setOnClickListener(null); + recieverBankSelectionFormInputField.getEditTextView().setOnClickListener(null); + recieverBranchSelectionFormInputField.getEditTextView().setOnClickListener(null); + recieverStateSelectionFormInputField.getEditTextView().setOnClickListener(null); + recieverDistrictSelectionFormInputField.getEditTextView().setOnClickListener(null); + recieverRelationSelectionFormInputField.getEditTextView().setOnClickListener(null); + recieverTransferReasonSelectionFormInputField.getEditTextView().setOnClickListener(null); + recieverIDTypeSelectionFormInputField.getEditTextView().setOnClickListener(null); } } @Override protected void onStart() { super.onStart(); - registerTextWatchers(true); registerClickListener(true); } @@ -113,7 +265,6 @@ public class RecipientAddEditV3Activity extends BaseActivity implements Recipien @Override protected void onStop() { super.onStop(); - registerTextWatchers(false); registerClickListener(false); @@ -121,23 +272,23 @@ public class RecipientAddEditV3Activity extends BaseActivity implements Recipien @Override public void updateValidationRuleToWidgetFullName(boolean showWidget, boolean shouldAllowSpecialCharacters, int maxLength) { - recieverNameFormInputField.setInputFilters(InputFilterFactory.getRequiredInputFilters(shouldAllowSpecialCharacters, maxLength)); + recieverLocalNameFormInputField.setInputFilters(InputFilterFactory.getRequiredInputFilters(shouldAllowSpecialCharacters, maxLength)); if (showWidget) { - recieverNameFormInputField.setVisibility(View.VISIBLE); + recieverLocalNameFormInputField.setVisibility(View.VISIBLE); } else - recieverNameFormInputField.setVisibility(GONE); + recieverLocalNameFormInputField.setVisibility(GONE); } @Override public void updateValueToWidgetFullName(String name) { - recieverNameFormInputField.removeTextWatchers(recieverNameTextWatcher); - recieverNameFormInputField.getEditTextView().setText(name); - recieverNameFormInputField.addTextWatchers(recieverNameTextWatcher); + recieverLocalNameFormInputField.removeTextWatchers(recieverNameTextWatcher); + recieverLocalNameFormInputField.getEditTextView().setText(name); + recieverLocalNameFormInputField.addTextWatchers(recieverNameTextWatcher); } @Override public void setErrorOnWidgetFullName(String error) { - recieverNameFormInputField.updateErrorSafely(error); + recieverLocalNameFormInputField.updateErrorSafely(error); } @@ -171,7 +322,23 @@ public class RecipientAddEditV3Activity extends BaseActivity implements Recipien @Override public void hideAllViewExceptCountry() { + hideViewFromIndexId(2); + + } + @Override + public void hideAllFormInputFields() { + hideViewFromIndexId(1); + } + + private void hideViewFromIndexId(int indexId) + { + if(indexId<0) + return; + for(int i = indexId; i< receiverFormViewContainer.getChildCount(); i++) + { + receiverFormViewContainer.getChildAt(i).setVisibility(GONE); + } } @Override @@ -227,10 +394,206 @@ public class RecipientAddEditV3Activity extends BaseActivity implements Recipien } } - public class RecipientNameTextWatcher extends TextWatcherAdapter { + public class BankSelectionClickListener implements View.OnClickListener + { + + @Override + public void onClick(View v) { + hideKeyBoard(); +// if (serviceMethodListingDialog == null) +// serviceMethodListingDialog = new GenericTextListingDialog<>(); +// serviceMethodListingDialog.setData(presenter.getAvailableServiceMethodList()); +// serviceMethodListingDialog.setListener(selectedPaymentMethod -> +// { +// presenter.onServiceTypeSelected(selectedPaymentMethod); +// serviceMethodListingDialog.dismiss(); +// }); +// serviceMethodListingDialog.setHintAndTitle("Search payment method", "Select payment method", "No payment method found."); +// serviceMethodListingDialog.disableSearch(false); +// if (!serviceMethodListingDialog.isAdded()) +// serviceMethodListingDialog.show(getSupportFragmentManager(), "PaymentMethodListingDialog"); + } + } + + public class BranchSelectionClickListener implements View.OnClickListener + { + + @Override + public void onClick(View v) { + hideKeyBoard(); +// if (serviceMethodListingDialog == null) +// serviceMethodListingDialog = new GenericTextListingDialog<>(); +// serviceMethodListingDialog.setData(presenter.getAvailableServiceMethodList()); +// serviceMethodListingDialog.setListener(selectedPaymentMethod -> +// { +// presenter.onServiceTypeSelected(selectedPaymentMethod); +// serviceMethodListingDialog.dismiss(); +// }); +// serviceMethodListingDialog.setHintAndTitle("Search payment method", "Select payment method", "No payment method found."); +// serviceMethodListingDialog.disableSearch(false); +// if (!serviceMethodListingDialog.isAdded()) +// serviceMethodListingDialog.show(getSupportFragmentManager(), "PaymentMethodListingDialog"); + } + } + + public class StateSelectionClickListener implements View.OnClickListener + { + + @Override + public void onClick(View v) { + hideKeyBoard(); +// if (serviceMethodListingDialog == null) +// serviceMethodListingDialog = new GenericTextListingDialog<>(); +// serviceMethodListingDialog.setData(presenter.getAvailableServiceMethodList()); +// serviceMethodListingDialog.setListener(selectedPaymentMethod -> +// { +// presenter.onServiceTypeSelected(selectedPaymentMethod); +// serviceMethodListingDialog.dismiss(); +// }); +// serviceMethodListingDialog.setHintAndTitle("Search payment method", "Select payment method", "No payment method found."); +// serviceMethodListingDialog.disableSearch(false); +// if (!serviceMethodListingDialog.isAdded()) +// serviceMethodListingDialog.show(getSupportFragmentManager(), "PaymentMethodListingDialog"); + } + } + public class DistrictSelectionClickListener implements View.OnClickListener + { + + @Override + public void onClick(View v) { + hideKeyBoard(); +// if (serviceMethodListingDialog == null) +// serviceMethodListingDialog = new GenericTextListingDialog<>(); +// serviceMethodListingDialog.setData(presenter.getAvailableServiceMethodList()); +// serviceMethodListingDialog.setListener(selectedPaymentMethod -> +// { +// presenter.onServiceTypeSelected(selectedPaymentMethod); +// serviceMethodListingDialog.dismiss(); +// }); +// serviceMethodListingDialog.setHintAndTitle("Search payment method", "Select payment method", "No payment method found."); +// serviceMethodListingDialog.disableSearch(false); +// if (!serviceMethodListingDialog.isAdded()) +// serviceMethodListingDialog.show(getSupportFragmentManager(), "PaymentMethodListingDialog"); + } + } + + public class RelationSelectionClickListener implements View.OnClickListener + { + + @Override + public void onClick(View v) { + hideKeyBoard(); +// if (serviceMethodListingDialog == null) +// serviceMethodListingDialog = new GenericTextListingDialog<>(); +// serviceMethodListingDialog.setData(presenter.getAvailableServiceMethodList()); +// serviceMethodListingDialog.setListener(selectedPaymentMethod -> +// { +// presenter.onServiceTypeSelected(selectedPaymentMethod); +// serviceMethodListingDialog.dismiss(); +// }); +// serviceMethodListingDialog.setHintAndTitle("Search payment method", "Select payment method", "No payment method found."); +// serviceMethodListingDialog.disableSearch(false); +// if (!serviceMethodListingDialog.isAdded()) +// serviceMethodListingDialog.show(getSupportFragmentManager(), "PaymentMethodListingDialog"); + } + } + + public class TransferReasonSelectionClickListener implements View.OnClickListener + { + + @Override + public void onClick(View v) { + hideKeyBoard(); +// if (serviceMethodListingDialog == null) +// serviceMethodListingDialog = new GenericTextListingDialog<>(); +// serviceMethodListingDialog.setData(presenter.getAvailableServiceMethodList()); +// serviceMethodListingDialog.setListener(selectedPaymentMethod -> +// { +// presenter.onServiceTypeSelected(selectedPaymentMethod); +// serviceMethodListingDialog.dismiss(); +// }); +// serviceMethodListingDialog.setHintAndTitle("Search payment method", "Select payment method", "No payment method found."); +// serviceMethodListingDialog.disableSearch(false); +// if (!serviceMethodListingDialog.isAdded()) +// serviceMethodListingDialog.show(getSupportFragmentManager(), "PaymentMethodListingDialog"); + } + } + + public class IDTypeSelectionClickListener implements View.OnClickListener + { + + @Override + public void onClick(View v) { + hideKeyBoard(); +// if (serviceMethodListingDialog == null) +// serviceMethodListingDialog = new GenericTextListingDialog<>(); +// serviceMethodListingDialog.setData(presenter.getAvailableServiceMethodList()); +// serviceMethodListingDialog.setListener(selectedPaymentMethod -> +// { +// presenter.onServiceTypeSelected(selectedPaymentMethod); +// serviceMethodListingDialog.dismiss(); +// }); +// serviceMethodListingDialog.setHintAndTitle("Search payment method", "Select payment method", "No payment method found."); +// serviceMethodListingDialog.disableSearch(false); +// if (!serviceMethodListingDialog.isAdded()) +// serviceMethodListingDialog.show(getSupportFragmentManager(), "PaymentMethodListingDialog"); + } + } + + + public class RecipientAccountNoTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + presenter.onRecipientAccountNoChanged(text); + } + } + + public class RecipientFirstNameTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + presenter.onRecipientFirstNameChanged(text); + } + } + + public class RecipientMiddleNameTextWatcher extends TextWatcherAdapter { @Override public void onTextUpdated(String text) { - presenter.onRecipientNameChanged(text); + presenter.onRecipientMiddleNameChanged(text); + } + } + + public class RecipientLastNameTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + presenter.onRecipientLastNameChanged(text); + } + } + + public class RecipientFirstNameLocalTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + presenter.onRecipientFirstNameLocalChanged(text); + } + } + + public class RecipientMiddleNameLocalTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + presenter.onRecipientMiddleNameLocalChanged(text); + } + } + + public class RecipientLastNameLocalTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + presenter.onRecipientLastNameLocalChanged(text); + } + } + + public class RecipientCityTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + presenter.onRecipientCityChanged(text); } } @@ -238,7 +601,38 @@ public class RecipientAddEditV3Activity extends BaseActivity implements Recipien public class RecipientAddressTextWatcher extends TextWatcherAdapter { @Override public void onTextUpdated(String text) { + presenter.onRecipientAddressChanged(text); + } + } + public class RecipientMobileNumberTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + presenter.onRecipientMobileNumberChanged(text); + } + } + + public class RecipientEmailTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + presenter.onRecipientEmailChanged(text); } } + + public class RecipientIdNumberTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + presenter.onRecipientIdNumberChanged(text); + + } + } + + public class RecipientLocalNameTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + presenter.onRecipientLocalNameChanged(text); + } + } + + } diff --git a/app/src/main/res/layout/activity_recipient_add_edit_v3.xml b/app/src/main/res/layout/activity_recipient_add_edit_v3.xml index 8879a301..30cabe64 100644 --- a/app/src/main/res/layout/activity_recipient_add_edit_v3.xml +++ b/app/src/main/res/layout/activity_recipient_add_edit_v3.xml @@ -13,6 +13,7 @@ android:layout_weight="1"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + app:edFormHint="City" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +