diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser
index e0a5f3f9..c06154cb 100644
Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 9afb209d..0ba75927 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -4,6 +4,10 @@
+
+
+
+
@@ -12,6 +16,7 @@
+
\ No newline at end of file
diff --git a/app/src/main/java/com/swifttech/remit/android/features/recipientmanagement/model/recipientaddeditV3/dynamicvalidation/DropDownDTO.java b/app/src/main/java/com/swifttech/remit/android/features/recipientmanagement/model/recipientaddeditV3/dynamicvalidation/DropDownDTO.java
index 7116f71c..a60b1866 100644
--- a/app/src/main/java/com/swifttech/remit/android/features/recipientmanagement/model/recipientaddeditV3/dynamicvalidation/DropDownDTO.java
+++ b/app/src/main/java/com/swifttech/remit/android/features/recipientmanagement/model/recipientaddeditV3/dynamicvalidation/DropDownDTO.java
@@ -38,4 +38,9 @@ public class DropDownDTO {
public String toString() {
return this.text;
}
+
+ public static DropDownDTO createFromUserAnswerInput(String answer)
+ {
+ return new DropDownDTO(answer,answer);
+ }
}
diff --git a/app/src/main/java/com/swifttech/remit/android/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddEditBaseV3Presenter.java b/app/src/main/java/com/swifttech/remit/android/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddEditBaseV3Presenter.java
index d5188dcb..f958a896 100644
--- a/app/src/main/java/com/swifttech/remit/android/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddEditBaseV3Presenter.java
+++ b/app/src/main/java/com/swifttech/remit/android/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddEditBaseV3Presenter.java
@@ -10,6 +10,7 @@ import com.swifttech.remit.android.features.recipientmanagement.model.recipienta
import com.swifttech.remit.android.features.recipientmanagement.model.recipientaddeditV3.dynamicvalidation.PayoutProvincesModel;
import com.swifttech.remit.android.features.recipientmanagement.model.recipientaddeditV3.dynamicvalidation.ValidationRuleModel;
import com.swifttech.remit.android.features.recipientmanagement.model.recipientlistingV3.AgentV3Model;
+import com.swifttech.remit.android.features.recipientmanagement.view.recipientaddeditV3.AnswerInputDialog;
import com.swifttech.remit.android.features.sendmoney.model.payoutmode.BankBranchDTO;
import java.util.List;
@@ -71,9 +72,21 @@ public abstract class RecipientAddEditBaseV3Presenter extends BasePresenter impl
@Override
public void onTransferReasonSelected(DropDownDTO selectedTransferReason) {
- validator.updateTransfer(selectedTransferReason);
+ if(shouldPromptToInputAnswer(selectedTransferReason))
+ {
+ view.promptToInputAnswer("Specify your purpose of remit.", new AnswerInputDialog.AnswerInputDialogListener() {
+ @Override
+ public void onAnswerSubmitted(String answer) {
+ validator.updateTransfer(DropDownDTO.createFromUserAnswerInput(answer));
+ }
+ });
+ }
+ else
+ validator.updateTransfer(selectedTransferReason);
}
+
+
@Override
public void onIDTypeSelected(DropDownDTO selectedIDType) {
validator.updateIdType(selectedIDType);
@@ -81,6 +94,16 @@ public abstract class RecipientAddEditBaseV3Presenter extends BasePresenter impl
@Override
public void onRelationSelected(DropDownDTO selectedRelation) {
+ if(shouldPromptToInputAnswer(selectedRelation))
+ {
+ view.promptToInputAnswer("Specify your relation.", new AnswerInputDialog.AnswerInputDialogListener() {
+ @Override
+ public void onAnswerSubmitted(String answer) {
+ validator.updateRelation(DropDownDTO.createFromUserAnswerInput(answer));
+ }
+ });
+ }
+ else
validator.updateRelation(selectedRelation);
}
@@ -230,4 +253,8 @@ public abstract class RecipientAddEditBaseV3Presenter extends BasePresenter impl
public void onNativeCountryServiceSelected(NativeCountry selectedNativeCountry) {
validator.updateNativeCountry(selectedNativeCountry);
}
+
+ private boolean shouldPromptToInputAnswer(DropDownDTO optionType) {
+ return (optionType!=null&&("Others".equalsIgnoreCase(optionType.getText())));
+ }
}
diff --git a/app/src/main/java/com/swifttech/remit/android/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddV3ContractInterface.java b/app/src/main/java/com/swifttech/remit/android/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddV3ContractInterface.java
index 1f5bd6a5..15db6e9a 100644
--- a/app/src/main/java/com/swifttech/remit/android/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddV3ContractInterface.java
+++ b/app/src/main/java/com/swifttech/remit/android/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddV3ContractInterface.java
@@ -2,6 +2,7 @@ package com.swifttech.remit.android.features.recipientmanagement.presenter.recip
import com.swifttech.remit.android.base.BaseContractInterface;
import com.swifttech.remit.android.features.recipientmanagement.utils.EditTextConfigurationFactory;
+import com.swifttech.remit.android.features.recipientmanagement.view.recipientaddeditV3.AnswerInputDialog;
public interface RecipientAddV3ContractInterface extends BaseContractInterface
{
@@ -216,4 +217,6 @@ public interface RecipientAddV3ContractInterface extends BaseContractInterface
void addOptionalAsHintToWidgetNativeCountry(Boolean isOptional);
+ void promptToInputAnswer(String question, AnswerInputDialog.AnswerInputDialogListener listener);
+
}
diff --git a/app/src/main/java/com/swifttech/remit/android/features/recipientmanagement/view/recipientaddeditV3/AnswerInputDialog.java b/app/src/main/java/com/swifttech/remit/android/features/recipientmanagement/view/recipientaddeditV3/AnswerInputDialog.java
new file mode 100644
index 00000000..3d661df6
--- /dev/null
+++ b/app/src/main/java/com/swifttech/remit/android/features/recipientmanagement/view/recipientaddeditV3/AnswerInputDialog.java
@@ -0,0 +1,106 @@
+package com.swifttech.remit.android.features.recipientmanagement.view.recipientaddeditV3;
+
+import android.app.Dialog;
+import android.os.Bundle;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AlertDialog;
+import androidx.fragment.app.DialogFragment;
+import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat;
+
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
+import com.swifttech.remit.android.R;
+import com.swifttech.remit.android.RemitApplication;
+import com.swifttech.remit.android.base.PrefKeys;
+
+public class AnswerInputDialog extends DialogFragment implements View.OnClickListener {
+
+
+ private TextView questionTextView;
+ private EditText answerEditText;
+ private Button submitBtn;
+
+ private String questionText;
+ private AnswerInputDialogListener answerListener;
+
+ public void setQuestionText(String questionText) {
+ this.questionText = questionText;
+ }
+
+ public void setAnswerListener(AnswerInputDialogListener answerListener) {
+ this.answerListener = answerListener;
+ }
+
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ AlertDialog.Builder builder = new MaterialAlertDialogBuilder(getActivity());
+ View dialogView = getActivity().getLayoutInflater().inflate(R.layout.dialog_answer_input, null);
+ questionTextView = dialogView.findViewById(R.id.questionTextView);
+ answerEditText = dialogView.findViewById(R.id.answerTextView);
+ submitBtn = dialogView.findViewById(R.id.submitBtn);
+ if(questionText!=null&&questionText.length()>0)
+ questionTextView.setText(questionText);
+ builder.setView(dialogView);
+ setCancelable(false);
+
+ Dialog d = builder.create();
+ d.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
+ return d;
+ }
+
+ @Override
+ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ }
+
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ submitBtn.setOnClickListener(this);
+ }
+
+ @Override
+ public void onStop() {
+ super.onStop();
+ submitBtn.setOnClickListener(null);
+ }
+
+ @Override
+ public void onDestroyView() {
+ super.onDestroyView();
+ }
+
+ @Override
+ public void onClick(View v) {
+ switch (v.getId()) {
+ case R.id.submitBtn:
+ onSubmitBtnClicked();
+ break;
+ }
+ }
+
+ private void onSubmitBtnClicked() {
+ if (answerEditText.getText().length() > 0) {
+ if (answerListener != null)
+ answerListener.onAnswerSubmitted(answerEditText.getText().toString());
+ dismiss();
+ } else
+ Toast.makeText(getActivity(), "Please provide the answer", Toast.LENGTH_SHORT).show();
+ }
+
+
+ public interface AnswerInputDialogListener {
+
+ void onAnswerSubmitted(String answer);
+ }
+
+}
diff --git a/app/src/main/java/com/swifttech/remit/android/features/recipientmanagement/view/recipientaddeditV3/RecipientAddEditV3Activity.java b/app/src/main/java/com/swifttech/remit/android/features/recipientmanagement/view/recipientaddeditV3/RecipientAddEditV3Activity.java
index 78839fea..ca82bb03 100644
--- a/app/src/main/java/com/swifttech/remit/android/features/recipientmanagement/view/recipientaddeditV3/RecipientAddEditV3Activity.java
+++ b/app/src/main/java/com/swifttech/remit/android/features/recipientmanagement/view/recipientaddeditV3/RecipientAddEditV3Activity.java
@@ -1127,6 +1127,16 @@ public class RecipientAddEditV3Activity extends BaseActivity implements Recipien
}
+ @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;
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 97ff17fb..d185add1 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
@@ -459,7 +459,7 @@
diff --git a/app/src/main/res/layout/dialog_answer_input.xml b/app/src/main/res/layout/dialog_answer_input.xml
new file mode 100644
index 00000000..652b857a
--- /dev/null
+++ b/app/src/main/res/layout/dialog_answer_input.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
\ No newline at end of file