|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.remit.jmecustomer.features.recipientmanagement.view.recipientaddeditV3; |
|
|
|
|
|
|
|
import android.content.DialogInterface; |
|
|
|
import android.content.Intent; |
|
|
|
import android.os.Bundle; |
|
|
|
import android.text.InputFilter; |
|
|
@ -7,11 +8,17 @@ import android.util.Log; |
|
|
|
import android.view.LayoutInflater; |
|
|
|
import android.view.View; |
|
|
|
import android.view.ViewGroup; |
|
|
|
import android.widget.Toast; |
|
|
|
|
|
|
|
import androidx.annotation.Nullable; |
|
|
|
import androidx.appcompat.app.AlertDialog; |
|
|
|
import androidx.lifecycle.ViewModelProvider; |
|
|
|
import androidx.transition.TransitionManager; |
|
|
|
|
|
|
|
import com.remit.jmecustomer.RemitApplication; |
|
|
|
import com.remit.jmecustomer.base.PrefKeys; |
|
|
|
import com.remit.jmecustomer.common.customwidgets.common.GenericEditTextPromptDialog; |
|
|
|
import com.remit.jmecustomer.features.home.view.HomeActivityV2; |
|
|
|
import com.remit.jmecustomer.features.recipientmanagement.model.recipientaddeditV3.countryservice.CountryServiceModel; |
|
|
|
import com.remit.jmecustomer.features.recipientmanagement.model.recipientaddeditV3.countryservice.ServiceTypeModel; |
|
|
|
import com.remit.jmecustomer.features.recipientmanagement.model.recipientaddeditV3.dynamicvalidation.DropDownDTO; |
|
|
@ -36,6 +43,7 @@ import com.remit.jmecustomer.databinding.FragmentBeneficiaryAddEditV3Binding; |
|
|
|
import com.remit.jmecustomer.features.kyc.newCustomer.model.NativeCountry; |
|
|
|
import com.remit.jmecustomer.features.recipientmanagement.view.RecipientAddV3ViewModelFactory; |
|
|
|
import com.remit.jmecustomer.features.recipientmanagement.view.RecipientEditV3ViewModelFactory; |
|
|
|
import com.remit.jmecustomer.features.recipientmanagement.view.recipientlistingV3.RecipientListingV3Activity; |
|
|
|
import com.remit.jmecustomer.features.sendmoney.model.SendMoneyRequiredDataV3; |
|
|
|
import com.remit.jmecustomer.features.sendmoney.model.payoutmode.BankBranchDTO; |
|
|
|
import com.remit.jmecustomer.features.sendmoney.view.SendMoneyV2Activity; |
|
|
@ -46,6 +54,7 @@ import com.remit.jmecustomer.features.webbrowser.model.WebRequestModel; |
|
|
|
import static android.view.View.GONE; |
|
|
|
import static com.remit.jmecustomer.features.recipientmanagement.view.recipientaddeditV3.RecipientAddEditV3Activity.RECIPIENT_INFO_BUNDLE_KEY_v3; |
|
|
|
import static com.remit.jmecustomer.features.webbrowser.WebBrowserV2Activity.WEB_BROWSWER_URL_BUNDLE_KEY; |
|
|
|
import static com.remit.jmecustomer.utils.Constants.FOREIGNER_TYPE; |
|
|
|
|
|
|
|
public class BeneficiaryAddEditV3Fragment extends BaseFragment implements RecipientAddV3ContractInterface.RecipientAddEditV3ContractInterface, View.OnClickListener { |
|
|
|
private final String TAG = BeneficiaryAddEditV3Fragment.class.getSimpleName(); |
|
|
@ -81,6 +90,7 @@ public class BeneficiaryAddEditV3Fragment extends BaseFragment implements Recipi |
|
|
|
|
|
|
|
private ReceiverInfoV3Model recipientToBeEdited; |
|
|
|
private RecipientAddEditBaseV3ViewModel viewModel; |
|
|
|
|
|
|
|
@Override |
|
|
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
|
|
|
binding = FragmentBeneficiaryAddEditV3Binding.inflate(inflater, container, false); |
|
|
@ -97,14 +107,26 @@ public class BeneficiaryAddEditV3Fragment extends BaseFragment implements Recipi |
|
|
|
private void init() { |
|
|
|
recipientToBeEdited = getArguments().getParcelable(RECIPIENT_INFO_BUNDLE_KEY_v3); |
|
|
|
if (recipientToBeEdited != null) { |
|
|
|
RecipientEditV3ViewModelFactory recipientEditViewModelFactory = new RecipientEditV3ViewModelFactory((RecipientAddV3ContractInterface) getActivity(),recipientToBeEdited); |
|
|
|
RecipientEditV3ViewModelFactory recipientEditViewModelFactory = new RecipientEditV3ViewModelFactory((RecipientAddV3ContractInterface) getActivity(), recipientToBeEdited); |
|
|
|
viewModel = new ViewModelProvider(requireActivity(), recipientEditViewModelFactory).get(RecipientEditV3ViewModel.class); |
|
|
|
} else { |
|
|
|
RecipientAddV3ViewModelFactory recipientAddViewModelFactory = new RecipientAddV3ViewModelFactory((RecipientAddV3ContractInterface)getActivity(),recipientToBeEdited); |
|
|
|
RecipientAddV3ViewModelFactory recipientAddViewModelFactory = new RecipientAddV3ViewModelFactory((RecipientAddV3ContractInterface) getActivity(), recipientToBeEdited); |
|
|
|
viewModel = new ViewModelProvider(requireActivity(), recipientAddViewModelFactory).get(RecipientAddV3ViewModel.class); |
|
|
|
} |
|
|
|
initTextWatchers(); |
|
|
|
removeInputFiltersByDefault(); |
|
|
|
binding.edReceiverAccountNo.setOnFocusChangeListener(new View.OnFocusChangeListener() { |
|
|
|
@Override |
|
|
|
public void onFocusChange(View view, boolean hasFocus) { |
|
|
|
if (!hasFocus) { |
|
|
|
String selectedPaymentModeText = binding.edReceiverPaymentMethodSelection.getText().toString(); |
|
|
|
if (selectedPaymentModeText.equalsIgnoreCase("Mobile Wallet") || selectedPaymentModeText.equalsIgnoreCase("Bank Deposit")) { |
|
|
|
// Toast.makeText(getContext(), "Lost the focus", Toast.LENGTH_LONG).show(); |
|
|
|
viewModel.validateAccountNumber(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -168,9 +190,9 @@ public class BeneficiaryAddEditV3Fragment extends BaseFragment implements Recipi |
|
|
|
|
|
|
|
@Override |
|
|
|
public void showNativeCountrySelectionView(boolean visibility) { |
|
|
|
if(visibility){ |
|
|
|
if (visibility) { |
|
|
|
binding.recieverNativeCountryViewContainer.setVisibility(View.VISIBLE); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
binding.recieverNativeCountryViewContainer.setVisibility(GONE); |
|
|
|
} |
|
|
|
|
|
|
@ -349,7 +371,6 @@ public class BeneficiaryAddEditV3Fragment extends BaseFragment implements Recipi |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void updateValueToWidgetNativeCountry(String nativeCountry) { |
|
|
|
binding.edReceiverNativeCountrySelection.setText(nativeCountry); |
|
|
@ -619,7 +640,6 @@ public class BeneficiaryAddEditV3Fragment extends BaseFragment implements Recipi |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void updateValidationRuleToWidgetEmail(boolean isFieldRequired, EditTextConfigurationFactory.EditTextConfiguration editTextConfiguration) { |
|
|
|
// editTextConfiguration.applyConfigurationSetting(binding.edReceiverTransferReasonSelection); --->??? |
|
|
@ -715,6 +735,7 @@ public class BeneficiaryAddEditV3Fragment extends BaseFragment implements Recipi |
|
|
|
public void setErrorOnWidgetLocalFullName(String error) { |
|
|
|
binding.receiverLocalFullNameWrapper.setError(error); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void setErrorOnWidgetSelectCountry(String error) { |
|
|
|
binding.receiverCountrySelectionWrapper.setError(error); |
|
|
@ -864,7 +885,6 @@ public class BeneficiaryAddEditV3Fragment extends BaseFragment implements Recipi |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void addOptionalAsHintToWidgetEmail(Boolean isOptional) { |
|
|
|
ValidationUtils.updateHint(binding.receiverEmailWrapper, isOptional); |
|
|
@ -944,7 +964,7 @@ public class BeneficiaryAddEditV3Fragment extends BaseFragment implements Recipi |
|
|
|
break; |
|
|
|
|
|
|
|
case R.id.btn_submit: |
|
|
|
if(viewModel.verifyAddEdit()){ |
|
|
|
if (viewModel.verifyAddEdit()) { |
|
|
|
viewModel.onSubmitBtnPressed(); |
|
|
|
} |
|
|
|
break; |
|
|
@ -959,6 +979,7 @@ public class BeneficiaryAddEditV3Fragment extends BaseFragment implements Recipi |
|
|
|
startActivity(intent); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public class RecipientAccountNoTextWatcher extends TextWatcherAdapter { |
|
|
|
@Override |
|
|
|
public void onTextUpdated(String text) { |
|
|
@ -1147,7 +1168,7 @@ public class BeneficiaryAddEditV3Fragment extends BaseFragment implements Recipi |
|
|
|
serviceMethodListingDialog.setListener(selectedPaymentMethod -> |
|
|
|
{ |
|
|
|
viewModel.onServiceTypeSelected(selectedPaymentMethod); |
|
|
|
if(selectedPaymentMethod.getText().equalsIgnoreCase("Mobile Wallet")) |
|
|
|
if (selectedPaymentMethod.getText().equalsIgnoreCase("Mobile Wallet")) |
|
|
|
binding.receiverAccountNoWrapper.setHint(getString(R.string.receiver_wallet_no_text_enter)); |
|
|
|
else |
|
|
|
binding.receiverAccountNoWrapper.setHint(getString(R.string.account_text)); |
|
|
@ -1278,6 +1299,7 @@ public class BeneficiaryAddEditV3Fragment extends BaseFragment implements Recipi |
|
|
|
relationMethodListingDialog.show(getActivity().getSupportFragmentManager(), this.getClass().getSimpleName()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public class IDTypeSelectionClickListener implements View.OnClickListener { |
|
|
|
|
|
|
|
@Override |
|
|
@ -1298,4 +1320,32 @@ public class BeneficiaryAddEditV3Fragment extends BaseFragment implements Recipi |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void showAccountNumberErrorDialog(String msg) { |
|
|
|
try { |
|
|
|
GenericPromptDialog genericPromptDialog = new GenericPromptDialog(); |
|
|
|
genericPromptDialog.setTitleMessage(getString(R.string.account_validation_failed_text)); |
|
|
|
genericPromptDialog.setBodyMessage(msg); |
|
|
|
genericPromptDialog.setIconsRes(R.drawable.error); |
|
|
|
genericPromptDialog.setCancellable(true); |
|
|
|
genericPromptDialog.setPositiveBtnString("Proceed"); |
|
|
|
genericPromptDialog.setListener(new GenericPromptDialog.GenericDialogPromptListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onNegativeBtnPressed() { |
|
|
|
startActivity(new Intent(getContext(), RecipientListingV3Activity.class)); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onPositiveBtnPressed() { |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
if (!genericPromptDialog.isAdded()) |
|
|
|
genericPromptDialog.show(getChildFragmentManager(), "RECIPIENTEDITPROMPT"); |
|
|
|
} catch (Exception ex) { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |