diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientlisting/view/recipientaddedit/BeneficiaryAddEditFragment.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientlisting/view/recipientaddedit/BeneficiaryAddEditFragment.java index 74f1056a..730ac01b 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientlisting/view/recipientaddedit/BeneficiaryAddEditFragment.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientlisting/view/recipientaddedit/BeneficiaryAddEditFragment.java @@ -110,13 +110,7 @@ public class BeneficiaryAddEditFragment extends BaseFragment implements Recipie initTextWatchers(); removeInputFiltersByDefault(); } - public String getPageTitle(){ - if (recipientToBeEdited != null) { - return getString(R.string.edit_recipient_text); - } else { - return getString(R.string.add_recipient_text); - } - } + private void removeInputFiltersByDefault() { binding.edReceiverPaymentMethodSelection.setFilters(new InputFilter[]{}); diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientlisting/view/recipientaddedit/RecipientAddEditActivity.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientlisting/view/recipientaddedit/RecipientAddEditActivity.java index 2f78c267..45d02772 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientlisting/view/recipientaddedit/RecipientAddEditActivity.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientlisting/view/recipientaddedit/RecipientAddEditActivity.java @@ -47,7 +47,6 @@ public class RecipientAddEditActivity extends BaseActivity implements RecipientA private BeneficiaryAddEditTermsFragment beneficiaryAddEditTermsFragment; private GenericViewPagerAdapter addBeneficiaryViewPagerAdapter; - private RecipientAddEditBaseViewModel viewModel; private ReceiverInfoModel recipientToBeEdited; @@ -75,16 +74,6 @@ public class RecipientAddEditActivity extends BaseActivity implements RecipientA private void init() { recipientToBeEdited = getIntent().getParcelableExtra(RECIPIENT_INFO_BUNDLE_KEY); - /* if (recipientToBeEdited != null) { - toolbarTitle.setText(getString(R.string.edit_recipient_text)); - RecipientEditViewModelFactory recipientEditViewModelFactory = new RecipientEditViewModelFactory(this,recipientToBeEdited); - viewModel = new ViewModelProvider(this, recipientEditViewModelFactory).get(RecipientEditViewModel.class); - } else { - toolbarTitle.setText(getString(R.string.add_recipient_text)); - RecipientAddViewModelFactory recipientAddViewModelFactory = new RecipientAddViewModelFactory(this,recipientToBeEdited); - viewModel = new ViewModelProvider(this, recipientAddViewModelFactory).get(RecipientAddViewModel.class); - }*/ - iv_cancel.setVisibility(View.INVISIBLE); } @@ -94,15 +83,21 @@ public class RecipientAddEditActivity extends BaseActivity implements RecipientA addBeneficiaryViewPagerAdapter = new GenericViewPagerAdapter(getSupportFragmentManager()); List fragments = new ArrayList<>(); + Bundle bundle = new Bundle(); + bundle.putParcelable(RECIPIENT_UPDATED_ID_BUNDLE_KEY, recipientToBeEdited); + beneficiaryAddEditFragment = new BeneficiaryAddEditFragment(); + beneficiaryAddEditFragment.setArguments(bundle); + beneficiaryAddEditTermsFragment = new BeneficiaryAddEditTermsFragment(); - beneficiaryAddEditTermsFragment.setArguments(bundle); + beneficiaryAddEditTermsFragment.setArguments(bundle); fragments.add(beneficiaryAddEditFragment); + fragments.add(beneficiaryAddEditTermsFragment); addBeneficiaryViewPagerAdapter.addFragments(fragments); diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddEditBaseV3Presenter.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddEditBaseV3ViewModel.java similarity index 89% rename from app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddEditBaseV3Presenter.java rename to app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddEditBaseV3ViewModel.java index 4b0e8738..33f9e069 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddEditBaseV3Presenter.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddEditBaseV3ViewModel.java @@ -4,6 +4,7 @@ import android.text.TextUtils; import com.swifttech.remit.jmecustomer.R; import com.swifttech.remit.jmecustomer.base.BasePresenter; +import com.swifttech.remit.jmecustomer.base.BaseViewModel; import com.swifttech.remit.jmecustomer.common.view.AnswerInputDialog; import com.swifttech.remit.jmecustomer.features.kyc.newCustomer.model.NativeCountry; import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientaddeditV3.countryservice.CountryServiceModel; @@ -19,13 +20,13 @@ import com.swifttech.remit.jmecustomer.features.sendmoney.model.payoutmode.BankB import java.util.List; -public abstract class RecipientAddEditBaseV3Presenter extends BasePresenter implements RecipientPresenterInterface { +public abstract class RecipientAddEditBaseV3ViewModel extends BaseViewModel implements RecipientPresenterInterface { protected final RecipientAddV3ContractInterface view; protected RecipientDetailValidatorV3 validator; - public RecipientAddEditBaseV3Presenter( + public RecipientAddEditBaseV3ViewModel( RecipientAddV3ContractInterface view, RecipientDetailValidatorV3 validator) { this.view = view; @@ -46,17 +47,17 @@ public abstract class RecipientAddEditBaseV3Presenter extends BasePresenter impl private void init() { - view.hideAllViewExceptCountry(); + view.getRecipientAddEditV3ContractInterface().hideAllViewExceptCountry(); } protected void applyValidationRulesToView(List data) { if (data != null) { - view.registerTextWatchers(false); + view.getRecipientAddEditV3ContractInterface().registerTextWatchers(false); validator.clearValidationRule(); for (ValidationRuleModel rule : data) { validator.applyDynamicValidationRuleToView(rule); } - view.registerTextWatchers(true); + view.getRecipientAddEditV3ContractInterface().registerTextWatchers(true); } } @@ -85,7 +86,7 @@ public abstract class RecipientAddEditBaseV3Presenter extends BasePresenter impl @Override public void onTransferReasonSelected(DropDownDTO selectedTransferReason) { if (shouldPromptToInputAnswer(selectedTransferReason)) { - view.promptToInputAnswer(view.getContext().getResources().getString(R.string.specifyPurposeOfRemit_text), new AnswerInputDialog.AnswerInputDialogListener() { + view.getRecipientAddEditV3ContractInterface().promptToInputAnswer(view.getContext().getResources().getString(R.string.specifyPurposeOfRemit_text), new AnswerInputDialog.AnswerInputDialogListener() { @Override public void onAnswerSubmitted(String answer) { validator.updateTransfer(DropDownDTO.createFromUserAnswerInput(answer)); @@ -104,7 +105,7 @@ public abstract class RecipientAddEditBaseV3Presenter extends BasePresenter impl @Override public void onRelationSelected(DropDownDTO selectedRelation) { if (shouldPromptToInputAnswer(selectedRelation)) { - view.promptToInputAnswer(view.getContext().getResources().getString(R.string.specifyYourRelation_text), new AnswerInputDialog.AnswerInputDialogListener() { + view.getRecipientAddEditV3ContractInterface().promptToInputAnswer(view.getContext().getResources().getString(R.string.specifyYourRelation_text), new AnswerInputDialog.AnswerInputDialogListener() { @Override public void onAnswerSubmitted(String answer) { validator.updateRelation(DropDownDTO.createFromUserAnswerInput(answer)); @@ -261,6 +262,16 @@ public abstract class RecipientAddEditBaseV3Presenter extends BasePresenter impl validator.updateNativeCountry(selectedNativeCountry); } + @Override + public void proceedToEditSucess() { + + } + + @Override + public void proceedToAddSucess() { + + } + private boolean shouldPromptToInputAnswer(DropDownDTO optionType) { return (optionType != null && ("Other (Please specify)".equalsIgnoreCase(optionType.getText()))); } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddV3ContractInterface.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddV3ContractInterface.java index ec79c51a..d0b84d46 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddV3ContractInterface.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddV3ContractInterface.java @@ -2,6 +2,7 @@ package com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.r import com.swifttech.remit.jmecustomer.base.BaseContractInterface; import com.swifttech.remit.jmecustomer.common.customwidgets.common.GenericPromptDialog; +import com.swifttech.remit.jmecustomer.features.recipientlisting.presenter.recipientaddedit.RecipientAddContractInterface; import com.swifttech.remit.jmecustomer.features.recipientmanagement.utils.EditTextConfigurationFactory; import com.swifttech.remit.jmecustomer.common.view.AnswerInputDialog; import com.swifttech.remit.jmecustomer.features.sendmoney.model.SendMoneyRequiredDataV3; @@ -9,219 +10,229 @@ import com.swifttech.remit.jmecustomer.features.sendmoney.model.SendMoneyRequire public interface RecipientAddV3ContractInterface extends BaseContractInterface { - void registerTextWatchers(boolean action); + void onEditSuccess(String recipientIdToBeUpdated); - void setSubmitButtonEnabled(boolean action); + void onAddSuccess(String recipientIdToBeUpdated); - void hideAllViewExceptCountry(); + void showTermsAndConditionScreen(); - void promptToSendMoney(GenericPromptDialog.GenericDialogPromptListener listener, String message); + RecipientAddEditV3ContractInterface getRecipientAddEditV3ContractInterface(); - void hideAllFormFieldsExceptCountryAndPaymentMethod(); + interface RecipientAddEditV3ContractInterface extends BaseContractInterface { - void redirectToSendMoney(SendMoneyRequiredDataV3 sendMoneyRequiredDataV3); + void registerTextWatchers(boolean action); - void updateValueToWidgetSelectedCountry(String countryName); + void setSubmitButtonEnabled(boolean action); - void showSelectedCountryFlag(int id); + void hideAllViewExceptCountry(); - void updateValueToWidgetSelectedPaymentMethod(String description); + void promptToSendMoney(GenericPromptDialog.GenericDialogPromptListener listener, String message); - void showCountrySelectionView(boolean visiblity); - void showPaymentSelectionView(boolean visiblity); + void hideAllFormFieldsExceptCountryAndPaymentMethod(); - void updateValidationRuleToWidgetPaymentMethodSelection(boolean visiblity); + void redirectToSendMoney(SendMoneyRequiredDataV3 sendMoneyRequiredDataV3); + void updateValueToWidgetSelectedCountry(String countryName); - void updateValueToWidgetBankName(String value); + void showSelectedCountryFlag(int id); - void updateValueToWidgetBranchName(String value); + void updateValueToWidgetSelectedPaymentMethod(String description); - void updateValueToWidgetAccountNo(String value); + void showCountrySelectionView(boolean visiblity); + void showPaymentSelectionView(boolean visiblity); - void updateValueToWidgetIDType(String value); + void updateValidationRuleToWidgetPaymentMethodSelection(boolean visiblity); - void updateValueToWidgetIDNumber(String value); + void updateValueToWidgetBankName(String value); - void updateValueToWidgetFirstName(String value); + void updateValueToWidgetBranchName(String value); - void updateValueToWidgetMiddleName(String value); + void updateValueToWidgetAccountNo(String value); - void updateValueToWidgetLastName(String value); + void updateValueToWidgetIDType(String value); - void updateValueToWidgetFullName(String value); + void updateValueToWidgetIDNumber(String value); - void updateValueToWidgetLocalFirstName(String value); + void updateValueToWidgetFirstName(String value); - void updateValueToWidgetLocalMiddleName(String value); + void updateValueToWidgetMiddleName(String value); - void updateValueToWidgetLocalLastName(String value); + void updateValueToWidgetLastName(String value); - void updateValueToWidgetLocalFullName(String name); + void updateValueToWidgetFullName(String value); - void updateValueToWidgetMobileNumber(String value); + void updateValueToWidgetLocalFirstName(String value); - void updateValueToWidgetProvince(String value); + void updateValueToWidgetLocalMiddleName(String value); - void updateValueToWidgetDistrict(String value); + void updateValueToWidgetLocalLastName(String value); - void updateValueToWidgetCity(String value); + void updateValueToWidgetLocalFullName(String name); - void updateValueToWidgetAddress(String value); - void updateValueToWidgetRelation(String value); + void updateValueToWidgetMobileNumber(String value); - void updateValueToWidgetTransferReason(String value); + void updateValueToWidgetProvince(String value); - void updateValueToWidgetNativeCountry(String nativeCountry); + void updateValueToWidgetDistrict(String value); + void updateValueToWidgetCity(String value); + void updateValueToWidgetAddress(String value); - void updateValidationRuleToWidgetBankName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); + void updateValueToWidgetRelation(String value); - void updateValidationRuleToWidgetBranchName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); + void updateValueToWidgetTransferReason(String value); - void updateValidationRuleToWidgetAccountNo(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); + void updateValueToWidgetNativeCountry(String nativeCountry); - void updateValidationRuleToWidgetIDType(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); - void updateValidationRuleToWidgetIDNumber(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); - void updateValidationRuleToWidgetFirstName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); + void updateValidationRuleToWidgetBankName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); - void updateValidationRuleToWidgetMiddleName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); + void updateValidationRuleToWidgetBranchName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); - void updateValidationRuleToWidgetLastName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); + void updateValidationRuleToWidgetAccountNo(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); + void updateValidationRuleToWidgetIDType(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); + void updateValidationRuleToWidgetIDNumber(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); - void updateValidationRuleToWidgetFullName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); + void updateValidationRuleToWidgetFirstName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); - void updateValidationRuleToWidgetLocalFirstName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); + void updateValidationRuleToWidgetMiddleName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); - void updateValidationRuleToWidgetLocalMiddleName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); + void updateValidationRuleToWidgetLastName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); - void updateValidationRuleToWidgetLocalLastName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); - void updateValidationRuleToWidgetLocalFullName(boolean visiblity, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration); + void updateValidationRuleToWidgetFullName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); - void updateValidationRuleToWidgetMobileNumber(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); + void updateValidationRuleToWidgetLocalFirstName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); - void updateValidationRuleToWidgetProvince(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); + void updateValidationRuleToWidgetLocalMiddleName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); - void updateValidationRuleToWidgetDistrict(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); + void updateValidationRuleToWidgetLocalLastName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); - void updateValidationRuleToWidgetCity(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); + void updateValidationRuleToWidgetLocalFullName(boolean visiblity, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration); - void updateValidationRuleToWidgetAddress(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); - void updateValidationRuleToWidgetRelation(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); + void updateValidationRuleToWidgetMobileNumber(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); - void updateValidationRuleToWidgetTransferReason(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); + void updateValidationRuleToWidgetProvince(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); - void updateValidationRuleToWidgetEmail(boolean isFieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); + void updateValidationRuleToWidgetDistrict(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); - void updateValidationRuleToWidgetNativeCountry(boolean isFieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); + void updateValidationRuleToWidgetCity(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); + void updateValidationRuleToWidgetAddress(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); + void updateValidationRuleToWidgetRelation(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); - void setErrorOnWidgetBank(String message); + void updateValidationRuleToWidgetTransferReason(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); - void setErrorOnWidgetAccountNo(String error); + void updateValidationRuleToWidgetEmail(boolean isFieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); - void setErrorOnWidgetFirstName(String error); + void updateValidationRuleToWidgetNativeCountry(boolean isFieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword); - void setErrorOnWidgetMiddleName(String error); - void setErrorOnWidgetLastName(String error); - void setErrorOnWidgetFullName(String error); + void setErrorOnWidgetBank(String message); - void setErrorOnWidgetCity(String error); + void setErrorOnWidgetAccountNo(String error); - void setErrorOnWidgetAddress(String error); + void setErrorOnWidgetFirstName(String error); - void setErrorOnWidgetMobileNumber(String error); + void setErrorOnWidgetMiddleName(String error); - void setErrorOnWidgetEmail(String error); + void setErrorOnWidgetLastName(String error); - void setErrorOnWidgetIDNumber(String error); + void setErrorOnWidgetFullName(String error); - void setErrorOnWidgetLocalFirstName(String error); + void setErrorOnWidgetCity(String error); - void setErrorOnWidgetLocalMiddleName(String error); + void setErrorOnWidgetAddress(String error); - void setErrorOnWidgetLocalLastName(String error); + void setErrorOnWidgetMobileNumber(String error); - void setErrorOnWidgetLocalFullName(String error); + void setErrorOnWidgetEmail(String error); + void setErrorOnWidgetIDNumber(String error); + void setErrorOnWidgetLocalFirstName(String error); - void showMobilePrefixAndFlag(String prefix,int flag); + void setErrorOnWidgetLocalMiddleName(String error); - void onEditSuccess(String recipientIdToBeUpdated); + void setErrorOnWidgetLocalLastName(String error); - void onAddSuccess(String recipientIdToBeUpdated); + void setErrorOnWidgetLocalFullName(String error); + + + + void showMobilePrefixAndFlag(String prefix,int flag); + + + + void scrollAccountNumberView(); - void scrollAccountNumberView(); + void clearViewDependentOnServiceType(); - void clearViewDependentOnServiceType(); + void clearViewDependentOnCountryServiceSelected(); - void clearViewDependentOnCountryServiceSelected(); + void showNativeCountryFlag(int flagFromCountryCode); - void showNativeCountryFlag(int flagFromCountryCode); + void updateValueToWidgetEmail(String email); - void updateValueToWidgetEmail(String email); + void addOptionalAsHintToWidgetBankName(Boolean isOptional); - void addOptionalAsHintToWidgetBankName(Boolean isOptional); + void addOptionalAsHintToWidgetBranch(Boolean isOptional); - void addOptionalAsHintToWidgetBranch(Boolean isOptional); + void addOptionalAsHintToWidgetAccountNumber(Boolean isOptional); - void addOptionalAsHintToWidgetAccountNumber(Boolean isOptional); + void addOptionalAsHintToWidgetIDType(Boolean isOptional); - void addOptionalAsHintToWidgetIDType(Boolean isOptional); + void addOptionalAsHintToWidgetIDNumber(Boolean isOptional); - void addOptionalAsHintToWidgetIDNumber(Boolean isOptional); + void addOptionalAsHintToWidgetFirstName(Boolean isOptional); - void addOptionalAsHintToWidgetFirstName(Boolean isOptional); + void addOptionalAsHintToWidgetMiddleName(Boolean isOptional); - void addOptionalAsHintToWidgetMiddleName(Boolean isOptional); + void addOptionalAsHintToWidgetLastName(Boolean isOptional); - void addOptionalAsHintToWidgetLastName(Boolean isOptional); + void addOptionalAsHintToWidgetFullName(Boolean isOptional); - void addOptionalAsHintToWidgetFullName(Boolean isOptional); + void addOptionalAsHintToWidgetLocalFirstName(Boolean isOptional); - void addOptionalAsHintToWidgetLocalFirstName(Boolean isOptional); + void addOptionalAsHintToWidgetLocalMiddleName(Boolean isOptional); - void addOptionalAsHintToWidgetLocalMiddleName(Boolean isOptional); + void addOptionalAsHintToWidgetLocalLastName(Boolean isOptional); - void addOptionalAsHintToWidgetLocalLastName(Boolean isOptional); + void addOptionalAsHintToWidgetLocalFullName(Boolean isOptional); - void addOptionalAsHintToWidgetLocalFullName(Boolean isOptional); + void addOptionalAsHintToWidgetMobileNumber(Boolean isOptional); - void addOptionalAsHintToWidgetMobileNumber(Boolean isOptional); + void addOptionalAsHintToWidgetProvince(Boolean isOptional); - void addOptionalAsHintToWidgetProvince(Boolean isOptional); + void addOptionalAsHintToWidgetDistrict(Boolean isOptional); - void addOptionalAsHintToWidgetDistrict(Boolean isOptional); + void addOptionalAsHintToWidgetCity(Boolean isOptional); - void addOptionalAsHintToWidgetCity(Boolean isOptional); + void addOptionalAsHintToWidgetAddress(Boolean isOptional); - void addOptionalAsHintToWidgetAddress(Boolean isOptional); + void addOptionalAsHintToWidgetRelation(Boolean isOptional); - void addOptionalAsHintToWidgetRelation(Boolean isOptional); + void addOptionalAsHintToWidgetTransferReason(Boolean isOptional); - void addOptionalAsHintToWidgetTransferReason(Boolean isOptional); + void addOptionalAsHintToWidgetEmail(Boolean isOptional); - void addOptionalAsHintToWidgetEmail(Boolean isOptional); + void addOptionalAsHintToWidgetNativeCountry(Boolean isOptional); - void addOptionalAsHintToWidgetNativeCountry(Boolean isOptional); + void promptToInputAnswer(String question, AnswerInputDialog.AnswerInputDialogListener listener); - void promptToInputAnswer(String question, AnswerInputDialog.AnswerInputDialogListener listener); + } } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientPresenterInterface.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientPresenterInterface.java index 678b4804..543b6ea1 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientPresenterInterface.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientPresenterInterface.java @@ -28,6 +28,9 @@ public interface RecipientPresenterInterface extends BasePresenterInterface { void onIDTypeSelected(DropDownDTO selectedIDType); void onRelationSelected(DropDownDTO selectedRelation); + void proceedToEditSucess(); + void proceedToAddSucess(); + WebRequestModel getWebRequestDataForTermsAndCondition(); diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/add/RecipientAddV3Presenter.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/add/RecipientAddV3ViewModel.java similarity index 90% rename from app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/add/RecipientAddV3Presenter.java rename to app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/add/RecipientAddV3ViewModel.java index cfde4aab..3fb56555 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/add/RecipientAddV3Presenter.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/add/RecipientAddV3ViewModel.java @@ -12,7 +12,7 @@ import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipi import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientaddeditV3.dynamicvalidation.DynamicValidationModel; import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientaddeditV3.dynamicvalidation.PaymentBankModel; import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientlistingV3.ReceiverInfoV3Model; -import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.RecipientAddEditBaseV3Presenter; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.RecipientAddEditBaseV3ViewModel; import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.RecipientAddV3ContractInterface; import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.RecipientDetailValidatorV3; import com.swifttech.remit.jmecustomer.features.sendmoney.model.SendMoneyRequiredDataV3; @@ -36,13 +36,13 @@ import static com.swifttech.remit.jmecustomer.utils.Constants.JME_TERMS_N_CONDIT /** * Add Beneficiary Use Case, override any base class callback to adjust withCountdownTimer the add use case flow. Base case will handle default flow. */ -public class RecipientAddV3Presenter extends RecipientAddEditBaseV3Presenter { +public class RecipientAddV3ViewModel extends RecipientAddEditBaseV3ViewModel { private final RecipientAddEditV3GatewayInterface gateway; private final CompositeDisposable compositeDisposable; - public RecipientAddV3Presenter( + public RecipientAddV3ViewModel( RecipientAddEditV3GatewayInterface gateway, RecipientAddV3ContractInterface view, ReceiverInfoV3Model receiverInfoV3Model @@ -104,9 +104,9 @@ public class RecipientAddV3Presenter extends RecipientAddEditBaseV3Presenter { public void onCountryServiceSelected(CountryServiceModel selectedCountry) { validator.clearMobileNumberPrefixAndUpdate(); validator.updateSelectedCountry(selectedCountry); - view.showMobilePrefixAndFlag(gateway.getMobilePrefixFromCountryCode(validator.getRecipientDetail().getCountryCode()), CountryFlagMapper.getFlagFromCountryCode(validator.getRecipientDetail().getCountryCode())); + view.getRecipientAddEditV3ContractInterface().showMobilePrefixAndFlag(gateway.getMobilePrefixFromCountryCode(validator.getRecipientDetail().getCountryCode()), CountryFlagMapper.getFlagFromCountryCode(validator.getRecipientDetail().getCountryCode())); - view.showPaymentSelectionView(true); + view.getRecipientAddEditV3ContractInterface().showPaymentSelectionView(true); } @@ -223,6 +223,16 @@ public class RecipientAddV3Presenter extends RecipientAddEditBaseV3Presenter { } + @Override + public void onViewReady() { + + } + + @Override + public void onViewNotReady() { + + } + public class DynamicListObserver extends GenericApiObserverResponseV2 { @@ -242,8 +252,8 @@ public class RecipientAddV3Presenter extends RecipientAddEditBaseV3Presenter { } else { validator.getRecipientDetail().setPaymentMethod(null); - view.updateValueToWidgetSelectedPaymentMethod(null); - view.setSubmitButtonEnabled(false); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetSelectedPaymentMethod(null); + view.getRecipientAddEditV3ContractInterface().setSubmitButtonEnabled(false); view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null); } @@ -252,8 +262,8 @@ public class RecipientAddV3Presenter extends RecipientAddEditBaseV3Presenter { @Override public void onFailed(String message) { validator.getRecipientDetail().setPaymentMethod(null); - view.updateValueToWidgetSelectedPaymentMethod(null); - view.setSubmitButtonEnabled(false); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetSelectedPaymentMethod(null); + view.getRecipientAddEditV3ContractInterface().setSubmitButtonEnabled(false); view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); } @@ -261,8 +271,8 @@ public class RecipientAddV3Presenter extends RecipientAddEditBaseV3Presenter { @Override protected void onConnectionNotEstablished(String message) { validator.getRecipientDetail().setPaymentMethod(null); - view.updateValueToWidgetSelectedPaymentMethod(null); - view.setSubmitButtonEnabled(false); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetSelectedPaymentMethod(null); + view.getRecipientAddEditV3ContractInterface().setSubmitButtonEnabled(false); view.showPopUpMessage(message, CustomAlertDialog.AlertType.NO_INTERNET, null); } @@ -285,7 +295,7 @@ public class RecipientAddV3Presenter extends RecipientAddEditBaseV3Presenter { protected void onSuccess(GenericResponseDataModel> t) { if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { validator.updateAvailableCountryServiceData(t.getData()); - view.showCountrySelectionView(true); + view.getRecipientAddEditV3ContractInterface().showCountrySelectionView(true); } else { view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, alertType -> view.exitView()); @@ -320,7 +330,7 @@ public class RecipientAddV3Presenter extends RecipientAddEditBaseV3Presenter { protected void onSuccess(GenericResponseDataModel t) { if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { String send_money_to_string = t.getMsg()+" \n "+getStringfromStringId(R.string.recipient_add_success_message_text).replace("xxx", getReceiverName(t.getData())); - view.promptToSendMoney(new GenericPromptDialog.GenericDialogPromptListener() { + view.getRecipientAddEditV3ContractInterface().promptToSendMoney(new GenericPromptDialog.GenericDialogPromptListener() { @Override public void onNegativeBtnPressed() { view.onAddSuccess(t.getData().getReceiverId()); @@ -329,7 +339,7 @@ public class RecipientAddV3Presenter extends RecipientAddEditBaseV3Presenter { @Override public void onPositiveBtnPressed() { SendMoneyRequiredDataV3 sendMoneyRequiredDataV3=new SendMoneyRequiredDataV3(t.getData()); - view.redirectToSendMoney(sendMoneyRequiredDataV3); + view.getRecipientAddEditV3ContractInterface().redirectToSendMoney(sendMoneyRequiredDataV3); } }, send_money_to_string); return; @@ -362,13 +372,13 @@ public class RecipientAddV3Presenter extends RecipientAddEditBaseV3Presenter { @Override protected void onSuccess(AccountValidationApiResponse accountValidationApiResponse) { if (accountValidationApiResponse.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { - view.setErrorOnWidgetAccountNo(null); + view.getRecipientAddEditV3ContractInterface().setErrorOnWidgetAccountNo(null); updateRecipientInfo(); } else { - view.setErrorOnWidgetAccountNo(accountValidationApiResponse.getMsg()); - view.scrollAccountNumberView(); + view.getRecipientAddEditV3ContractInterface().setErrorOnWidgetAccountNo(accountValidationApiResponse.getMsg()); + view.getRecipientAddEditV3ContractInterface().scrollAccountNumberView(); } } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/edit/RecipientEditV3Presenter.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/edit/RecipientEditV3ViewModel.java similarity index 76% rename from app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/edit/RecipientEditV3Presenter.java rename to app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/edit/RecipientEditV3ViewModel.java index 5e68ab9b..7e9d688e 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/edit/RecipientEditV3Presenter.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/edit/RecipientEditV3ViewModel.java @@ -17,7 +17,7 @@ import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipi import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientlistingV3.AgentV3Model; import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientlistingV3.BranchV3Model; import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientlistingV3.ReceiverInfoV3Model; -import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.RecipientAddEditBaseV3Presenter; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.RecipientAddEditBaseV3ViewModel; import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.RecipientAddV3ContractInterface; import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.RecipientDetailValidatorV3; import com.swifttech.remit.jmecustomer.features.sendmoney.model.SendMoneyRequiredDataV3; @@ -44,13 +44,13 @@ import static com.swifttech.remit.jmecustomer.utils.Constants.JME_TERMS_N_CONDIT /** * Edit Beneficiary Use Case, override any base class callback to adjust withCountdownTimer the edit use case flow. Base case will handle default flow. */ -public class RecipientEditV3Presenter extends RecipientAddEditBaseV3Presenter { +public class RecipientEditV3ViewModel extends RecipientAddEditBaseV3ViewModel { private final RecipientAddEditV3GatewayInterface gateway; private final CompositeDisposable compositeDisposable; private final boolean hasPartnerChanged; - public RecipientEditV3Presenter( + public RecipientEditV3ViewModel( RecipientAddEditV3GatewayInterface gateway, RecipientAddV3ContractInterface view, ReceiverInfoV3Model receiverInfoV3Model @@ -87,7 +87,7 @@ public class RecipientEditV3Presenter extends RecipientAddEditBaseV3Presenter { public void onCountryServiceSelected(CountryServiceModel selectedCountry) { validator.clearMobileNumberPrefixAndUpdate(); validator.updateSelectedCountry(selectedCountry); - view.showMobilePrefixAndFlag(gateway.getMobilePrefixFromCountryCode(validator.getRecipientDetail().getCountryCode()), CountryFlagMapper.getFlagFromCountryCode(validator.getRecipientDetail().getCountryCode())); + view.getRecipientAddEditV3ContractInterface().showMobilePrefixAndFlag(gateway.getMobilePrefixFromCountryCode(validator.getRecipientDetail().getCountryCode()), CountryFlagMapper.getFlagFromCountryCode(validator.getRecipientDetail().getCountryCode())); } @@ -97,6 +97,8 @@ public class RecipientEditV3Presenter extends RecipientAddEditBaseV3Presenter { getDynamicValidationAndDropDownList(validator.getRecipientDetail().getCountryId(), selectedServiceType.getId()); } + + @Override public WebRequestModel getWebRequestDataForTermsAndCondition() { return new WebRequestModel(getStringfromStringId(R.string.terms_and_condition_title_text), JME_TERMS_N_CONDITIONS, null); @@ -231,55 +233,55 @@ public class RecipientEditV3Presenter extends RecipientAddEditBaseV3Presenter { private void seedExistingDatatoView() { - view.updateValueToWidgetSelectedCountry(validator.getRecipientDetail().getCountry()); - view.showSelectedCountryFlag(CountryFlagMapper.getFlagFromCountryCode(validator.getRecipientDetail().getCountryCode())); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetSelectedCountry(validator.getRecipientDetail().getCountry()); + view.getRecipientAddEditV3ContractInterface().showSelectedCountryFlag(CountryFlagMapper.getFlagFromCountryCode(validator.getRecipientDetail().getCountryCode())); if (validator.getRecipientDetail().getNativeCountry() != null && !TextUtils.isEmpty(validator.getRecipientDetail().getNativeCountry())) { - view.updateValueToWidgetNativeCountry(validator.getRecipientDetail().getNativeCountry()); - view.showNativeCountryFlag(CountryFlagMapper.getFlagFromCountryCode(validator.getRecipientDetail().getNativeCountryCode())); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetNativeCountry(validator.getRecipientDetail().getNativeCountry()); + view.getRecipientAddEditV3ContractInterface().showNativeCountryFlag(CountryFlagMapper.getFlagFromCountryCode(validator.getRecipientDetail().getNativeCountryCode())); } else { - view.updateValueToWidgetNativeCountry(validator.getSelectedCountryServiceData().getCountryName()); - view.showNativeCountryFlag(CountryFlagMapper.getFlagFromCountryCode(validator.getSelectedCountryServiceData().getCountryCode())); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetNativeCountry(validator.getSelectedCountryServiceData().getCountryName()); + view.getRecipientAddEditV3ContractInterface().showNativeCountryFlag(CountryFlagMapper.getFlagFromCountryCode(validator.getSelectedCountryServiceData().getCountryCode())); } if (validator.getRecipientDetail().getPaymentMethod() != null) - view.updateValueToWidgetSelectedPaymentMethod(validator.getRecipientDetail().getPaymentMethod().getName()); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetSelectedPaymentMethod(validator.getRecipientDetail().getPaymentMethod().getName()); - view.updateValueToWidgetIDNumber(validator.getRecipientDetail().getIdNumber()); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetIDNumber(validator.getRecipientDetail().getIdNumber()); - view.updateValueToWidgetFirstName(validator.getRecipientDetail().getFirstName()); - view.updateValueToWidgetMiddleName(validator.getRecipientDetail().getMiddleName()); - view.updateValueToWidgetLastName(validator.getRecipientDetail().getLastName()); - view.updateValueToWidgetFullName(validator.getRecipientDetail().getFullName()); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetFirstName(validator.getRecipientDetail().getFirstName()); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetMiddleName(validator.getRecipientDetail().getMiddleName()); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetLastName(validator.getRecipientDetail().getLastName()); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetFullName(validator.getRecipientDetail().getFullName()); - view.updateValueToWidgetLocalFirstName(validator.getRecipientDetail().getLocalFirstName()); - view.updateValueToWidgetLocalMiddleName(validator.getRecipientDetail().getLocalMiddleName()); - view.updateValueToWidgetLocalLastName(validator.getRecipientDetail().getLocalLastName()); - view.updateValueToWidgetLocalFullName(validator.getRecipientDetail().getLocalFullName()); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetLocalFirstName(validator.getRecipientDetail().getLocalFirstName()); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetLocalMiddleName(validator.getRecipientDetail().getLocalMiddleName()); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetLocalLastName(validator.getRecipientDetail().getLocalLastName()); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetLocalFullName(validator.getRecipientDetail().getLocalFullName()); - view.updateValueToWidgetMobileNumber(removePrefixFromSelectedMobileNumber(validator.getRecipientDetail().getMobile(), validator.getRecipientDetail().getCountryCode())); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetMobileNumber(removePrefixFromSelectedMobileNumber(validator.getRecipientDetail().getMobile(), validator.getRecipientDetail().getCountryCode())); - view.updateValueToWidgetAddress(validator.getRecipientDetail().getAddress()); - view.updateValueToWidgetCity(validator.getRecipientDetail().getCity()); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetAddress(validator.getRecipientDetail().getAddress()); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetCity(validator.getRecipientDetail().getCity()); - view.updateValueToWidgetEmail(validator.getRecipientDetail().getEmail()); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetEmail(validator.getRecipientDetail().getEmail()); AgentV3Model selectedAgent = validator.getRecipientDetail().getAgent(); if (selectedAgent != null) { - view.updateValueToWidgetBankName(validator.getRecipientDetail().getAgent().getName()); - view.updateValueToWidgetAccountNo(selectedAgent.getAccountNo()); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetBankName(validator.getRecipientDetail().getAgent().getName()); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetAccountNo(selectedAgent.getAccountNo()); BranchV3Model branchV3Model = selectedAgent.getBranch(); if (branchV3Model != null) - view.updateValueToWidgetBranchName(branchV3Model.getName()); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetBranchName(branchV3Model.getName()); } - view.updateValueToWidgetIDType(validator.getRecipientDetail().getIdType()); - view.updateValueToWidgetProvince(validator.getRecipientDetail().getState()); - view.updateValueToWidgetDistrict(validator.getRecipientDetail().getDistrict()); - view.updateValueToWidgetRelation(validator.getRecipientDetail().getRelationship()); - view.updateValueToWidgetTransferReason(validator.getRecipientDetail().getPurposeOfRemit()); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetIDType(validator.getRecipientDetail().getIdType()); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetProvince(validator.getRecipientDetail().getState()); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetDistrict(validator.getRecipientDetail().getDistrict()); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetRelation(validator.getRecipientDetail().getRelationship()); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetTransferReason(validator.getRecipientDetail().getPurposeOfRemit()); } @@ -310,6 +312,16 @@ public class RecipientEditV3Presenter extends RecipientAddEditBaseV3Presenter { return name; } + @Override + public void onViewReady() { + + } + + @Override + public void onViewNotReady() { + + } + public class DynamicListObserver extends GenericApiObserverResponseV2 { @@ -331,8 +343,8 @@ public class RecipientEditV3Presenter extends RecipientAddEditBaseV3Presenter { } else { validator.getRecipientDetail().setPaymentMethod(null); - view.updateValueToWidgetSelectedPaymentMethod(null); - view.setSubmitButtonEnabled(false); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetSelectedPaymentMethod(null); + view.getRecipientAddEditV3ContractInterface().setSubmitButtonEnabled(false); view.showPopUpMessage(data.getMsg(), CustomAlertDialog.AlertType.FAILED, null); } } @@ -340,8 +352,8 @@ public class RecipientEditV3Presenter extends RecipientAddEditBaseV3Presenter { @Override public void onFailed(String message) { validator.getRecipientDetail().setPaymentMethod(null); - view.updateValueToWidgetSelectedPaymentMethod(null); - view.setSubmitButtonEnabled(false); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetSelectedPaymentMethod(null); + view.getRecipientAddEditV3ContractInterface().setSubmitButtonEnabled(false); view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, alertType -> view.exitView()); } @@ -349,8 +361,8 @@ public class RecipientEditV3Presenter extends RecipientAddEditBaseV3Presenter { @Override protected void onConnectionNotEstablished(String message) { validator.getRecipientDetail().setPaymentMethod(null); - view.updateValueToWidgetSelectedPaymentMethod(null); - view.setSubmitButtonEnabled(false); + view.getRecipientAddEditV3ContractInterface().updateValueToWidgetSelectedPaymentMethod(null); + view.getRecipientAddEditV3ContractInterface().setSubmitButtonEnabled(false); view.showPopUpMessage(message, CustomAlertDialog.AlertType.NO_INTERNET, alertType -> view.exitView()); } @@ -384,9 +396,9 @@ public class RecipientEditV3Presenter extends RecipientAddEditBaseV3Presenter { getDynamicValidationAndDropDownList(countryId, serviceTypeID); } seedExistingDatatoView(); - view.showMobilePrefixAndFlag(gateway.getMobilePrefixFromCountryCode(validator.getRecipientDetail().getCountryCode()), CountryFlagMapper.getFlagFromCountryCode(validator.getRecipientDetail().getCountryCode())); - view.showCountrySelectionView(true); - view.showPaymentSelectionView(true); + view.getRecipientAddEditV3ContractInterface().showMobilePrefixAndFlag(gateway.getMobilePrefixFromCountryCode(validator.getRecipientDetail().getCountryCode()), CountryFlagMapper.getFlagFromCountryCode(validator.getRecipientDetail().getCountryCode())); + view.getRecipientAddEditV3ContractInterface().showCountrySelectionView(true); + view.getRecipientAddEditV3ContractInterface().showPaymentSelectionView(true); } else { view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, alertType -> view.exitView()); @@ -423,7 +435,7 @@ public class RecipientEditV3Presenter extends RecipientAddEditBaseV3Presenter { protected void onSuccess(GenericResponseDataModel t) { if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { String send_money_to_string = t.getMsg() + " \n " + getStringfromStringId(R.string.recipient_add_success_message_text).replace("xxx", getReceiverName(t.getData())); - view.promptToSendMoney(new GenericPromptDialog.GenericDialogPromptListener() { + view.getRecipientAddEditV3ContractInterface().promptToSendMoney(new GenericPromptDialog.GenericDialogPromptListener() { @Override public void onNegativeBtnPressed() { view.onEditSuccess(t.getData().getReceiverId()); @@ -432,7 +444,7 @@ public class RecipientEditV3Presenter extends RecipientAddEditBaseV3Presenter { @Override public void onPositiveBtnPressed() { SendMoneyRequiredDataV3 sendMoneyRequiredDataV3 = new SendMoneyRequiredDataV3(t.getData()); - view.redirectToSendMoney(sendMoneyRequiredDataV3); + view.getRecipientAddEditV3ContractInterface().redirectToSendMoney(sendMoneyRequiredDataV3); } }, send_money_to_string); return; @@ -465,13 +477,13 @@ public class RecipientEditV3Presenter extends RecipientAddEditBaseV3Presenter { @Override protected void onSuccess(AccountValidationApiResponse accountValidationApiResponse) { if (accountValidationApiResponse.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { - view.setErrorOnWidgetAccountNo(null); + view.getRecipientAddEditV3ContractInterface().setErrorOnWidgetAccountNo(null); updateRecipientInfo(); } else { - view.setErrorOnWidgetAccountNo(accountValidationApiResponse.getMsg()); - view.scrollAccountNumberView(); + view.getRecipientAddEditV3ContractInterface().setErrorOnWidgetAccountNo(accountValidationApiResponse.getMsg()); + view.getRecipientAddEditV3ContractInterface().scrollAccountNumberView(); } } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/view/RecipientAddV3ViewModelFactory.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/view/RecipientAddV3ViewModelFactory.java new file mode 100644 index 00000000..a81753da --- /dev/null +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/view/RecipientAddV3ViewModelFactory.java @@ -0,0 +1,32 @@ +package com.swifttech.remit.jmecustomer.features.recipientmanagement.view; + +import androidx.annotation.NonNull; +import androidx.lifecycle.ViewModel; +import androidx.lifecycle.ViewModelProvider; + +import com.swifttech.remit.jmecustomer.features.recipientmanagement.gateway.recipientaddeditV3.RecipientAddEditV3Gateway; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientlistingV3.ReceiverInfoV3Model; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.RecipientAddV3ContractInterface; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.add.RecipientAddV3ViewModel; + +public class RecipientAddV3ViewModelFactory implements ViewModelProvider.Factory { + private RecipientAddV3ContractInterface view; + private ReceiverInfoV3Model receiverInfoV3Model; + + + public RecipientAddV3ViewModelFactory( + RecipientAddV3ContractInterface view, + ReceiverInfoV3Model receiverInfoV3Model + ) { + this.view = view; + this.receiverInfoV3Model = receiverInfoV3Model; + + } + + @SuppressWarnings("unchecked") + @NonNull + @Override + public T create(@NonNull Class modelClass) { + return (T) new RecipientAddV3ViewModel(new RecipientAddEditV3Gateway(),view,receiverInfoV3Model); + } +} diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/view/RecipientEditV3ViewModelFactory.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/view/RecipientEditV3ViewModelFactory.java new file mode 100644 index 00000000..8b62637e --- /dev/null +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/view/RecipientEditV3ViewModelFactory.java @@ -0,0 +1,32 @@ +package com.swifttech.remit.jmecustomer.features.recipientmanagement.view; + +import androidx.annotation.NonNull; +import androidx.lifecycle.ViewModel; +import androidx.lifecycle.ViewModelProvider; + +import com.swifttech.remit.jmecustomer.features.recipientmanagement.gateway.recipientaddeditV3.RecipientAddEditV3Gateway; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientlistingV3.ReceiverInfoV3Model; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.RecipientAddV3ContractInterface; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.edit.RecipientEditV3ViewModel; + +public class RecipientEditV3ViewModelFactory implements ViewModelProvider.Factory { + private final RecipientAddV3ContractInterface view; + private final ReceiverInfoV3Model receiverInfoV3Model; + + + public RecipientEditV3ViewModelFactory( + RecipientAddV3ContractInterface view, + ReceiverInfoV3Model receiverInfoV3Model + ) { + this.view = view; + this.receiverInfoV3Model = receiverInfoV3Model; + + } + + @SuppressWarnings("unchecked") + @NonNull + @Override + public T create(@NonNull Class modelClass) { + return (T) new RecipientEditV3ViewModel(new RecipientAddEditV3Gateway(),view,receiverInfoV3Model); + } +} diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/view/recipientaddeditV3/BeneficiaryAddEditV3Fragment.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/view/recipientaddeditV3/BeneficiaryAddEditV3Fragment.java new file mode 100644 index 00000000..1095f64f --- /dev/null +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/view/recipientaddeditV3/BeneficiaryAddEditV3Fragment.java @@ -0,0 +1,1270 @@ +package com.swifttech.remit.jmecustomer.features.recipientmanagement.view.recipientaddeditV3; + +import android.content.Intent; +import android.os.Bundle; +import android.text.InputFilter; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.Nullable; +import androidx.lifecycle.ViewModelProvider; +import androidx.transition.TransitionManager; + +import com.swifttech.remit.jmecustomer.R; +import com.swifttech.remit.jmecustomer.base.BaseFragment; +import com.swifttech.remit.jmecustomer.common.customwidgets.TextWatcherAdapter; +import com.swifttech.remit.jmecustomer.common.customwidgets.common.GenericImageWithTextListingDialog; +import com.swifttech.remit.jmecustomer.common.customwidgets.common.GenericPromptDialog; +import com.swifttech.remit.jmecustomer.common.customwidgets.common.GenericTextListingDialog; +import com.swifttech.remit.jmecustomer.common.view.AnswerInputDialog; +import com.swifttech.remit.jmecustomer.databinding.FragmentBeneficiaryAddEditV3Binding; +import com.swifttech.remit.jmecustomer.features.kyc.newCustomer.model.NativeCountry; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientaddeditV3.countryservice.CountryServiceModel; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientaddeditV3.countryservice.ServiceTypeModel; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientaddeditV3.dynamicvalidation.DropDownDTO; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientaddeditV3.dynamicvalidation.PaymentBankModel; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientaddeditV3.dynamicvalidation.PayoutProvincesModel; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientlistingV3.ReceiverInfoV3Model; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.RecipientAddEditBaseV3ViewModel; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.RecipientAddV3ContractInterface; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.add.RecipientAddV3ViewModel; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.edit.RecipientEditV3ViewModel; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.utils.EditTextConfigurationFactory; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.utils.ValidationUtils; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.view.RecipientAddV3ViewModelFactory; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.view.RecipientEditV3ViewModelFactory; +import com.swifttech.remit.jmecustomer.features.sendmoney.model.SendMoneyRequiredDataV3; +import com.swifttech.remit.jmecustomer.features.sendmoney.model.payoutmode.BankBranchDTO; +import com.swifttech.remit.jmecustomer.features.sendmoney.view.SendMoneyV2Activity; +import com.swifttech.remit.jmecustomer.features.sendmoney.view.payoutmode.PayoutModeBranchListingDialog; +import com.swifttech.remit.jmecustomer.features.sendmoney.view.verification.TermsAndConditionV2BrowserActivity; +import com.swifttech.remit.jmecustomer.features.webbrowser.model.WebRequestModel; + +import static android.view.View.GONE; +import static com.swifttech.remit.jmecustomer.features.recipientlisting.view.recipientaddedit.RecipientAddEditActivity.RECIPIENT_INFO_BUNDLE_KEY; +import static com.swifttech.remit.jmecustomer.features.webbrowser.WebBrowserV2Activity.WEB_BROWSWER_URL_BUNDLE_KEY; + +public class BeneficiaryAddEditV3Fragment extends BaseFragment implements RecipientAddV3ContractInterface.RecipientAddEditV3ContractInterface, View.OnClickListener { + private final String TAG = BeneficiaryAddEditV3Fragment.class.getSimpleName(); + private FragmentBeneficiaryAddEditV3Binding binding; + + private RecipientAccountNoTextWatcher receiverAccountNoTextWatcher; + + private RecipientFirstNameTextWatcher receiverFirstNameTextWatcher; + private RecipientMiddleNameTextWatcher receiverMiddleNameTextWatcher; + private RecipientLastNameTextWatcher receiverLastNameTextWatcher; + private RecipientFullNameTextWatcher receiverFullNameTextWatcher; + + private RecipientLocalFirstNameTextWatcher receiverFirstNameLocalTextWatcher; + private RecipientLocalMiddleNameTextWatcher receiverMiddleNameLocalTextWatcher; + private RecipientLocalLastNameTextWatcher receiverLastNameLocalTextWatcher; + private RecipientLocalFullNameTextWatcher receiverLocalFullNameTextWatcher; + + private RecipientCityTextWatcher receiverCityTextWatcher; + private RecipientAddressTextWatcher receiverAddressTextWatcher; + private RecipientMobileNumberTextWatcher receiverMobileNoTextWatcher; + private RecipientEmailTextWatcher receiverEmailTextWatcher; + private RecipientIdNumberTextWatcher receiverIdNumberTextWatcher; + + GenericImageWithTextListingDialog countryListingDialog; + GenericImageWithTextListingDialog nativeCountryListingDialog; + GenericImageWithTextListingDialog serviceMethodListingDialog; + GenericTextListingDialog bankListingDialog; + RecipientBranchListingDialog branchListingDialog; + GenericTextListingDialog stateListingDialog; + GenericTextListingDialog districtListingDialog; + GenericTextListingDialog relationMethodListingDialog; + GenericTextListingDialog transferListingDialog; + GenericTextListingDialog idTypeListingDialog; + + private ReceiverInfoV3Model recipientToBeEdited; + private RecipientAddEditBaseV3ViewModel viewModel; + @Override + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + Log.d(TAG, "onCreateView: fragment called "); + binding = FragmentBeneficiaryAddEditV3Binding.inflate(inflater, container, false); + View view = binding.getRoot(); + return view; + } + + @Override + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + init(); + } + + private void init() { + recipientToBeEdited = getArguments().getParcelable(RECIPIENT_INFO_BUNDLE_KEY); + if (recipientToBeEdited != null) { + RecipientEditV3ViewModelFactory recipientEditViewModelFactory = new RecipientEditV3ViewModelFactory((RecipientAddV3ContractInterface) getActivity(),recipientToBeEdited); + viewModel = new ViewModelProvider(requireActivity(), recipientEditViewModelFactory).get(RecipientEditV3ViewModel.class); + } else { + RecipientAddV3ViewModelFactory recipientAddViewModelFactory = new RecipientAddV3ViewModelFactory((RecipientAddV3ContractInterface)getActivity(),recipientToBeEdited); + viewModel = new ViewModelProvider(requireActivity(), recipientAddViewModelFactory).get(RecipientAddV3ViewModel.class); + } + initTextWatchers(); + removeInputFiltersByDefault(); + } + + @Override + public void onStart() { + super.onStart(); + registerClickListener(true); + binding.btnSubmit.setOnClickListener(this); + binding.txvJmeTermsNCondition.setOnClickListener(this); + } + + @Override + public void onStop() { + super.onStop(); + registerClickListener(false); + binding.btnSubmit.setOnClickListener(null); + binding.txvJmeTermsNCondition.setOnClickListener(null); + } + + private void initTextWatchers() { + Log.d(TAG, "Textwatcher Init"); + + receiverAccountNoTextWatcher = new RecipientAccountNoTextWatcher(); + receiverFirstNameTextWatcher = new RecipientFirstNameTextWatcher(); + receiverMiddleNameTextWatcher = new RecipientMiddleNameTextWatcher(); + receiverLastNameTextWatcher = new RecipientLastNameTextWatcher(); + receiverFullNameTextWatcher = new RecipientFullNameTextWatcher(); + + + receiverFirstNameLocalTextWatcher = new RecipientLocalFirstNameTextWatcher(); + receiverMiddleNameLocalTextWatcher = new RecipientLocalMiddleNameTextWatcher(); + receiverLastNameLocalTextWatcher = new RecipientLocalLastNameTextWatcher(); + receiverLocalFullNameTextWatcher = new RecipientLocalFullNameTextWatcher(); + + receiverCityTextWatcher = new RecipientCityTextWatcher(); + receiverAddressTextWatcher = new RecipientAddressTextWatcher(); + receiverMobileNoTextWatcher = new RecipientMobileNumberTextWatcher(); + receiverEmailTextWatcher = new RecipientEmailTextWatcher(); + receiverIdNumberTextWatcher = new RecipientIdNumberTextWatcher(); + + } + + @Override + public void showSelectedCountryFlag(int id) { + + binding.recieverCountrySelectionCountryFlag.setImageResource(id); + + if (binding.recieverCountrySelectionCountryFlag.getVisibility() != View.VISIBLE) { + TransitionManager.beginDelayedTransition(binding.recieverCountryViewContainer); + binding.recieverCountrySelectionCountryFlag.setVisibility(View.VISIBLE); + } + + + } + + @Override + public void showCountrySelectionView(boolean visiblity) { + if (visiblity) + binding.recieverCountryViewContainer.setVisibility(View.VISIBLE); + else + binding.recieverCountryViewContainer.setVisibility(View.GONE); + + } + + @Override + public void showPaymentSelectionView(boolean visiblity) { + if (visiblity) + binding.receiverPaymentMethodSelectionWrapper.setVisibility(View.VISIBLE); + else + binding.receiverPaymentMethodSelectionWrapper.setVisibility(View.GONE); + + } + + @Override + public void updateValidationRuleToWidgetPaymentMethodSelection(boolean visiblity) { + if (visiblity) + binding.receiverPaymentMethodSelectionWrapper.setVisibility(View.VISIBLE); + else + binding.receiverPaymentMethodSelectionWrapper.setVisibility(View.GONE); + } + + @Override + public void hideAllViewExceptCountry() { + hideViewFromIndexId(2); + + } + + private void hideViewFromIndexId(int indexId) { + if (indexId < 0) + return; + for (int i = indexId; i < binding.receiverFromViewContainer.getChildCount() - 1; i++) { + binding.receiverFromViewContainer.getChildAt(i).setVisibility(GONE); + } + } + + @Override + public void promptToSendMoney(GenericPromptDialog.GenericDialogPromptListener listener, String message) { + GenericPromptDialog genericPromptDialog = new GenericPromptDialog(); + genericPromptDialog.setTitleMessage(getString(R.string.important_text)); + genericPromptDialog.setBodyMessage(message); + genericPromptDialog.setIconsRes(-1); + genericPromptDialog.setCancellable(true); + genericPromptDialog.setListener(listener); + if (!genericPromptDialog.isAdded()) + genericPromptDialog.show(getActivity().getSupportFragmentManager(), "PROMPTSENDMONEY"); + } + + @Override + public void hideAllFormFieldsExceptCountryAndPaymentMethod() { + binding.recieverCountryViewContainer.setVisibility(View.VISIBLE); + binding.receiverPaymentMethodSelectionWrapper.setVisibility(View.VISIBLE); + hideViewFromIndexId(3); + } + + @Override + public void redirectToSendMoney(SendMoneyRequiredDataV3 sendMoneyRequiredDataV3) { + Intent intent = new Intent(getActivity(), SendMoneyV2Activity.class); + intent.putExtra(RecipientAddEditV3Activity.RECIPIENT_INFO_BUNDLE_KEY, sendMoneyRequiredDataV3); + startActivity(intent); + } + + + @Override + public void updateValueToWidgetSelectedPaymentMethod(String description) { + Log.d(this.getClass().getSimpleName(), "Selected method type: " + description); + binding.edReceiverPaymentMethodSelection.setText(description); + + } + + + @Override + public void updateValueToWidgetSelectedCountry(String countryName) { + binding.edReceiverCountrySelection.setText(countryName); + } + + + @Override + public void updateValueToWidgetBankName(String value) { + binding.edReceiverBankSelection.setText(value); + } + + @Override + public void updateValueToWidgetBranchName(String value) { + binding.edReceiverBranchSelection.setText(value); + } + + @Override + public void updateValueToWidgetAccountNo(String value) { + binding.edReceiverAccountNo.setText(value); + } + + @Override + public void updateValueToWidgetIDType(String value) { + binding.edReceiverIDTypeSelection.setText(value); + } + + @Override + public void updateValueToWidgetIDNumber(String value) { + binding.edReceiverIdNumber.setText(value); + } + + @Override + public void updateValueToWidgetFirstName(String value) { + binding.edReceiverFirstName.setText(value); + } + + @Override + public void updateValueToWidgetMiddleName(String value) { + binding.edReceiverMiddleName.setText(value); + } + + @Override + public void updateValueToWidgetLastName(String value) { + binding.edReceiverLastName.setText(value); + } + + @Override + public void updateValueToWidgetFullName(String value) { + binding.edReceiverFullName.setText(value); + } + + @Override + public void updateValueToWidgetLocalFirstName(String value) { + binding.edReceiverLocalFirstName.setText(value); + } + + @Override + public void updateValueToWidgetLocalMiddleName(String value) { + binding.edReceiverLocalMiddleName.setText(value); + } + + @Override + public void updateValueToWidgetLocalLastName(String value) { + binding.edReceiverLocalLastName.setText(value); + } + + @Override + public void updateValueToWidgetLocalFullName(String name) { + binding.edReceiverLocalFullName.setText(name); + } + + @Override + public void updateValueToWidgetMobileNumber(String value) { + binding.edReceiverMobileNo.setText(value); + } + + @Override + public void updateValueToWidgetProvince(String value) { + binding.edReceiverStateSelection.setText(value); + } + + @Override + public void updateValueToWidgetDistrict(String value) { + binding.edReceiverDistrictSelection.setText(value); + } + + @Override + public void updateValueToWidgetCity(String value) { + binding.edReceiverCity.setText(value); + } + + @Override + public void updateValueToWidgetAddress(String value) { + binding.edReceiverAddress.setText(value); + } + + @Override + public void updateValueToWidgetRelation(String value) { + binding.edReceiverRelationSelection.setText(value); + } + + @Override + public void updateValueToWidgetTransferReason(String value) { + binding.edReceiverTransferReasonSelection.setText(value); + } + + @Override + public void updateValueToWidgetNativeCountry(String nativeCountry) { + binding.edReceiverNativeCountrySelection.setText(nativeCountry); + } + + @Override + public void updateValueToWidgetEmail(String email) { + binding.edReceiverEmail.setText(email); + } + + @Override + public void updateValidationRuleToWidgetLocalFullName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { + editTextConfiguration.applyConfigurationSetting(binding.edReceiverLocalFullName); + if (fieldRequired) { + binding.receiverLocalFullNameWrapper.setVisibility(View.VISIBLE); + } else + binding.receiverLocalFullNameWrapper.setVisibility(GONE); + } + + + @Override + public void updateValidationRuleToWidgetBankName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { +// editTextConfiguration.applyConfigurationSetting(recieverBankSelectionFormInputField.getEditTextView()); + if (fieldRequired) { + binding.receiverBankSelectionWrapper.setVisibility(View.VISIBLE); + } else + binding.receiverBankSelectionWrapper.setVisibility(GONE); + } + + @Override + public void updateValidationRuleToWidgetBranchName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { +// if (editTextConfiguration != null) +// editTextConfiguration.applyConfigurationSetting(recieverBranchSelectionFormInputField.getEditTextView()); + if (fieldRequired) { + binding.receiverBranchSelectionWrapper.setVisibility(View.VISIBLE); + } else + binding.receiverBranchSelectionWrapper.setVisibility(GONE); + } + + @Override + public void updateValidationRuleToWidgetAccountNo(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { + if (editTextConfiguration != null) + editTextConfiguration.applyConfigurationSetting(binding.edReceiverAccountNo); + + if (fieldRequired) + binding.receiverAccountNoWrapper.setVisibility(View.VISIBLE); + else + binding.receiverAccountNoWrapper.setVisibility(GONE); + } + + @Override + public void updateValidationRuleToWidgetIDType(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { +// editTextConfiguration.applyConfigurationSetting(recieverIDTypeSelectionFormInputField.getEditTextView()); + if (fieldRequired) { + binding.receiverIDTypeSelectionWrapper.setVisibility(View.VISIBLE); + } else + binding.receiverIDTypeSelectionWrapper.setVisibility(GONE); + } + + @Override + public void updateValidationRuleToWidgetIDNumber(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { + editTextConfiguration.applyConfigurationSetting(binding.edReceiverIdNumber); + if (fieldRequired) { + binding.receiverIdNumberWrapper.setVisibility(View.VISIBLE); + } else + binding.receiverIdNumberWrapper.setVisibility(GONE); + } + + @Override + public void updateValidationRuleToWidgetFirstName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { + editTextConfiguration.applyConfigurationSetting(binding.edReceiverFirstName); + if (fieldRequired) { + binding.receiverFirstNameWrapper.setVisibility(View.VISIBLE); + } else + binding.receiverFirstNameWrapper.setVisibility(GONE); + } + + @Override + public void updateValidationRuleToWidgetMiddleName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { + editTextConfiguration.applyConfigurationSetting(binding.edReceiverMiddleName); + if (fieldRequired) { + binding.receiverMiddleNameWrapper.setVisibility(View.VISIBLE); + } else + binding.receiverMiddleNameWrapper.setVisibility(GONE); + } + + @Override + public void updateValidationRuleToWidgetLastName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { + editTextConfiguration.applyConfigurationSetting(binding.edReceiverLastName); + if (fieldRequired) { + binding.receiverLastNameWrapper.setVisibility(View.VISIBLE); + } else + binding.receiverLastNameWrapper.setVisibility(GONE); + } + + @Override + public void updateValidationRuleToWidgetFullName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { + editTextConfiguration.applyConfigurationSetting(binding.edReceiverFullName); + if (fieldRequired) { + binding.receiverFullNameWrapper.setVisibility(View.VISIBLE); + } else + binding.receiverFullNameWrapper.setVisibility(GONE); + } + + @Override + public void updateValidationRuleToWidgetLocalFirstName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { + editTextConfiguration.applyConfigurationSetting(binding.edReceiverLocalFirstName); + if (fieldRequired) { + binding.receiverLocalFirstNameWrapper.setVisibility(View.VISIBLE); + } else + binding.receiverLocalFirstNameWrapper.setVisibility(GONE); + } + + @Override + public void updateValidationRuleToWidgetLocalMiddleName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { + editTextConfiguration.applyConfigurationSetting(binding.edReceiverLocalMiddleName); + if (fieldRequired) { + binding.receiverLocalMiddleNameWrapper.setVisibility(View.VISIBLE); + } else + binding.receiverLocalMiddleNameWrapper.setVisibility(GONE); + } + + @Override + public void updateValidationRuleToWidgetLocalLastName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { + editTextConfiguration.applyConfigurationSetting(binding.edReceiverLocalLastName); + if (fieldRequired) { + binding.receiverLocalLastNameWrapper.setVisibility(View.VISIBLE); + } else + binding.receiverLocalLastNameWrapper.setVisibility(GONE); + } + + @Override + public void updateValidationRuleToWidgetMobileNumber(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { + editTextConfiguration.applyConfigurationSetting(binding.edReceiverMobileNo); + if (fieldRequired) { + binding.mobileViewContainer.setVisibility(View.VISIBLE); + } else + binding.mobileViewContainer.setVisibility(GONE); + } + + @Override + public void showMobilePrefixAndFlag(String prefix, int flag) { + + if (prefix == null) { + binding.selectedCountryIcon.setVisibility(GONE); + binding.selectedCountryMobilePrefix.setVisibility(GONE); + binding.selectedCountryMobilePrefix.setText(""); + return; + } + binding.selectedCountryIcon.setImageResource(flag); + binding.selectedCountryMobilePrefix.setText(prefix); + + binding.selectedCountryIcon.setVisibility(View.VISIBLE); + binding.selectedCountryMobilePrefix.setVisibility(View.VISIBLE); + + + } + + + @Override + public void scrollAccountNumberView() { + if (binding.receiverBankSelectionWrapper.getVisibility() == View.VISIBLE) { + binding.scrollView.post(new Runnable() { + @Override + public void run() { + binding.scrollView.smoothScrollTo(0, binding.receiverBankSelectionWrapper.getTop()); + } + }); + } + } + + @Override + public void clearViewDependentOnServiceType() { + binding.edReceiverAccountNo.setText(""); + + binding.edReceiverFirstName.setText(""); + binding.edReceiverMiddleName.setText(""); + binding.edReceiverLastName.setText(""); + binding.edReceiverFullName.setText(""); + + + binding.edReceiverLocalFirstName.setText(""); + binding.edReceiverLocalMiddleName.setText(""); + binding.edReceiverLocalLastName.setText(""); + binding.edReceiverLocalFullName.setText(""); + + binding.edReceiverCity.setText(""); + binding.edReceiverAddress.setText(""); + binding.edReceiverMobileNo.setText(""); + binding.edReceiverEmail.setText(""); + binding.edReceiverIdNumber.setText(""); + + + binding.edReceiverBankSelection.setText(""); + binding.edReceiverBranchSelection.setText(""); + binding.edReceiverStateSelection.setText(""); + binding.edReceiverDistrictSelection.setText(""); + binding.edReceiverRelationSelection.setText(""); + binding.edReceiverTransferReasonSelection.setText(""); + binding.edReceiverIDTypeSelection.setText(""); + } + + @Override + public void clearViewDependentOnCountryServiceSelected() { + + binding.edReceiverPaymentMethodSelection.setText(""); + + clearViewDependentOnServiceType(); + } + + @Override + public void showNativeCountryFlag(int flagFromCountryCode) { + binding.recieverNativeCountrySelectionCountryFlag.setImageResource(flagFromCountryCode); + + if (binding.recieverNativeCountrySelectionCountryFlag.getVisibility() != View.VISIBLE) { + TransitionManager.beginDelayedTransition(binding.recieverCountryViewContainer); + binding.recieverNativeCountrySelectionCountryFlag.setVisibility(View.VISIBLE); + } + + } + + + @Override + public void updateValidationRuleToWidgetProvince(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { +// editTextConfiguration.applyConfigurationSetting(recieverStateSelectionFormInputField.getEditTextView()); + if (fieldRequired) { + binding.receiverStateSelectionWrapper.setVisibility(View.VISIBLE); + } else + binding.receiverStateSelectionWrapper.setVisibility(GONE); + } + + @Override + public void updateValidationRuleToWidgetDistrict(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { +// editTextConfiguration.applyConfigurationSetting(recieverDistrictSelectionFormInputField.getEditTextView()); + if (fieldRequired) { + binding.receiverDistrictSelectionWrapper.setVisibility(View.VISIBLE); + } else + binding.receiverDistrictSelectionWrapper.setVisibility(GONE); + } + + @Override + public void updateValidationRuleToWidgetCity(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { + if (editTextConfiguration != null) + editTextConfiguration.applyConfigurationSetting(binding.edReceiverCity); + + if (fieldRequired) { + binding.receiverCityWrapper.setVisibility(View.VISIBLE); + } else + binding.receiverCityWrapper.setVisibility(GONE); + } + + @Override + public void updateValidationRuleToWidgetAddress(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { + editTextConfiguration.applyConfigurationSetting(binding.edReceiverAddress); + if (fieldRequired) { + binding.receiverAddressWrapper.setVisibility(View.VISIBLE); + } else + binding.receiverAddressWrapper.setVisibility(GONE); + } + + @Override + public void updateValidationRuleToWidgetRelation(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { +// editTextConfiguration.applyConfigurationSetting(recieverRelationSelectionFormInputField.getEditTextView()); + if (fieldRequired) { + binding.receiverRelationSelectionWrapper.setVisibility(View.VISIBLE); + } else + binding.receiverRelationSelectionWrapper.setVisibility(GONE); + } + + @Override + public void updateValidationRuleToWidgetTransferReason(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { +// editTextConfiguration.applyConfigurationSetting(recieverTransferReasonSelectionFormInputField.getEditTextView()); + if (fieldRequired) { + binding.receiverTransferReasonSelectionWrapper.setVisibility(View.VISIBLE); + } else + binding.receiverTransferReasonSelectionWrapper.setVisibility(GONE); + } + + @Override + public void updateValidationRuleToWidgetEmail(boolean isFieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { +// editTextConfiguration.applyConfigurationSetting(binding.edReceiverTransferReasonSelection); --->??? + editTextConfiguration.applyConfigurationSetting(binding.edReceiverEmail); + if (isFieldRequired) { + binding.receiverEmailWrapper.setVisibility(View.VISIBLE); + } else + binding.receiverEmailWrapper.setVisibility(GONE); + } + + @Override + public void updateValidationRuleToWidgetNativeCountry(boolean isFieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword) { + if (isFieldRequired) { + binding.recieverNativeCountryViewContainer.setVisibility(View.VISIBLE); + } else + binding.recieverNativeCountryViewContainer.setVisibility(GONE); + } + + @Override + public void setErrorOnWidgetBank(String error) { + binding.edReceiverBankSelection.setError(error); + } + + + @Override + public void setErrorOnWidgetAccountNo(String error) { + binding.receiverAccountNoWrapper.setError(error); + } + + @Override + public void setErrorOnWidgetFirstName(String error) { + binding.receiverFirstNameWrapper.setError(error); + } + + @Override + public void setErrorOnWidgetMiddleName(String error) { + binding.receiverMiddleNameWrapper.setError(error); + } + + @Override + public void setErrorOnWidgetLastName(String error) { + binding.receiverLastNameWrapper.setError(error); + } + + @Override + public void setErrorOnWidgetFullName(String error) { + binding.receiverFullNameWrapper.setError(error); + + } + + @Override + public void setErrorOnWidgetCity(String error) { + binding.receiverCityWrapper.setError(error); + } + + @Override + public void setErrorOnWidgetAddress(String error) { + binding.receiverAddressWrapper.setError(error); + } + + @Override + public void setErrorOnWidgetMobileNumber(String error) { + binding.receiverMobileNoWrapper.setError(error); + } + + @Override + public void setErrorOnWidgetEmail(String error) { + binding.receiverEmailWrapper.setError(error); + } + + @Override + public void setErrorOnWidgetIDNumber(String error) { + binding.receiverIdNumberWrapper.setError(error); + + } + + @Override + public void setErrorOnWidgetLocalFirstName(String error) { + binding.receiverLocalFirstNameWrapper.setError(error); + } + + @Override + public void setErrorOnWidgetLocalMiddleName(String error) { + binding.receiverLocalMiddleNameWrapper.setError(error); + } + + @Override + public void setErrorOnWidgetLocalLastName(String error) { + binding.receiverLocalLastNameWrapper.setError(error); + } + + @Override + public void setErrorOnWidgetLocalFullName(String error) { + binding.receiverLocalFullNameWrapper.setError(error); + } + + @Override + public void addOptionalAsHintToWidgetBankName(Boolean isOptional) { + ValidationUtils.updateHint(binding.receiverBankSelectionWrapper, isOptional); + } + + @Override + public void addOptionalAsHintToWidgetBranch(Boolean isOptional) { + ValidationUtils.updateHint(binding.receiverBranchSelectionWrapper, isOptional); + } + + @Override + public void addOptionalAsHintToWidgetAccountNumber(Boolean isOptional) { + ValidationUtils.updateHint(binding.receiverAccountNoWrapper, isOptional); + + } + + @Override + public void addOptionalAsHintToWidgetIDType(Boolean isOptional) { + ValidationUtils.updateHint(binding.receiverIDTypeSelectionWrapper, isOptional); + } + + @Override + public void addOptionalAsHintToWidgetIDNumber(Boolean isOptional) { + ValidationUtils.updateHint(binding.receiverIdNumberWrapper, isOptional); + } + + @Override + public void addOptionalAsHintToWidgetFirstName(Boolean isOptional) { + ValidationUtils.updateHint(binding.receiverFirstNameWrapper, isOptional); + } + + @Override + public void addOptionalAsHintToWidgetMiddleName(Boolean isOptional) { + ValidationUtils.updateHint(binding.receiverMiddleNameWrapper, isOptional); + } + + @Override + public void addOptionalAsHintToWidgetLastName(Boolean isOptional) { + ValidationUtils.updateHint(binding.receiverLastNameWrapper, isOptional); + } + + @Override + public void addOptionalAsHintToWidgetFullName(Boolean isOptional) { + ValidationUtils.updateHint(binding.receiverFullNameWrapper, isOptional); + + } + + @Override + public void addOptionalAsHintToWidgetLocalFirstName(Boolean isOptional) { + ValidationUtils.updateHint(binding.receiverLocalFirstNameWrapper, isOptional); + } + + @Override + public void addOptionalAsHintToWidgetLocalMiddleName(Boolean isOptional) { + ValidationUtils.updateHint(binding.receiverLocalMiddleNameWrapper, isOptional); + } + + @Override + public void addOptionalAsHintToWidgetLocalLastName(Boolean isOptional) { + ValidationUtils.updateHint(binding.receiverLocalLastNameWrapper, isOptional); + } + + @Override + public void addOptionalAsHintToWidgetLocalFullName(Boolean isOptional) { + ValidationUtils.updateHint(binding.receiverLocalFullNameWrapper, isOptional); + } + + @Override + public void addOptionalAsHintToWidgetMobileNumber(Boolean isOptional) { + ValidationUtils.updateHint(binding.receiverMobileNoWrapper, isOptional); + } + + @Override + public void addOptionalAsHintToWidgetProvince(Boolean isOptional) { + ValidationUtils.updateHint(binding.receiverStateSelectionWrapper, isOptional); + } + + @Override + public void addOptionalAsHintToWidgetDistrict(Boolean isOptional) { + ValidationUtils.updateHint(binding.receiverDistrictSelectionWrapper, isOptional); + } + + @Override + public void addOptionalAsHintToWidgetCity(Boolean isOptional) { + ValidationUtils.updateHint(binding.receiverCityWrapper, isOptional); + } + + @Override + public void addOptionalAsHintToWidgetAddress(Boolean isOptional) { + ValidationUtils.updateHint(binding.receiverAddressWrapper, isOptional); + } + + @Override + public void addOptionalAsHintToWidgetRelation(Boolean isOptional) { + ValidationUtils.updateHint(binding.receiverRelationSelectionWrapper, isOptional); + } + + @Override + public void addOptionalAsHintToWidgetTransferReason(Boolean isOptional) { + ValidationUtils.updateHint(binding.receiverTransferReasonSelectionWrapper, isOptional); + } + + @Override + public void addOptionalAsHintToWidgetEmail(Boolean isOptional) { + ValidationUtils.updateHint(binding.receiverEmailWrapper, isOptional); + } + + @Override + public void addOptionalAsHintToWidgetNativeCountry(Boolean isOptional) { + ValidationUtils.updateHint(binding.receiverNativeCountrySelectionWrapper, isOptional); + + } + + @Override + public void promptToInputAnswer(String question, AnswerInputDialog.AnswerInputDialogListener listener) { + + AnswerInputDialog answerInputDialog = new AnswerInputDialog(); + answerInputDialog.setQuestionText(question); + answerInputDialog.setAnswerListener(listener); + if (!answerInputDialog.isAdded()) + answerInputDialog.show(getActivity().getSupportFragmentManager(), answerInputDialog.getClass().getSimpleName()); + } + + @Override + public void registerTextWatchers(boolean action) { + if (action) { + binding.edReceiverAccountNo.addTextChangedListener(receiverAccountNoTextWatcher); + + binding.edReceiverFirstName.addTextChangedListener(receiverFirstNameTextWatcher); + binding.edReceiverMiddleName.addTextChangedListener(receiverMiddleNameTextWatcher); + binding.edReceiverLastName.addTextChangedListener(receiverLastNameTextWatcher); + binding.edReceiverFullName.addTextChangedListener(receiverFullNameTextWatcher); + + + binding.edReceiverLocalFirstName.addTextChangedListener(receiverFirstNameLocalTextWatcher); + binding.edReceiverLocalMiddleName.addTextChangedListener(receiverMiddleNameLocalTextWatcher); + binding.edReceiverLocalLastName.addTextChangedListener(receiverLastNameLocalTextWatcher); + binding.edReceiverLocalFullName.addTextChangedListener(receiverLocalFullNameTextWatcher); + + binding.edReceiverCity.addTextChangedListener(receiverCityTextWatcher); + binding.edReceiverAddress.addTextChangedListener(receiverAddressTextWatcher); + binding.edReceiverMobileNo.addTextChangedListener(receiverMobileNoTextWatcher); + binding.edReceiverEmail.addTextChangedListener(receiverEmailTextWatcher); + binding.edReceiverIdNumber.addTextChangedListener(receiverIdNumberTextWatcher); + } else { + + binding.edReceiverAccountNo.removeTextChangedListener(receiverAccountNoTextWatcher); + + binding.edReceiverFirstName.removeTextChangedListener(receiverFirstNameTextWatcher); + binding.edReceiverMiddleName.removeTextChangedListener(receiverMiddleNameTextWatcher); + binding.edReceiverLastName.removeTextChangedListener(receiverLastNameTextWatcher); + binding.edReceiverFullName.removeTextChangedListener(receiverFullNameTextWatcher); + + + binding.edReceiverLocalFirstName.removeTextChangedListener(receiverFirstNameLocalTextWatcher); + binding.edReceiverLocalMiddleName.removeTextChangedListener(receiverMiddleNameLocalTextWatcher); + binding.edReceiverLocalLastName.removeTextChangedListener(receiverLastNameLocalTextWatcher); + binding.edReceiverLocalFullName.removeTextChangedListener(receiverLocalFullNameTextWatcher); + + binding.edReceiverCity.removeTextChangedListener(receiverCityTextWatcher); + binding.edReceiverAddress.removeTextChangedListener(receiverAddressTextWatcher); + binding.edReceiverMobileNo.removeTextChangedListener(receiverMobileNoTextWatcher); + binding.edReceiverEmail.removeTextChangedListener(receiverEmailTextWatcher); + binding.edReceiverIdNumber.removeTextChangedListener(receiverIdNumberTextWatcher); + } + } + + @Override + public void setSubmitButtonEnabled(boolean action) { + binding.btnSubmit.setEnabled(action); + } + + @Override + public void onClick(View view) { + switch (view.getId()) { + + case R.id.txv_jme_terms_n_condition: + openJmeTermsAndCondition(); + break; + + case R.id.btn_submit: + if (binding.btnSubmit.isEnabled()) + viewModel.onSubmitBtnPressed(); + break; + + } + } + + private void openJmeTermsAndCondition() { + WebRequestModel requestModel = viewModel.getWebRequestDataForTermsAndCondition(); + Intent intent = new Intent(getActivity(), TermsAndConditionV2BrowserActivity.class); + intent.putExtra(WEB_BROWSWER_URL_BUNDLE_KEY, requestModel); + startActivity(intent); + } + + public class RecipientAccountNoTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + viewModel.onRecipientAccountNoChanged(text); + } + } + + public class RecipientFirstNameTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + viewModel.onRecipientFirstNameChanged(text); + } + } + + public class RecipientMiddleNameTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + viewModel.onRecipientMiddleNameChanged(text); + } + } + + public class RecipientLastNameTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + viewModel.onRecipientLastNameChanged(text); + } + } + + public class RecipientFullNameTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + Log.d(TAG, "Full name textwatcher called"); + viewModel.onRecipientFullNameChanged(text); + } + } + + public class RecipientLocalFirstNameTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + viewModel.onRecipientLocalFirstNameChanged(text); + } + } + + public class RecipientLocalMiddleNameTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + viewModel.onRecipientLocalMiddleNameChanged(text); + } + } + + public class RecipientLocalLastNameTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + viewModel.onRecipientLocalLastNameChanged(text); + } + } + + + public class RecipientLocalFullNameTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + viewModel.onRecipientLocalFullNameChanged(text); + } + } + + + public class RecipientCityTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + viewModel.onRecipientCityChanged(text); + + } + } + + public class RecipientAddressTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + viewModel.onRecipientAddressChanged(text); + } + } + + public class RecipientMobileNumberTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + viewModel.onRecipientMobileNumberChanged(text); + } + } + + public class RecipientEmailTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + viewModel.onRecipientEmailChanged(text); + } + } + + public class RecipientIdNumberTextWatcher extends TextWatcherAdapter { + @Override + public void onTextUpdated(String text) { + viewModel.onRecipientIdNumberChanged(text); + + } + } + + private void removeInputFiltersByDefault() { + binding.edReceiverPaymentMethodSelection.setFilters(new InputFilter[]{}); + binding.edReceiverLocalFullName.setFilters(new InputFilter[]{}); + binding.edReceiverLocalLastName.setFilters(new InputFilter[]{}); + binding.edReceiverLocalMiddleName.setFilters(new InputFilter[]{}); + binding.edReceiverLocalFirstName.setFilters(new InputFilter[]{}); + } + + private void registerClickListener(boolean action) { + if (action) { + binding.edReceiverCountrySelection.setOnClickListener(new CountrySelectionClickListener()); + binding.edReceiverNativeCountrySelection.setOnClickListener(new NativeCountrySelectionClickListener()); + binding.edReceiverPaymentMethodSelection.setOnClickListener(new PaymentMethodSelectionClickListener()); + binding.edReceiverBankSelection.setOnClickListener(new BankSelectionClickListener()); + binding.edReceiverBranchSelection.setOnClickListener(new BranchSelectionClickListener()); + binding.edReceiverStateSelection.setOnClickListener(new StateSelectionClickListener()); + binding.edReceiverDistrictSelection.setOnClickListener(new DistrictSelectionClickListener()); + binding.edReceiverRelationSelection.setOnClickListener(new RelationSelectionClickListener()); + binding.edReceiverTransferReasonSelection.setOnClickListener(new TransferReasonSelectionClickListener()); + binding.edReceiverIDTypeSelection.setOnClickListener(new IDTypeSelectionClickListener()); + } else { + binding.edReceiverCountrySelection.setOnClickListener(null); + binding.edReceiverNativeCountrySelection.setOnClickListener(null); + binding.edReceiverPaymentMethodSelection.setOnClickListener(null); + binding.edReceiverBankSelection.setOnClickListener(null); + binding.edReceiverBranchSelection.setOnClickListener(null); + binding.edReceiverStateSelection.setOnClickListener(null); + binding.edReceiverDistrictSelection.setOnClickListener(null); + binding.edReceiverRelationSelection.setOnClickListener(null); + binding.edReceiverTransferReasonSelection.setOnClickListener(null); + binding.edReceiverIDTypeSelection.setOnClickListener(null); + } + } + + + public class CountrySelectionClickListener implements View.OnClickListener { + + @Override + public void onClick(View v) { + Log.d("ONTAPTEST", "On Tapperd"); + hideKeyBoard(); + if (countryListingDialog == null) + countryListingDialog = new GenericImageWithTextListingDialog<>(); + countryListingDialog.setData(viewModel.getAvailableCountryServiceData()); + countryListingDialog.setListener(countryServiceModel -> + { + viewModel.onCountryServiceSelected(countryServiceModel); + countryListingDialog.dismiss(); + + }); + countryListingDialog.setHintAndTitle(getString(R.string.search_payout_country_text), getString(R.string.payout_country_placeholder_text), getString(R.string.no_payout_country_found_text)); + countryListingDialog.disableSearch(false); + if (!countryListingDialog.isAdded()) + countryListingDialog.show(getActivity().getSupportFragmentManager(), this.getClass().getSimpleName()); + } + } + + public class NativeCountrySelectionClickListener implements View.OnClickListener { + @Override + public void onClick(View v) { + hideKeyBoard(); + if (nativeCountryListingDialog == null) + nativeCountryListingDialog = new GenericImageWithTextListingDialog<>(); + nativeCountryListingDialog.setData(viewModel.getAvailableNativeCountryServiceData()); + nativeCountryListingDialog.setListener(countryServiceModel -> + { + viewModel.onNativeCountryServiceSelected(countryServiceModel); + nativeCountryListingDialog.dismiss(); + }); + nativeCountryListingDialog.setHintAndTitle(getString(R.string.search_native_country_text), getString(R.string.native_country_placeholder_text), getString(R.string.no_native_country_found_text)); + nativeCountryListingDialog.disableSearch(false); + if (!nativeCountryListingDialog.isAdded()) + nativeCountryListingDialog.show(getActivity().getSupportFragmentManager(), this.getClass().getSimpleName()); + } + } + + public class PaymentMethodSelectionClickListener implements View.OnClickListener { + + @Override + public void onClick(View v) { + hideKeyBoard(); + if (serviceMethodListingDialog == null) + serviceMethodListingDialog = new GenericImageWithTextListingDialog<>(); + serviceMethodListingDialog.setData(viewModel.getAvailableServiceMethodList()); + serviceMethodListingDialog.setListener(selectedPaymentMethod -> + { + viewModel.onServiceTypeSelected(selectedPaymentMethod); + serviceMethodListingDialog.dismiss(); + }); + serviceMethodListingDialog.setHintAndTitle(getString(R.string.search_payment_method_text), getString(R.string.payment_mode_placeholder_text), getString(R.string.no_payment_method_found_text)); + + serviceMethodListingDialog.disableSearch(false); + if (!serviceMethodListingDialog.isAdded()) + serviceMethodListingDialog.show(getActivity().getSupportFragmentManager(), this.getClass().getSimpleName()); + } + } + + public class BankSelectionClickListener implements View.OnClickListener { + + @Override + public void onClick(View v) { + hideKeyBoard(); + if (bankListingDialog == null) + bankListingDialog = new GenericTextListingDialog<>(); + bankListingDialog.setData(viewModel.getAvailableBankList()); + bankListingDialog.setListener(selectedBank -> + { + viewModel.onBankSelected(selectedBank); + bankListingDialog.dismiss(); + }); + bankListingDialog.setHintAndTitle(getString(R.string.search_bank_text), getString(R.string.bank_placeholder_text), getString(R.string.no_bank_found_text)); + bankListingDialog.disableSearch(false); + if (!bankListingDialog.isAdded()) + bankListingDialog.show(getActivity().getSupportFragmentManager(), this.getClass().getSimpleName()); + } + } + + public class BranchSelectionClickListener implements View.OnClickListener { + + @Override + public void onClick(View v) { + hideKeyBoard(); + + String bankId = viewModel.getSelectedBank(); + String countryId = viewModel.getSelectedCountryId(); + + if (bankId == null) + return; + + if (branchListingDialog == null) + branchListingDialog = new RecipientBranchListingDialog(); + branchListingDialog.setSelectedBankId(bankId); + branchListingDialog.setSelectedCountry(countryId); + branchListingDialog.setListener( + new PayoutModeBranchListingDialog.BranchSelectionListener() { + @Override + public void onBranchSelected(BankBranchDTO selectedBranch) { + viewModel.onBranchSelected(selectedBranch); + branchListingDialog.dismiss(); + } + + @Override + public void onBranchSelectionFailed(String message) { + showToastMessage(message); + } + } + ); + + if (!branchListingDialog.isAdded()) + branchListingDialog.show(getActivity().getSupportFragmentManager(), "BranchListingFragment"); + } + } + + public class StateSelectionClickListener implements View.OnClickListener { + + @Override + public void onClick(View v) { + hideKeyBoard(); + if (stateListingDialog == null) + stateListingDialog = new GenericTextListingDialog<>(); + stateListingDialog.setData(viewModel.getProviencesList()); + stateListingDialog.setListener(selectedState -> + { + viewModel.onProvinceSelected(selectedState); + stateListingDialog.dismiss(); + }); + stateListingDialog.setHintAndTitle(getString(R.string.search_province_text), getString(R.string.state_province_placeholder_text), getString(R.string.no_province_found_text)); + stateListingDialog.disableSearch(false); + if (!stateListingDialog.isAdded()) + stateListingDialog.show(getActivity().getSupportFragmentManager(), this.getClass().getSimpleName()); + } + } + + + public class DistrictSelectionClickListener implements View.OnClickListener { + @Override + public void onClick(View v) { + hideKeyBoard(); + if (districtListingDialog == null) + districtListingDialog = new GenericTextListingDialog<>(); + districtListingDialog.setData(viewModel.getDistrictList()); + districtListingDialog.setListener(selectedDistrict -> + { + viewModel.onDistrictSelected(selectedDistrict); + districtListingDialog.dismiss(); + }); + districtListingDialog.setHintAndTitle(getString(R.string.search_district_text), getString(R.string.district_placeholder_text), getString(R.string.no_district_found_text)); + + districtListingDialog.disableSearch(false); + if (!districtListingDialog.isAdded()) + districtListingDialog.show(getActivity().getSupportFragmentManager(), this.getClass().getSimpleName()); + } + } + + public class RelationSelectionClickListener implements View.OnClickListener { + + @Override + public void onClick(View v) { + hideKeyBoard(); + if (relationMethodListingDialog == null) + relationMethodListingDialog = new GenericTextListingDialog<>(); + relationMethodListingDialog.setData(viewModel.getRelationsList()); + relationMethodListingDialog.setListener(selectedRelation -> + { + viewModel.onRelationSelected(selectedRelation); + relationMethodListingDialog.dismiss(); + }); + relationMethodListingDialog.setHintAndTitle(getString(R.string.search_relation_text), getString(R.string.relation_placeholder_text), getString(R.string.no_relation_found_text)); + relationMethodListingDialog.disableSearch(false); + if (!relationMethodListingDialog.isAdded()) + relationMethodListingDialog.show(getActivity().getSupportFragmentManager(), this.getClass().getSimpleName()); + } + } + + public class TransferReasonSelectionClickListener implements View.OnClickListener { + + @Override + public void onClick(View v) { + hideKeyBoard(); + if (transferListingDialog == null) + transferListingDialog = new GenericTextListingDialog<>(); + transferListingDialog.setData(viewModel.getTransferReasonList()); + transferListingDialog.setListener(selectedTransferReason -> + { + viewModel.onTransferReasonSelected(selectedTransferReason); + transferListingDialog.dismiss(); + }); + transferListingDialog.setHintAndTitle(getString(R.string.searchPurposeOfRemit_text), getResources().getString(R.string.selectPurposeOfRemit_text), getString(R.string.noPurposeOfRemit_text)); + transferListingDialog.disableSearch(false); + if (!transferListingDialog.isAdded()) + transferListingDialog.show(getActivity().getSupportFragmentManager(), this.getClass().getSimpleName()); + } + } + + public class IDTypeSelectionClickListener implements View.OnClickListener { + + @Override + public void onClick(View v) { + hideKeyBoard(); + if (idTypeListingDialog == null) + idTypeListingDialog = new GenericTextListingDialog<>(); + idTypeListingDialog.setData(viewModel.getReceiverIdTypeList()); + idTypeListingDialog.setListener(selectedPaymentMethod -> + { + viewModel.onIDTypeSelected(selectedPaymentMethod); + idTypeListingDialog.dismiss(); + }); + idTypeListingDialog.setHintAndTitle(getString(R.string.search_id_type_text), getString(R.string.id_type_text), getString(R.string.no_id_type_found_text)); + idTypeListingDialog.disableSearch(false); + if (!idTypeListingDialog.isAdded()) + idTypeListingDialog.show(getActivity().getSupportFragmentManager(), this.getClass().getSimpleName()); + } + } + +} diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/view/recipientaddeditV3/BeneficiaryAddEditV3TermsFragment.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/view/recipientaddeditV3/BeneficiaryAddEditV3TermsFragment.java new file mode 100644 index 00000000..d414ff53 --- /dev/null +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/view/recipientaddeditV3/BeneficiaryAddEditV3TermsFragment.java @@ -0,0 +1,72 @@ +package com.swifttech.remit.jmecustomer.features.recipientmanagement.view.recipientaddeditV3; + +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.webkit.WebView; + +import androidx.annotation.Nullable; +import androidx.lifecycle.ViewModelProvider; + +import com.swifttech.remit.jmecustomer.features.kyc.newCustomer.view.termsAndCondition.NewKycTermsAndConditionFragment; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientlistingV3.ReceiverInfoV3Model; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.RecipientAddEditBaseV3ViewModel; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.RecipientAddV3ContractInterface; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.add.RecipientAddV3ViewModel; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.edit.RecipientEditV3ViewModel; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.view.RecipientAddV3ViewModelFactory; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.view.RecipientEditV3ViewModelFactory; +import com.swifttech.remit.jmecustomer.features.webbrowser.WebBrowserFragmentV2; +import com.swifttech.remit.jmecustomer.features.webbrowser.model.WebRequestModel; + +import static com.swifttech.remit.jmecustomer.features.recipientlisting.view.recipientaddedit.RecipientAddEditActivity.RECIPIENT_INFO_BUNDLE_KEY; +import static com.swifttech.remit.jmecustomer.utils.Constants.JME_TERMS_N_CONDITIONS; + +public class BeneficiaryAddEditV3TermsFragment extends WebBrowserFragmentV2 { + private RecipientAddEditBaseV3ViewModel viewModel; + private ReceiverInfoV3Model recipientToBeEdited; + private static String TAG = NewKycTermsAndConditionFragment.class.getSimpleName(); + private String currentLoadedUrl = ""; + + @Override + protected void doTask(WebRequestModel webRequestModel, WebView webView) { + if (webRequestModel != null && !currentLoadedUrl.equalsIgnoreCase(webRequestModel.getUrl())) { + this.currentLoadedUrl = webRequestModel.getUrl(); + webView.loadUrl(webRequestModel.getUrl()); + Log.d(this.getClass().getSimpleName(), currentLoadedUrl); + triggerWebviewEvent(webView); + } + } + + private void triggerWebviewEvent(WebView webView) { + + } + + @Override + protected void proceedButtonClicked() { + if (recipientToBeEdited != null) { + viewModel.proceedToEditSucess(); + } else { + viewModel.proceedToAddSucess(); + } + } + + @Override + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + recipientToBeEdited = getArguments().getParcelable(RECIPIENT_INFO_BUNDLE_KEY); + if (recipientToBeEdited != null) { + RecipientEditV3ViewModelFactory recipientEditViewModelFactory = new RecipientEditV3ViewModelFactory((RecipientAddV3ContractInterface) getActivity(),recipientToBeEdited); + viewModel = new ViewModelProvider(requireActivity(), recipientEditViewModelFactory).get(RecipientEditV3ViewModel.class); + } else { + RecipientAddV3ViewModelFactory recipientAddViewModelFactory = new RecipientAddV3ViewModelFactory((RecipientAddV3ContractInterface)getActivity(),recipientToBeEdited); + viewModel = new ViewModelProvider(requireActivity(), recipientAddViewModelFactory).get(RecipientAddV3ViewModel.class); + } + showAcceptOption(true); + WebRequestModel webRequestModel = new WebRequestModel("", JME_TERMS_N_CONDITIONS, null); + setWebRequestData(webRequestModel); + loadWebView(); + + + } +} diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/view/recipientaddeditV3/RecipientAddEditV3Activity.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/view/recipientaddeditV3/RecipientAddEditV3Activity.java index 78e65592..006af1d2 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/view/recipientaddeditV3/RecipientAddEditV3Activity.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/view/recipientaddeditV3/RecipientAddEditV3Activity.java @@ -5,10 +5,9 @@ import android.content.Intent; import android.os.Bundle; import androidx.constraintlayout.widget.ConstraintLayout; -import androidx.transition.TransitionManager; +import androidx.fragment.app.Fragment; +import androidx.viewpager.widget.ViewPager; -import android.text.InputFilter; -import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.AutoCompleteTextView; @@ -20,42 +19,29 @@ import android.widget.TextView; import com.swifttech.remit.jmecustomer.R; import com.swifttech.remit.jmecustomer.base.BaseActivity; -import com.swifttech.remit.jmecustomer.common.customwidgets.common.GenericPromptDialog; -import com.swifttech.remit.jmecustomer.common.view.AnswerInputDialog; -import com.swifttech.remit.jmecustomer.common.customwidgets.common.GenericImageWithTextListingDialog; -import com.swifttech.remit.jmecustomer.common.customwidgets.common.GenericTextListingDialog; +import com.swifttech.remit.jmecustomer.common.customwidgets.GenericViewPagerAdapter; import com.swifttech.remit.jmecustomer.common.customwidgets.GmeTextView; -import com.swifttech.remit.jmecustomer.common.customwidgets.TextWatcherAdapter; -import com.swifttech.remit.jmecustomer.features.kyc.newCustomer.model.NativeCountry; +import com.swifttech.remit.jmecustomer.features.recipientlisting.view.recipientaddedit.BeneficiaryAddEditFragment; +import com.swifttech.remit.jmecustomer.features.recipientlisting.view.recipientaddedit.BeneficiaryAddEditTermsFragment; import com.swifttech.remit.jmecustomer.features.recipientmanagement.gateway.recipientaddeditV3.RecipientAddEditV3Gateway; -import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientaddeditV3.countryservice.CountryServiceModel; -import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientaddeditV3.countryservice.ServiceTypeModel; -import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientaddeditV3.dynamicvalidation.DropDownDTO; -import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientaddeditV3.dynamicvalidation.PaymentBankModel; -import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientaddeditV3.dynamicvalidation.PayoutProvincesModel; import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientlistingV3.ReceiverInfoV3Model; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.RecipientAddEditBaseV3ViewModel; import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.RecipientAddV3ContractInterface; import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.RecipientPresenterInterface; -import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.add.RecipientAddV3Presenter; -import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.edit.RecipientEditV3Presenter; -import com.swifttech.remit.jmecustomer.features.recipientmanagement.utils.EditTextConfigurationFactory; -import com.swifttech.remit.jmecustomer.features.recipientmanagement.utils.ValidationUtils; -import com.swifttech.remit.jmecustomer.features.sendmoney.model.SendMoneyRequiredDataV3; -import com.swifttech.remit.jmecustomer.features.sendmoney.model.payoutmode.BankBranchDTO; -import com.swifttech.remit.jmecustomer.features.sendmoney.view.SendMoneyV2Activity; -import com.swifttech.remit.jmecustomer.features.sendmoney.view.payoutmode.PayoutModeBranchListingDialog; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.add.RecipientAddV3ViewModel; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientaddeditV3.edit.RecipientEditV3ViewModel; import com.google.android.material.textfield.TextInputEditText; import com.google.android.material.textfield.TextInputLayout; -import com.swifttech.remit.jmecustomer.features.sendmoney.view.verification.TermsAndConditionV2BrowserActivity; -import com.swifttech.remit.jmecustomer.features.webbrowser.model.WebRequestModel; + +import java.util.ArrayList; +import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import static android.view.View.GONE; -import static com.swifttech.remit.jmecustomer.features.webbrowser.WebBrowserV2Activity.WEB_BROWSWER_URL_BUNDLE_KEY; -public class RecipientAddEditV3Activity extends BaseActivity implements RecipientAddV3ContractInterface, View.OnClickListener { +public class RecipientAddEditV3Activity extends BaseActivity implements RecipientAddV3ContractInterface, View.OnClickListener,ViewPager.OnPageChangeListener { public static final String TAG = RecipientAddEditV3Activity.class.getSimpleName(); @@ -66,234 +52,22 @@ public class RecipientAddEditV3Activity extends BaseActivity implements Recipien @BindView(R.id.toolbar_title) GmeTextView toolbarTitle; - @BindView(R.id.scrollView) - ScrollView scrollView; - - @BindView(R.id.receiverFromViewContainer) - LinearLayout receiverFormViewContainer; - - - @BindView(R.id.recieverCountryViewContainer) - ViewGroup recieverCountryViewContainer; - - @BindView(R.id.recieverCountrySelectionCountryFlag) - ImageView recieverCountrySelectionCountryFlag; - - @BindView(R.id.receiverCountrySelectionWrapper) - TextInputLayout receiverCountrySelectionWrapper; - - @BindView(R.id.ed_receiverCountrySelection) - AutoCompleteTextView ed_receiverCountrySelection; - - - @BindView(R.id.receiverPaymentMethodSelectionWrapper) - TextInputLayout receiverPaymentMethodSelectionWrapper; - - @BindView(R.id.ed_receiverPaymentMethodSelection) - AutoCompleteTextView ed_receiverPaymentMethodSelection; - - - - @BindView(R.id.receiverBankSelectionWrapper) - TextInputLayout receiverBankSelectionWrapper; - - @BindView(R.id.ed_receiverBankSelection) - AutoCompleteTextView ed_receiverBankSelection; - - - - - @BindView(R.id.receiverBranchSelectionWrapper) - TextInputLayout receiverBranchSelectionWrapper; - - @BindView(R.id.ed_receiverBranchSelection) - AutoCompleteTextView ed_receiverBranchSelection; - - @BindView(R.id.receiverAccountNoWrapper) - TextInputLayout receiverAccountNoWrapper; - - @BindView(R.id.ed_receiverAccountNo) - TextInputEditText ed_receiverAccountNo; - - @BindView(R.id.receiverFirstNameWrapper) - TextInputLayout receiverFirstNameWrapper; - - @BindView(R.id.ed_receiverFirstName) - TextInputEditText ed_receiverFirstName; - - @BindView(R.id.receiverMiddleNameWrapper) - TextInputLayout receiverMiddleNameWrapper; - - @BindView(R.id.ed_receiverMiddleName) - TextInputEditText ed_receiverMiddleName; - - @BindView(R.id.receiverLastNameWrapper) - TextInputLayout receiverLastNameWrapper; - - @BindView(R.id.ed_receiverLastName) - TextInputEditText ed_receiverLastName; - - @BindView(R.id.receiverFullNameWrapper) - TextInputLayout receiverFullNameWrapper; - - @BindView(R.id.ed_receiverFullName) - TextInputEditText ed_receiverFullName; - - @BindView(R.id.receiverLocalFirstNameWrapper) - TextInputLayout receiverLocalFirstNameWrapper; - - @BindView(R.id.ed_receiverLocalFirstName) - TextInputEditText ed_receiverLocalFirstName; - - @BindView(R.id.receiverLocalMiddleNameWrapper) - TextInputLayout receiverLocalMiddleNameWrapper; - - @BindView(R.id.ed_receiverLocalMiddleName) - TextInputEditText ed_receiverLocalMiddleName; - - @BindView(R.id.receiverLocalLastNameWrapper) - TextInputLayout receiverLocalLastNameWrapper; - - @BindView(R.id.ed_receiverLocalLastName) - TextInputEditText ed_receiverLocalLastName; - - - @BindView(R.id.receiverLocalFullNameWrapper) - TextInputLayout receiverLocalFullNameWrapper; - - @BindView(R.id.ed_receiverLocalFullName) - TextInputEditText ed_receiverLocalFullName; - - @BindView(R.id.receiverStateSelectionWrapper) - TextInputLayout receiverStateSelectionWrapper; - - @BindView(R.id.ed_receiverStateSelection) - AutoCompleteTextView ed_receiverStateSelection; - - - @BindView(R.id.receiverDistrictSelectionWrapper) - TextInputLayout receiverDistrictSelectionWrapper; - - @BindView(R.id.ed_receiverDistrictSelection) - AutoCompleteTextView ed_receiverDistrictSelection; - - - @BindView(R.id.receiverCityWrapper) - TextInputLayout receiverCityWrapper; - - @BindView(R.id.ed_receiverCity) - TextInputEditText ed_receiverCity; - - - @BindView(R.id.receiverAddressWrapper) - TextInputLayout receiverAddressWrapper; - - @BindView(R.id.ed_receiverAddress) - TextInputEditText ed_receiverAddress; - - @BindView(R.id.receiverRelationSelectionWrapper) - TextInputLayout receiverRelationSelectionWrapper; - - @BindView(R.id.ed_receiverRelationSelection) - AutoCompleteTextView ed_receiverRelationSelection; - - @BindView(R.id.receiverEmailWrapper) - TextInputLayout receiverEmailWrapper; - - @BindView(R.id.ed_receiverEmail) - TextInputEditText ed_receiverEmail; - - @BindView(R.id.receiverTransferReasonSelectionWrapper) - TextInputLayout receiverTransferReasonSelectionWrapper; - - @BindView(R.id.ed_receiverTransferReasonSelection) - AutoCompleteTextView ed_receiverTransferReasonSelection; - - @BindView(R.id.receiverIDTypeSelectionWrapper) - TextInputLayout receiverIDTypeSelectionWrapper; - - @BindView(R.id.ed_receiverIDTypeSelection) - AutoCompleteTextView ed_receiverIDTypeSelection; - - @BindView(R.id.receiverIdNumberWrapper) - TextInputLayout receiverIdNumberWrapper; - - @BindView(R.id.ed_receiverIdNumber) - TextInputEditText ed_receiverIdNumber; - - @BindView(R.id.selectedCountryIcon) - ImageView selectedCountryIcon; - - @BindView(R.id.mobileViewContainer) - ConstraintLayout mobileViewContainer; - - @BindView(R.id.selectedCountryMobilePrefix) - TextView selectedCountryMobilePrefix; - - @BindView(R.id.receiverMobileNoWrapper) - TextInputLayout receiverMobileNoWrapper; - - @BindView(R.id.ed_receiverMobileNo) - TextInputEditText ed_receiverMobileNo; - - @BindView(R.id.recieverNativeCountryViewContainer) - ViewGroup recieverNativeCountryViewContainer; - - @BindView(R.id.receiverNativeCountrySelectionWrapper) - TextInputLayout receiverNativeCountrySelectionWrapper; - - @BindView(R.id.ed_receiverNativeCountrySelection) - AutoCompleteTextView ed_receiverNativeCountrySelection; - - @BindView(R.id.recieverNativeCountrySelectionCountryFlag) - ImageView recieverNativeCountrySelectionCountryFlag; - @BindView(R.id.iv_back) View iv_back; @BindView(R.id.iv_cancel) View iv_cancel; - @BindView(R.id.btn_submit) - Button submitBtn; - - @BindView(R.id.txv_jme_terms_n_condition) - GmeTextView txvTermsAndConditions; - - - GenericImageWithTextListingDialog countryListingDialog; - GenericImageWithTextListingDialog nativeCountryListingDialog; - GenericImageWithTextListingDialog serviceMethodListingDialog; - GenericTextListingDialog bankListingDialog; - RecipientBranchListingDialog branchListingDialog; - GenericTextListingDialog stateListingDialog; - GenericTextListingDialog districtListingDialog; - GenericTextListingDialog relationMethodListingDialog; - GenericTextListingDialog transferListingDialog; - GenericTextListingDialog idTypeListingDialog; - + private ReceiverInfoV3Model recipientToBeEdited; public static String RECIPIENT_INFO_BUNDLE_KEY = "recipientInfoKey"; - private RecipientPresenterInterface presenter; - - private RecipientAccountNoTextWatcher recieverAccountNoTextWatcher; - - private RecipientFirstNameTextWatcher recieverFirstNameTextWatcher; - private RecipientMiddleNameTextWatcher recieverMiddleNameTextWatcher; - private RecipientLastNameTextWatcher recieverLastNameTextWatcher; - private RecipientFullNameTextWatcher recieverFullNameTextWatcher; - - private RecipientLocalFirstNameTextWatcher recieverFirstNameLocalTextWatcher; - private RecipientLocalMiddleNameTextWatcher recieverMiddleNameLocalTextWatcher; - private RecipientLocalLastNameTextWatcher recieverLastNameLocalTextWatcher; - private RecipientLocalFullNameTextWatcher recieverLocalFullNameTextWatcher; + @BindView(R.id.addBeneficiaryV3ViewPager) + ViewPager addBeneficiaryV3ViewPager; - private RecipientCityTextWatcher recieverCityTextWatcher; - private RecipientAddressTextWatcher recieverAddressTextWatcher; - private RecipientMobileNumberTextWatcher recieverMobileNoTextWatcher; - private RecipientEmailTextWatcher recieverEmailTextWatcher; - private RecipientIdNumberTextWatcher recieverIdNumberTextWatcher; + private BeneficiaryAddEditV3Fragment beneficiaryAddEditV3Fragment; + private BeneficiaryAddEditV3TermsFragment beneficiaryAddEditV3TermsFragment; + private GenericViewPagerAdapter addBeneficiaryV3ViewPagerAdapter; @Override @@ -301,149 +75,60 @@ public class RecipientAddEditV3Activity extends BaseActivity implements Recipien super.onCreate(savedInstanceState); setContentView(R.layout.activity_recipient_add_edit_v3); ButterKnife.bind(this); + setupViewPager(); init(); } - private void init() { - initTextWatchers(); - removeInputFiltersByDefault(); - ReceiverInfoV3Model recipientToBeEdited = getIntent().getParcelableExtra(RECIPIENT_INFO_BUNDLE_KEY); - if (recipientToBeEdited != null) { - toolbarTitle.setText(getString(R.string.edit_recipient_text)); - presenter = new RecipientEditV3Presenter(new RecipientAddEditV3Gateway(), this, recipientToBeEdited); - } else { - toolbarTitle.setText(getString(R.string.add_recipient_text)); - presenter = new RecipientAddV3Presenter(new RecipientAddEditV3Gateway(), this, recipientToBeEdited); - } - - iv_cancel.setVisibility(View.INVISIBLE); - - } - - private void removeInputFiltersByDefault() { - ed_receiverPaymentMethodSelection.setFilters(new InputFilter[]{}); - ed_receiverLocalFullName.setFilters(new InputFilter[]{}); - ed_receiverLocalLastName.setFilters(new InputFilter[]{}); - ed_receiverLocalMiddleName.setFilters(new InputFilter[]{}); - ed_receiverLocalFirstName.setFilters(new InputFilter[]{}); - } - + private void setupViewPager() { - private void initTextWatchers() { - Log.d(TAG, "Textwatcher Init"); + addBeneficiaryV3ViewPagerAdapter = new GenericViewPagerAdapter(getSupportFragmentManager()); - recieverAccountNoTextWatcher = new RecipientAccountNoTextWatcher(); - recieverFirstNameTextWatcher = new RecipientFirstNameTextWatcher(); - recieverMiddleNameTextWatcher = new RecipientMiddleNameTextWatcher(); - recieverLastNameTextWatcher = new RecipientLastNameTextWatcher(); - recieverFullNameTextWatcher = new RecipientFullNameTextWatcher(); + List fragments = new ArrayList<>(); + Bundle bundle = new Bundle(); - recieverFirstNameLocalTextWatcher = new RecipientLocalFirstNameTextWatcher(); - recieverMiddleNameLocalTextWatcher = new RecipientLocalMiddleNameTextWatcher(); - recieverLastNameLocalTextWatcher = new RecipientLocalLastNameTextWatcher(); - recieverLocalFullNameTextWatcher = new RecipientLocalFullNameTextWatcher(); + bundle.putParcelable(RECIPIENT_UPDATED_ID_BUNDLE_KEY, recipientToBeEdited); - recieverCityTextWatcher = new RecipientCityTextWatcher(); - recieverAddressTextWatcher = new RecipientAddressTextWatcher(); - recieverMobileNoTextWatcher = new RecipientMobileNumberTextWatcher(); - recieverEmailTextWatcher = new RecipientEmailTextWatcher(); - recieverIdNumberTextWatcher = new RecipientIdNumberTextWatcher(); + beneficiaryAddEditV3Fragment = new BeneficiaryAddEditV3Fragment(); - } + beneficiaryAddEditV3Fragment.setArguments(bundle); - @Override - public void registerTextWatchers(boolean action) { - if (action) { - ed_receiverAccountNo.addTextChangedListener(recieverAccountNoTextWatcher); + beneficiaryAddEditV3TermsFragment = new BeneficiaryAddEditV3TermsFragment(); - ed_receiverFirstName.addTextChangedListener(recieverFirstNameTextWatcher); - ed_receiverMiddleName.addTextChangedListener(recieverMiddleNameTextWatcher); - ed_receiverLastName.addTextChangedListener(recieverLastNameTextWatcher); - ed_receiverFullName.addTextChangedListener(recieverFullNameTextWatcher); + beneficiaryAddEditV3TermsFragment.setArguments(bundle); + fragments.add(beneficiaryAddEditV3Fragment); - ed_receiverLocalFirstName.addTextChangedListener(recieverFirstNameLocalTextWatcher); - ed_receiverLocalMiddleName.addTextChangedListener(recieverMiddleNameLocalTextWatcher); - ed_receiverLocalLastName.addTextChangedListener(recieverLastNameLocalTextWatcher); - ed_receiverLocalFullName.addTextChangedListener(recieverLocalFullNameTextWatcher); + fragments.add(beneficiaryAddEditV3TermsFragment); - ed_receiverCity.addTextChangedListener(recieverCityTextWatcher); - ed_receiverAddress.addTextChangedListener(recieverAddressTextWatcher); - ed_receiverMobileNo.addTextChangedListener(recieverMobileNoTextWatcher); - ed_receiverEmail.addTextChangedListener(recieverEmailTextWatcher); - ed_receiverIdNumber.addTextChangedListener(recieverIdNumberTextWatcher); - } else { + addBeneficiaryV3ViewPagerAdapter.addFragments(fragments); - ed_receiverAccountNo.removeTextChangedListener(recieverAccountNoTextWatcher); + addBeneficiaryV3ViewPager.setOffscreenPageLimit(2); - ed_receiverFirstName.removeTextChangedListener(recieverFirstNameTextWatcher); - ed_receiverMiddleName.removeTextChangedListener(recieverMiddleNameTextWatcher); - ed_receiverLastName.removeTextChangedListener(recieverLastNameTextWatcher); - ed_receiverFullName.removeTextChangedListener(recieverFullNameTextWatcher); + addBeneficiaryV3ViewPager.addOnPageChangeListener(this); + addBeneficiaryV3ViewPager.setAdapter(addBeneficiaryV3ViewPagerAdapter); - ed_receiverLocalFirstName.removeTextChangedListener(recieverFirstNameLocalTextWatcher); - ed_receiverLocalMiddleName.removeTextChangedListener(recieverMiddleNameLocalTextWatcher); - ed_receiverLocalLastName.removeTextChangedListener(recieverLastNameLocalTextWatcher); - ed_receiverLocalFullName.removeTextChangedListener(recieverLocalFullNameTextWatcher); - ed_receiverCity.removeTextChangedListener(recieverCityTextWatcher); - ed_receiverAddress.removeTextChangedListener(recieverAddressTextWatcher); - ed_receiverMobileNo.removeTextChangedListener(recieverMobileNoTextWatcher); - ed_receiverEmail.removeTextChangedListener(recieverEmailTextWatcher); - ed_receiverIdNumber.removeTextChangedListener(recieverIdNumberTextWatcher); - } } - @Override - public void setSubmitButtonEnabled(boolean action) { - submitBtn.setEnabled(action); - } + private void init() { + recipientToBeEdited = getIntent().getParcelableExtra(RECIPIENT_INFO_BUNDLE_KEY); + iv_cancel.setVisibility(View.INVISIBLE); - private void registerClickListener(boolean action) { - if (action) { - ed_receiverCountrySelection.setOnClickListener(new CountrySelectionClickListener()); - ed_receiverNativeCountrySelection.setOnClickListener(new NativeCountrySelectionClickListener()); - ed_receiverPaymentMethodSelection.setOnClickListener(new PaymentMethodSelectionClickListener()); - ed_receiverBankSelection.setOnClickListener(new BankSelectionClickListener()); - ed_receiverBranchSelection.setOnClickListener(new BranchSelectionClickListener()); - ed_receiverStateSelection.setOnClickListener(new StateSelectionClickListener()); - ed_receiverDistrictSelection.setOnClickListener(new DistrictSelectionClickListener()); - ed_receiverRelationSelection.setOnClickListener(new RelationSelectionClickListener()); - ed_receiverTransferReasonSelection.setOnClickListener(new TransferReasonSelectionClickListener()); - ed_receiverIDTypeSelection.setOnClickListener(new IDTypeSelectionClickListener()); - } else { - ed_receiverCountrySelection.setOnClickListener(null); - ed_receiverNativeCountrySelection.setOnClickListener(null); - ed_receiverPaymentMethodSelection.setOnClickListener(null); - ed_receiverBankSelection.setOnClickListener(null); - ed_receiverBranchSelection.setOnClickListener(null); - ed_receiverStateSelection.setOnClickListener(null); - ed_receiverDistrictSelection.setOnClickListener(null); - ed_receiverRelationSelection.setOnClickListener(null); - ed_receiverTransferReasonSelection.setOnClickListener(null); - ed_receiverIDTypeSelection.setOnClickListener(null); - } } @Override protected void onStart() { super.onStart(); - registerClickListener(true); iv_back.setOnClickListener(this); - submitBtn.setOnClickListener(this); - txvTermsAndConditions.setOnClickListener(this); } @Override protected void onStop() { super.onStop(); - registerClickListener(false); iv_back.setOnClickListener(null); - submitBtn.setOnClickListener(null); - txvTermsAndConditions.setOnClickListener(null); } @@ -455,349 +140,7 @@ public class RecipientAddEditV3Activity extends BaseActivity implements Recipien finish(); } - @Override - public void showSelectedCountryFlag(int id) { - - recieverCountrySelectionCountryFlag.setImageResource(id); - - if (recieverCountrySelectionCountryFlag.getVisibility() != View.VISIBLE) { - TransitionManager.beginDelayedTransition(recieverCountryViewContainer); - recieverCountrySelectionCountryFlag.setVisibility(View.VISIBLE); - } - - - } - - @Override - public void showCountrySelectionView(boolean visiblity) { - if (visiblity) - recieverCountryViewContainer.setVisibility(View.VISIBLE); - else - recieverCountryViewContainer.setVisibility(View.GONE); - - } - - @Override - public void showPaymentSelectionView(boolean visiblity) { - if (visiblity) - receiverPaymentMethodSelectionWrapper.setVisibility(View.VISIBLE); - else - receiverPaymentMethodSelectionWrapper.setVisibility(View.GONE); - - } - - @Override - public void updateValidationRuleToWidgetPaymentMethodSelection(boolean visiblity) { - if (visiblity) - receiverPaymentMethodSelectionWrapper.setVisibility(View.VISIBLE); - else - receiverPaymentMethodSelectionWrapper.setVisibility(View.GONE); - } - - @Override - public void hideAllViewExceptCountry() { - hideViewFromIndexId(2); - - } - - @Override - public void promptToSendMoney(GenericPromptDialog.GenericDialogPromptListener listener, String message) { - GenericPromptDialog genericPromptDialog = new GenericPromptDialog(); - genericPromptDialog.setTitleMessage(getString(R.string.important_text)); - genericPromptDialog.setBodyMessage(message); - genericPromptDialog.setIconsRes(-1); - genericPromptDialog.setCancellable(true); - genericPromptDialog.setListener(listener); - if (!genericPromptDialog.isAdded()) - genericPromptDialog.show(getSupportFragmentManager(), "PROMPTSENDMONEY"); - } - - @Override - public void hideAllFormFieldsExceptCountryAndPaymentMethod() { - recieverCountryViewContainer.setVisibility(View.VISIBLE); - receiverPaymentMethodSelectionWrapper.setVisibility(View.VISIBLE); - hideViewFromIndexId(3); - } - - @Override - public void redirectToSendMoney(SendMoneyRequiredDataV3 sendMoneyRequiredDataV3) { - Intent intent = new Intent(RecipientAddEditV3Activity.this, SendMoneyV2Activity.class); - intent.putExtra(RecipientAddEditV3Activity.RECIPIENT_INFO_BUNDLE_KEY, sendMoneyRequiredDataV3); - startActivity(intent); - } - - - @Override - public void updateValueToWidgetSelectedPaymentMethod(String description) { - Log.d(this.getClass().getSimpleName(), "Selected method type: " + description); - ed_receiverPaymentMethodSelection.setText(description); - - } - - - @Override - public void updateValueToWidgetSelectedCountry(String countryName) { - ed_receiverCountrySelection.setText(countryName); - } - - - @Override - public void updateValueToWidgetBankName(String value) { - ed_receiverBankSelection.setText(value); - } - - @Override - public void updateValueToWidgetBranchName(String value) { - ed_receiverBranchSelection.setText(value); - } - - @Override - public void updateValueToWidgetAccountNo(String value) { - ed_receiverAccountNo.setText(value); - } - - @Override - public void updateValueToWidgetIDType(String value) { - ed_receiverIDTypeSelection.setText(value); - } - - @Override - public void updateValueToWidgetIDNumber(String value) { - ed_receiverIdNumber.setText(value); - } - - @Override - public void updateValueToWidgetFirstName(String value) { - ed_receiverFirstName.setText(value); - } - - @Override - public void updateValueToWidgetMiddleName(String value) { - ed_receiverMiddleName.setText(value); - } - - @Override - public void updateValueToWidgetLastName(String value) { - ed_receiverLastName.setText(value); - } - - @Override - public void updateValueToWidgetFullName(String value) { - ed_receiverFullName.setText(value); - } - - @Override - public void updateValueToWidgetLocalFirstName(String value) { - ed_receiverLocalFirstName.setText(value); - } - - @Override - public void updateValueToWidgetLocalMiddleName(String value) { - ed_receiverLocalMiddleName.setText(value); - } - - @Override - public void updateValueToWidgetLocalLastName(String value) { - ed_receiverLocalLastName.setText(value); - } - - @Override - public void updateValueToWidgetLocalFullName(String name) { - ed_receiverLocalFullName.setText(name); - } - - @Override - public void updateValueToWidgetMobileNumber(String value) { - ed_receiverMobileNo.setText(value); - } - - @Override - public void updateValueToWidgetProvince(String value) { - ed_receiverStateSelection.setText(value); - } - - @Override - public void updateValueToWidgetDistrict(String value) { - ed_receiverDistrictSelection.setText(value); - } - - @Override - public void updateValueToWidgetCity(String value) { - ed_receiverCity.setText(value); - } - - @Override - public void updateValueToWidgetAddress(String value) { - ed_receiverAddress.setText(value); - } - - @Override - public void updateValueToWidgetRelation(String value) { - ed_receiverRelationSelection.setText(value); - } - - @Override - public void updateValueToWidgetTransferReason(String value) { - ed_receiverTransferReasonSelection.setText(value); - } - - @Override - public void updateValueToWidgetNativeCountry(String nativeCountry) { - ed_receiverNativeCountrySelection.setText(nativeCountry); - } - - @Override - public void updateValueToWidgetEmail(String email) { - ed_receiverEmail.setText(email); - } - - @Override - public void updateValidationRuleToWidgetLocalFullName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { - editTextConfiguration.applyConfigurationSetting(ed_receiverLocalFullName); - if (fieldRequired) { - receiverLocalFullNameWrapper.setVisibility(View.VISIBLE); - } else - receiverLocalFullNameWrapper.setVisibility(GONE); - } - - - @Override - public void updateValidationRuleToWidgetBankName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { -// editTextConfiguration.applyConfigurationSetting(recieverBankSelectionFormInputField.getEditTextView()); - if (fieldRequired) { - receiverBankSelectionWrapper.setVisibility(View.VISIBLE); - } else - receiverBankSelectionWrapper.setVisibility(GONE); - } - - @Override - public void updateValidationRuleToWidgetBranchName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { -// if (editTextConfiguration != null) -// editTextConfiguration.applyConfigurationSetting(recieverBranchSelectionFormInputField.getEditTextView()); - if (fieldRequired) { - receiverBranchSelectionWrapper.setVisibility(View.VISIBLE); - } else - receiverBranchSelectionWrapper.setVisibility(GONE); - } - - @Override - public void updateValidationRuleToWidgetAccountNo(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { - if(editTextConfiguration!=null) - editTextConfiguration.applyConfigurationSetting(ed_receiverAccountNo); - - if (fieldRequired) - receiverAccountNoWrapper.setVisibility(View.VISIBLE); - else - receiverAccountNoWrapper.setVisibility(GONE); - } - - @Override - public void updateValidationRuleToWidgetIDType(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { -// editTextConfiguration.applyConfigurationSetting(recieverIDTypeSelectionFormInputField.getEditTextView()); - if (fieldRequired) { - receiverIDTypeSelectionWrapper.setVisibility(View.VISIBLE); - } else - receiverIDTypeSelectionWrapper.setVisibility(GONE); - } - - @Override - public void updateValidationRuleToWidgetIDNumber(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { - editTextConfiguration.applyConfigurationSetting(ed_receiverIdNumber); - if (fieldRequired) { - receiverIdNumberWrapper.setVisibility(View.VISIBLE); - } else - receiverIdNumberWrapper.setVisibility(GONE); - } - - @Override - public void updateValidationRuleToWidgetFirstName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { - editTextConfiguration.applyConfigurationSetting(ed_receiverFirstName); - if (fieldRequired) { - receiverFirstNameWrapper.setVisibility(View.VISIBLE); - } else - receiverFirstNameWrapper.setVisibility(GONE); - } - - @Override - public void updateValidationRuleToWidgetMiddleName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { - editTextConfiguration.applyConfigurationSetting(ed_receiverMiddleName); - if (fieldRequired) { - receiverMiddleNameWrapper.setVisibility(View.VISIBLE); - } else - receiverMiddleNameWrapper.setVisibility(GONE); - } - - @Override - public void updateValidationRuleToWidgetLastName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { - editTextConfiguration.applyConfigurationSetting(ed_receiverLastName); - if (fieldRequired) { - receiverLastNameWrapper.setVisibility(View.VISIBLE); - } else - receiverLastNameWrapper.setVisibility(GONE); - } - - @Override - public void updateValidationRuleToWidgetFullName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { - editTextConfiguration.applyConfigurationSetting(ed_receiverFullName); - if (fieldRequired) { - receiverFullNameWrapper.setVisibility(View.VISIBLE); - } else - receiverFullNameWrapper.setVisibility(GONE); - } - - @Override - public void updateValidationRuleToWidgetLocalFirstName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { - editTextConfiguration.applyConfigurationSetting(ed_receiverLocalFirstName); - if (fieldRequired) { - receiverLocalFirstNameWrapper.setVisibility(View.VISIBLE); - } else - receiverLocalFirstNameWrapper.setVisibility(GONE); - } - - @Override - public void updateValidationRuleToWidgetLocalMiddleName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { - editTextConfiguration.applyConfigurationSetting(ed_receiverLocalMiddleName); - if (fieldRequired) { - receiverLocalMiddleNameWrapper.setVisibility(View.VISIBLE); - } else - receiverLocalMiddleNameWrapper.setVisibility(GONE); - } - - @Override - public void updateValidationRuleToWidgetLocalLastName(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { - editTextConfiguration.applyConfigurationSetting(ed_receiverLocalLastName); - if (fieldRequired) { - receiverLocalLastNameWrapper.setVisibility(View.VISIBLE); - } else - receiverLocalLastNameWrapper.setVisibility(GONE); - } - - @Override - public void updateValidationRuleToWidgetMobileNumber(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { - editTextConfiguration.applyConfigurationSetting(ed_receiverMobileNo); - if (fieldRequired) { - mobileViewContainer.setVisibility(View.VISIBLE); - } else - mobileViewContainer.setVisibility(GONE); - } - - @Override - public void showMobilePrefixAndFlag(String prefix, int flag) { - - if (prefix == null) { - selectedCountryIcon.setVisibility(GONE); - selectedCountryMobilePrefix.setVisibility(GONE); - selectedCountryMobilePrefix.setText(""); - return; - } - selectedCountryIcon.setImageResource(flag); - selectedCountryMobilePrefix.setText(prefix); - selectedCountryIcon.setVisibility(View.VISIBLE); - selectedCountryMobilePrefix.setVisibility(View.VISIBLE); - - - } @Override public void onEditSuccess(String recipientIdToBeUpdated) { @@ -816,350 +159,17 @@ public class RecipientAddEditV3Activity extends BaseActivity implements Recipien } @Override - public void scrollAccountNumberView() { - if (receiverBankSelectionWrapper.getVisibility() == View.VISIBLE) { - scrollView.post(new Runnable() { - @Override - public void run() { - scrollView.smoothScrollTo(0, receiverBankSelectionWrapper.getTop()); - } - }); - } - } - - @Override - public void clearViewDependentOnServiceType() { - ed_receiverAccountNo.setText(""); - - ed_receiverFirstName.setText(""); - ed_receiverMiddleName.setText(""); - ed_receiverLastName.setText(""); - ed_receiverFullName.setText(""); + public void showTermsAndConditionScreen() { - - ed_receiverLocalFirstName.setText(""); - ed_receiverLocalMiddleName.setText(""); - ed_receiverLocalLastName.setText(""); - ed_receiverLocalFullName.setText(""); - - ed_receiverCity.setText(""); - ed_receiverAddress.setText(""); - ed_receiverMobileNo.setText(""); - ed_receiverEmail.setText(""); - ed_receiverIdNumber.setText(""); - - - ed_receiverBankSelection.setText(""); - ed_receiverBranchSelection.setText(""); - ed_receiverStateSelection.setText(""); - ed_receiverDistrictSelection.setText(""); - ed_receiverRelationSelection.setText(""); - ed_receiverTransferReasonSelection.setText(""); - ed_receiverIDTypeSelection.setText(""); - } - - @Override - public void clearViewDependentOnCountryServiceSelected() { - - ed_receiverPaymentMethodSelection.setText(""); - - clearViewDependentOnServiceType(); - } - - @Override - public void showNativeCountryFlag(int flagFromCountryCode) { - recieverNativeCountrySelectionCountryFlag.setImageResource(flagFromCountryCode); - - if (recieverNativeCountrySelectionCountryFlag.getVisibility() != View.VISIBLE) { - TransitionManager.beginDelayedTransition(recieverCountryViewContainer); - recieverNativeCountrySelectionCountryFlag.setVisibility(View.VISIBLE); - } - - } - - - @Override - public void updateValidationRuleToWidgetProvince(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { -// editTextConfiguration.applyConfigurationSetting(recieverStateSelectionFormInputField.getEditTextView()); - if (fieldRequired) { - receiverStateSelectionWrapper.setVisibility(View.VISIBLE); - } else - receiverStateSelectionWrapper.setVisibility(GONE); - } - - @Override - public void updateValidationRuleToWidgetDistrict(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { -// editTextConfiguration.applyConfigurationSetting(recieverDistrictSelectionFormInputField.getEditTextView()); - if (fieldRequired) { - receiverDistrictSelectionWrapper.setVisibility(View.VISIBLE); - } else - receiverDistrictSelectionWrapper.setVisibility(GONE); - } - - @Override - public void updateValidationRuleToWidgetCity(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { - if(editTextConfiguration!=null) - editTextConfiguration.applyConfigurationSetting(ed_receiverCity); - - if (fieldRequired) { - receiverCityWrapper.setVisibility(View.VISIBLE); - } else - receiverCityWrapper.setVisibility(GONE); - } - - @Override - public void updateValidationRuleToWidgetAddress(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { - editTextConfiguration.applyConfigurationSetting(ed_receiverAddress); - if (fieldRequired) { - receiverAddressWrapper.setVisibility(View.VISIBLE); - } else - receiverAddressWrapper.setVisibility(GONE); - } - - @Override - public void updateValidationRuleToWidgetRelation(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { -// editTextConfiguration.applyConfigurationSetting(recieverRelationSelectionFormInputField.getEditTextView()); - if (fieldRequired) { - receiverRelationSelectionWrapper.setVisibility(View.VISIBLE); - } else - receiverRelationSelectionWrapper.setVisibility(GONE); - } - - @Override - public void updateValidationRuleToWidgetTransferReason(boolean fieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { -// editTextConfiguration.applyConfigurationSetting(recieverTransferReasonSelectionFormInputField.getEditTextView()); - if (fieldRequired) { - receiverTransferReasonSelectionWrapper.setVisibility(View.VISIBLE); - } else - receiverTransferReasonSelectionWrapper.setVisibility(GONE); - } - - @Override - public void updateValidationRuleToWidgetEmail(boolean isFieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { -// editTextConfiguration.applyConfigurationSetting(ed_receiverTransferReasonSelection); --->??? - editTextConfiguration.applyConfigurationSetting(ed_receiverEmail); - if (isFieldRequired) { - receiverEmailWrapper.setVisibility(View.VISIBLE); - } else - receiverEmailWrapper.setVisibility(GONE); - } - - @Override - public void updateValidationRuleToWidgetNativeCountry(boolean isFieldRequired, EditTextConfigurationFactory.EditTextConfiguration keyboardTypeFromKeyword) { - if (isFieldRequired) { - recieverNativeCountryViewContainer.setVisibility(View.VISIBLE); - } else - recieverNativeCountryViewContainer.setVisibility(GONE); - } - - @Override - public void setErrorOnWidgetBank(String error) { - ed_receiverBankSelection.setError(error); - } - - - @Override - public void setErrorOnWidgetAccountNo(String error) { - receiverAccountNoWrapper.setError(error); - } - - @Override - public void setErrorOnWidgetFirstName(String error) { - receiverFirstNameWrapper.setError(error); - } - - @Override - public void setErrorOnWidgetMiddleName(String error) { - receiverMiddleNameWrapper.setError(error); - } - - @Override - public void setErrorOnWidgetLastName(String error) { - receiverLastNameWrapper.setError(error); - } - - @Override - public void setErrorOnWidgetFullName(String error) { - receiverFullNameWrapper.setError(error); - - } - - @Override - public void setErrorOnWidgetCity(String error) { - receiverCityWrapper.setError(error); } @Override - public void setErrorOnWidgetAddress(String error) { - receiverAddressWrapper.setError(error); + public RecipientAddEditV3ContractInterface getRecipientAddEditV3ContractInterface() { + return beneficiaryAddEditV3Fragment; } - @Override - public void setErrorOnWidgetMobileNumber(String error) { - receiverMobileNoWrapper.setError(error); - } - - @Override - public void setErrorOnWidgetEmail(String error) { - receiverEmailWrapper.setError(error); - } - - @Override - public void setErrorOnWidgetIDNumber(String error) { - receiverIdNumberWrapper.setError(error); - - } - - @Override - public void setErrorOnWidgetLocalFirstName(String error) { - receiverLocalFirstNameWrapper.setError(error); - } - - @Override - public void setErrorOnWidgetLocalMiddleName(String error) { - receiverLocalMiddleNameWrapper.setError(error); - } - - @Override - public void setErrorOnWidgetLocalLastName(String error) { - receiverLocalLastNameWrapper.setError(error); - } - - @Override - public void setErrorOnWidgetLocalFullName(String error) { - receiverLocalFullNameWrapper.setError(error); - } - - @Override - public void addOptionalAsHintToWidgetBankName(Boolean isOptional) { - ValidationUtils.updateHint(receiverBankSelectionWrapper, isOptional); - } - - @Override - public void addOptionalAsHintToWidgetBranch(Boolean isOptional) { - ValidationUtils.updateHint(receiverBranchSelectionWrapper, isOptional); - } - - @Override - public void addOptionalAsHintToWidgetAccountNumber(Boolean isOptional) { - ValidationUtils.updateHint(receiverAccountNoWrapper, isOptional); - - } - - @Override - public void addOptionalAsHintToWidgetIDType(Boolean isOptional) { - ValidationUtils.updateHint(receiverIDTypeSelectionWrapper, isOptional); - } - - @Override - public void addOptionalAsHintToWidgetIDNumber(Boolean isOptional) { - ValidationUtils.updateHint(receiverIdNumberWrapper, isOptional); - } - - @Override - public void addOptionalAsHintToWidgetFirstName(Boolean isOptional) { - ValidationUtils.updateHint(receiverFirstNameWrapper, isOptional); - } - - @Override - public void addOptionalAsHintToWidgetMiddleName(Boolean isOptional) { - ValidationUtils.updateHint(receiverMiddleNameWrapper, isOptional); - } - - @Override - public void addOptionalAsHintToWidgetLastName(Boolean isOptional) { - ValidationUtils.updateHint(receiverLastNameWrapper, isOptional); - } - - @Override - public void addOptionalAsHintToWidgetFullName(Boolean isOptional) { - ValidationUtils.updateHint(receiverFullNameWrapper, isOptional); - } - - @Override - public void addOptionalAsHintToWidgetLocalFirstName(Boolean isOptional) { - ValidationUtils.updateHint(receiverLocalFirstNameWrapper, isOptional); - } - - @Override - public void addOptionalAsHintToWidgetLocalMiddleName(Boolean isOptional) { - ValidationUtils.updateHint(receiverLocalMiddleNameWrapper, isOptional); - } - - @Override - public void addOptionalAsHintToWidgetLocalLastName(Boolean isOptional) { - ValidationUtils.updateHint(receiverLocalLastNameWrapper, isOptional); - } - - @Override - public void addOptionalAsHintToWidgetLocalFullName(Boolean isOptional) { - ValidationUtils.updateHint(receiverLocalFullNameWrapper, isOptional); - } - @Override - public void addOptionalAsHintToWidgetMobileNumber(Boolean isOptional) { - ValidationUtils.updateHint(receiverMobileNoWrapper, isOptional); - } - - @Override - public void addOptionalAsHintToWidgetProvince(Boolean isOptional) { - ValidationUtils.updateHint(receiverStateSelectionWrapper, isOptional); - } - - @Override - public void addOptionalAsHintToWidgetDistrict(Boolean isOptional) { - ValidationUtils.updateHint(receiverDistrictSelectionWrapper, isOptional); - } - - @Override - public void addOptionalAsHintToWidgetCity(Boolean isOptional) { - ValidationUtils.updateHint(receiverCityWrapper, isOptional); - } - - @Override - public void addOptionalAsHintToWidgetAddress(Boolean isOptional) { - ValidationUtils.updateHint(receiverAddressWrapper, isOptional); - } - - @Override - public void addOptionalAsHintToWidgetRelation(Boolean isOptional) { - ValidationUtils.updateHint(receiverRelationSelectionWrapper, isOptional); - } - - @Override - public void addOptionalAsHintToWidgetTransferReason(Boolean isOptional) { - ValidationUtils.updateHint(receiverTransferReasonSelectionWrapper, isOptional); - } - - @Override - public void addOptionalAsHintToWidgetEmail(Boolean isOptional) { - ValidationUtils.updateHint(receiverEmailWrapper, isOptional); - } - - @Override - public void addOptionalAsHintToWidgetNativeCountry(Boolean isOptional) { - ValidationUtils.updateHint(receiverNativeCountrySelectionWrapper, isOptional); - - } - - @Override - public void promptToInputAnswer(String question, AnswerInputDialog.AnswerInputDialogListener listener) { - - AnswerInputDialog answerInputDialog=new AnswerInputDialog(); - answerInputDialog.setQuestionText(question); - answerInputDialog.setAnswerListener(listener); - if(!answerInputDialog.isAdded()) - answerInputDialog.show(getSupportFragmentManager(),answerInputDialog.getClass().getSimpleName()); - } - - private void hideViewFromIndexId(int indexId) { - if (indexId < 0) - return; - for (int i = indexId; i < receiverFormViewContainer.getChildCount() - 1; i++) { - receiverFormViewContainer.getChildAt(i).setVisibility(GONE); - } - } @Override public void onClick(View v) { @@ -1168,348 +178,30 @@ public class RecipientAddEditV3Activity extends BaseActivity implements Recipien case R.id.iv_back: onBackPressed(); break; - - case R.id.btn_submit: - if (submitBtn.isEnabled()) - presenter.onSubmitBtnPressed(); - break; - - case R.id.txv_jme_terms_n_condition: - openJmeTermsAndCondition(); - break; - - } - } - - private void openJmeTermsAndCondition() { - WebRequestModel requestModel = presenter.getWebRequestDataForTermsAndCondition(); - Intent intent = new Intent(this, TermsAndConditionV2BrowserActivity.class); - intent.putExtra(WEB_BROWSWER_URL_BUNDLE_KEY, requestModel); - startActivity(intent); - } - - - public class CountrySelectionClickListener implements View.OnClickListener { - - @Override - public void onClick(View v) { - Log.d("ONTAPTEST","On Tapperd"); - hideKeyBoard(); - if (countryListingDialog == null) - countryListingDialog = new GenericImageWithTextListingDialog<>(); - countryListingDialog.setData(presenter.getAvailableCountryServiceData()); - countryListingDialog.setListener(countryServiceModel -> - { - presenter.onCountryServiceSelected(countryServiceModel); - countryListingDialog.dismiss(); - - }); - countryListingDialog.setHintAndTitle(getString(R.string.search_payout_country_text), getString(R.string.payout_country_placeholder_text), getString(R.string.no_payout_country_found_text)); - countryListingDialog.disableSearch(false); - if (!countryListingDialog.isAdded()) - countryListingDialog.show(getSupportFragmentManager(), this.getClass().getSimpleName()); - } - } - public class NativeCountrySelectionClickListener implements View.OnClickListener { - @Override - public void onClick(View v) { - hideKeyBoard(); - if (nativeCountryListingDialog == null) - nativeCountryListingDialog = new GenericImageWithTextListingDialog<>(); - nativeCountryListingDialog.setData(presenter.getAvailableNativeCountryServiceData()); - nativeCountryListingDialog.setListener(countryServiceModel -> - { - presenter.onNativeCountryServiceSelected(countryServiceModel); - nativeCountryListingDialog.dismiss(); - }); - nativeCountryListingDialog.setHintAndTitle(getString(R.string.search_native_country_text), getString(R.string.native_country_placeholder_text), getString(R.string.no_native_country_found_text)); - nativeCountryListingDialog.disableSearch(false); - if (!nativeCountryListingDialog.isAdded()) - nativeCountryListingDialog.show(getSupportFragmentManager(), this.getClass().getSimpleName()); - } - } - - public class PaymentMethodSelectionClickListener implements View.OnClickListener { - - @Override - public void onClick(View v) { - hideKeyBoard(); - if (serviceMethodListingDialog == null) - serviceMethodListingDialog = new GenericImageWithTextListingDialog<>(); - serviceMethodListingDialog.setData(presenter.getAvailableServiceMethodList()); - serviceMethodListingDialog.setListener(selectedPaymentMethod -> - { - presenter.onServiceTypeSelected(selectedPaymentMethod); - serviceMethodListingDialog.dismiss(); - }); - serviceMethodListingDialog.setHintAndTitle(getString(R.string.search_payment_method_text), getString(R.string.payment_mode_placeholder_text), getString(R.string.no_payment_method_found_text)); - - serviceMethodListingDialog.disableSearch(false); - if (!serviceMethodListingDialog.isAdded()) - serviceMethodListingDialog.show(getSupportFragmentManager(), this.getClass().getSimpleName()); - } - } - - public class BankSelectionClickListener implements View.OnClickListener { - - @Override - public void onClick(View v) { - hideKeyBoard(); - if (bankListingDialog == null) - bankListingDialog = new GenericTextListingDialog<>(); - bankListingDialog.setData(presenter.getAvailableBankList()); - bankListingDialog.setListener(selectedBank -> - { - presenter.onBankSelected(selectedBank); - bankListingDialog.dismiss(); - }); - bankListingDialog.setHintAndTitle(getString(R.string.search_bank_text), getString(R.string.bank_placeholder_text), getString(R.string.no_bank_found_text)); - bankListingDialog.disableSearch(false); - if (!bankListingDialog.isAdded()) - bankListingDialog.show(getSupportFragmentManager(), this.getClass().getSimpleName()); - } - } - - public class BranchSelectionClickListener implements View.OnClickListener { - - @Override - public void onClick(View v) { - hideKeyBoard(); - - String bankId = presenter.getSelectedBank(); - String countryId = presenter.getSelectedCountryId(); - - if (bankId == null) - return; - - if (branchListingDialog == null) - branchListingDialog = new RecipientBranchListingDialog(); - branchListingDialog.setSelectedBankId(bankId); - branchListingDialog.setSelectedCountry(countryId); - branchListingDialog.setListener( - new PayoutModeBranchListingDialog.BranchSelectionListener() { - @Override - public void onBranchSelected(BankBranchDTO selectedBranch) { - presenter.onBranchSelected(selectedBranch); - branchListingDialog.dismiss(); - } - - @Override - public void onBranchSelectionFailed(String message) { - showToastMessage(message); - } - } - ); - - if (!branchListingDialog.isAdded()) - branchListingDialog.show(getSupportFragmentManager(), "BranchListingFragment"); } } - public class StateSelectionClickListener implements View.OnClickListener { - - @Override - public void onClick(View v) { - hideKeyBoard(); - if (stateListingDialog == null) - stateListingDialog = new GenericTextListingDialog<>(); - stateListingDialog.setData(presenter.getProviencesList()); - stateListingDialog.setListener(selectedState -> - { - presenter.onProvinceSelected(selectedState); - stateListingDialog.dismiss(); - }); - stateListingDialog.setHintAndTitle(getString(R.string.search_province_text), getString(R.string.state_province_placeholder_text), getString(R.string.no_province_found_text)); - stateListingDialog.disableSearch(false); - if (!stateListingDialog.isAdded()) - stateListingDialog.show(getSupportFragmentManager(), this.getClass().getSimpleName()); - } - } - - - public class DistrictSelectionClickListener implements View.OnClickListener { - @Override - public void onClick(View v) { - hideKeyBoard(); - if (districtListingDialog == null) - districtListingDialog = new GenericTextListingDialog<>(); - districtListingDialog.setData(presenter.getDistrictList()); - districtListingDialog.setListener(selectedDistrict -> - { - presenter.onDistrictSelected(selectedDistrict); - districtListingDialog.dismiss(); - }); - districtListingDialog.setHintAndTitle(getString(R.string.search_district_text), getString(R.string.district_placeholder_text), getString(R.string.no_district_found_text)); - - districtListingDialog.disableSearch(false); - if (!districtListingDialog.isAdded()) - districtListingDialog.show(getSupportFragmentManager(), this.getClass().getSimpleName()); - } - } - - public class RelationSelectionClickListener implements View.OnClickListener { - - @Override - public void onClick(View v) { - hideKeyBoard(); - if (relationMethodListingDialog == null) - relationMethodListingDialog = new GenericTextListingDialog<>(); - relationMethodListingDialog.setData(presenter.getRelationsList()); - relationMethodListingDialog.setListener(selectedRelation -> - { - presenter.onRelationSelected(selectedRelation); - relationMethodListingDialog.dismiss(); - }); - relationMethodListingDialog.setHintAndTitle(getString(R.string.search_relation_text), getString(R.string.relation_placeholder_text), getString(R.string.no_relation_found_text)); - relationMethodListingDialog.disableSearch(false); - if (!relationMethodListingDialog.isAdded()) - relationMethodListingDialog.show(getSupportFragmentManager(), this.getClass().getSimpleName()); - } - } - - public class TransferReasonSelectionClickListener implements View.OnClickListener { - - @Override - public void onClick(View v) { - hideKeyBoard(); - if (transferListingDialog == null) - transferListingDialog = new GenericTextListingDialog<>(); - transferListingDialog.setData(presenter.getTransferReasonList()); - transferListingDialog.setListener(selectedTransferReason -> - { - presenter.onTransferReasonSelected(selectedTransferReason); - transferListingDialog.dismiss(); - }); - transferListingDialog.setHintAndTitle(getString(R.string.searchPurposeOfRemit_text), getResources().getString(R.string.selectPurposeOfRemit_text), getString(R.string.noPurposeOfRemit_text)); - transferListingDialog.disableSearch(false); - if (!transferListingDialog.isAdded()) - transferListingDialog.show(getSupportFragmentManager(), this.getClass().getSimpleName()); - } - } - - public class IDTypeSelectionClickListener implements View.OnClickListener { - - @Override - public void onClick(View v) { - hideKeyBoard(); - if (idTypeListingDialog == null) - idTypeListingDialog = new GenericTextListingDialog<>(); - idTypeListingDialog.setData(presenter.getReceiverIdTypeList()); - idTypeListingDialog.setListener(selectedPaymentMethod -> - { - presenter.onIDTypeSelected(selectedPaymentMethod); - idTypeListingDialog.dismiss(); - }); - idTypeListingDialog.setHintAndTitle(getString(R.string.search_id_type_text), getString(R.string.id_type_text), getString(R.string.no_id_type_found_text)); - idTypeListingDialog.disableSearch(false); - if (!idTypeListingDialog.isAdded()) - idTypeListingDialog.show(getSupportFragmentManager(), this.getClass().getSimpleName()); - } - } - - - 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.onRecipientMiddleNameChanged(text); - } - } - - public class RecipientLastNameTextWatcher extends TextWatcherAdapter { - @Override - public void onTextUpdated(String text) { - presenter.onRecipientLastNameChanged(text); - } - } - - public class RecipientFullNameTextWatcher extends TextWatcherAdapter { - @Override - public void onTextUpdated(String text) { - Log.d(TAG, "Full name textwatcher called"); - presenter.onRecipientFullNameChanged(text); - } - } - - public class RecipientLocalFirstNameTextWatcher extends TextWatcherAdapter { - @Override - public void onTextUpdated(String text) { - presenter.onRecipientLocalFirstNameChanged(text); - } - } - - public class RecipientLocalMiddleNameTextWatcher extends TextWatcherAdapter { - @Override - public void onTextUpdated(String text) { - presenter.onRecipientLocalMiddleNameChanged(text); - } - } - - public class RecipientLocalLastNameTextWatcher extends TextWatcherAdapter { - @Override - public void onTextUpdated(String text) { - presenter.onRecipientLocalLastNameChanged(text); - } - } - - - public class RecipientLocalFullNameTextWatcher extends TextWatcherAdapter { - @Override - public void onTextUpdated(String text) { - presenter.onRecipientLocalFullNameChanged(text); - } - } - - - public class RecipientCityTextWatcher extends TextWatcherAdapter { - @Override - public void onTextUpdated(String text) { - presenter.onRecipientCityChanged(text); - - } - } + @Override + public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { - 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); - } - } + @Override + public void onPageSelected(int position) { + if(position==0){ + if(recipientToBeEdited!=null){ + toolbarTitle.setText(getString(R.string.edit_recipient_text)); + }else{ + toolbarTitle.setText(getString(R.string.add_recipient_text)); + } - public class RecipientEmailTextWatcher extends TextWatcherAdapter { - @Override - public void onTextUpdated(String text) { - presenter.onRecipientEmailChanged(text); + }else{ + toolbarTitle.setText(getString(R.string.terms_and_condition_title_text)); } } - public class RecipientIdNumberTextWatcher extends TextWatcherAdapter { - @Override - public void onTextUpdated(String text) { - presenter.onRecipientIdNumberChanged(text); + @Override + public void onPageScrollStateChanged(int state) { - } } - - } 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 09f9caf1..01a86002 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 @@ -8,551 +8,17 @@ android:orientation="vertical"> - - + android:layout_height="match_parent" + android:fillViewport="true" > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:layout_height="match_parent"/> + -