what-the-bank/sources/com/scb/phone/view/fragment/bulktransfer/AddNewRecipientFragment.java

328 lines
11 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.fragment.bulktransfer;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.google.android.material.textfield.TextInputLayout;
import com.scb.phone.R;
import com.scb.phone.view.custom.common.AmountEditText;
import com.scb.phone.view.custom.common.CounterEditText;
import com.scb.phone.view.custom.common.DefaultButton;
import com.scb.phone.view.fragment.bulktransfer.AddNewRecipientFragment;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
import o.AbstractC13163fSk;
import o.C10457eEr;
import o.C1133Whh;
import o.C1236Yq;
import o.C12891fKc;
import o.C13417fZt;
import o.C15715hv;
import o.C2677ajC;
import o.C6583cXR;
import o.InterfaceC13391fZD;
import o.InterfaceC6636cYn;
import o.ZI;
import o.fRR;
import o.fSJ;
import o.fSQ;
import o.iNh;
import o.nMh;
import o.pZV;
/* loaded from: classes5.dex */
public class AddNewRecipientFragment extends Hilt_AddNewRecipientFragment implements InterfaceC6636cYn.RVV {
@BindView
protected EditText accountNumberEditText;
@InterfaceC13391fZD
public C2677ajC addNewRecipientPresenter;
@BindView
protected AmountEditText amountEditText;
@BindView
protected TextInputLayout amountInputLayout;
@BindView
protected ImageView bankIcon;
@BindView
protected TextView bankName;
private fSJ c;
@BindView
protected CounterEditText nickNameCounterEditText;
@BindView
protected TextView remainingLimit;
@BindView
protected TextView remainingLimitError;
@BindView
protected LinearLayout remainingLimitLinearLayout;
@BindView
protected DefaultButton reviewButton;
@BindView
protected TextView textRemainingLimit;
public static AddNewRecipientFragment b(String str, C1236Yq c1236Yq) {
AddNewRecipientFragment addNewRecipientFragment = new AddNewRecipientFragment();
Bundle bundle = new Bundle();
bundle.putParcelable("com.scb.phone.EXTRA_BANK", c1236Yq);
bundle.putString("com.scb.phone.EXTRA_GROUP_ID", str);
addNewRecipientFragment.setArguments(bundle);
return addNewRecipientFragment;
}
@Override // androidx.fragment.app.Fragment
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
String str;
byte b = 0;
View inflate = layoutInflater.inflate(R.layout.2131559450, viewGroup, false);
ButterKnife.c(this, inflate);
this.addNewRecipientPresenter.e((C2677ajC) this);
C2677ajC c2677ajC = this.addNewRecipientPresenter;
final C1236Yq c1236Yq = (C1236Yq) getArguments().getParcelable("com.scb.phone.EXTRA_BANK");
c2677ajC.c = c1236Yq;
if (c1236Yq.d == null) {
str = "";
} else {
str = c1236Yq.d.c;
}
if (!"014".equalsIgnoreCase(str)) {
if (c2677ajC.f != 0) {
c2677ajC.f.v();
}
c2677ajC.d.c();
iNh inh = c2677ajC.d;
inh.d(inh.i, new C2677ajC.HBt(c2677ajC, b));
}
ZI.IeS ieS = new ZI.IeS(c1236Yq) { // from class: o.ajE
private C1236Yq e;
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6636cYn.RVV) obj).b(this.e);
}
{
this.e = c1236Yq;
}
};
if (c2677ajC.f != 0) {
ieS.e(c2677ajC.f);
}
this.c = AbstractC13163fSk.interval(1L, TimeUnit.SECONDS).subscribeOn(C13417fZt.c()).observeOn(fRR.e()).subscribe(new fSQ(this) { // from class: o.eHH
private AddNewRecipientFragment c;
@Override // o.fSQ
public final void c(Object obj) {
AddNewRecipientFragment.e(this.c);
}
{
this.c = this;
}
}, new fSQ() { // from class: o.eHM
@Override // o.fSQ
public final void c(Object obj) {
guQ.a((Throwable) obj);
}
});
this.amountEditText.setMaximumDecimalDigit(15);
this.amountEditText.setOnAmountChangeListener(new AmountEditText.RVV(this) { // from class: com.scb.phone.view.fragment.bulktransfer.AddNewRecipientFragment.5
private AddNewRecipientFragment e;
{
this.e = this;
}
@Override // com.scb.phone.view.custom.common.AmountEditText.RVV
public final void b(double d) {
C2677ajC c2677ajC2 = this.e.addNewRecipientPresenter;
if (TextUtils.isEmpty(this.e.amountEditText.getText().toString())) {
ZI.IeS ieS2 = new ZI.IeS() { // from class: o.ajD
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6636cYn.RVV) obj).c(C15715hv.tOB.incomplete_information);
}
};
if (c2677ajC2.f != 0) {
ieS2.e(c2677ajC2.f);
return;
}
return;
}
if (d == 0.0d) {
ZI.IeS ieS3 = new ZI.IeS() { // from class: o.ajA
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6636cYn.RVV) obj).c(C15715hv.tOB.incorrect_amount);
}
};
if (c2677ajC2.f != 0) {
ieS3.e(c2677ajC2.f);
return;
}
return;
}
ZI.IeS ieS4 = new ZI.IeS() { // from class: o.ajJ
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6636cYn.RVV) obj).e();
}
};
if (c2677ajC2.f != 0) {
ieS4.e(c2677ajC2.f);
}
}
@Override // com.scb.phone.view.custom.common.AmountEditText.RVV
public final void a() {
C2677ajC c2677ajC2 = this.e.addNewRecipientPresenter;
ZI.IeS ieS2 = new ZI.IeS() { // from class: o.ajB
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6636cYn.RVV) obj).aN_();
}
};
if (c2677ajC2.f != 0) {
ieS2.e(c2677ajC2.f);
}
}
});
return inflate;
}
@Override // o.InterfaceC6636cYn.RVV
public final void c(int i) {
this.amountInputLayout.setError(getString(i));
this.amountInputLayout.setErrorEnabled(true);
}
@Override // o.InterfaceC6636cYn.RVV
public final void e() {
this.amountInputLayout.setError(null);
this.amountInputLayout.setErrorEnabled(false);
}
@Override // o.InterfaceC6636cYn.RVV
public final void a(String str) {
e(true);
this.remainingLimit.setText(str);
}
@Override // o.InterfaceC6636cYn.RVV
public final void a() {
e(false);
}
@Override // o.InterfaceC6636cYn.RVV
public final void b(C1236Yq c1236Yq) {
C12891fKc.azf_(getContext(), R.drawable.bankicon_place_holder, this.bankIcon, c1236Yq.e, getContext().getResources().getDimensionPixelOffset(R.dimen.f15222131165286), nMh.getColor(getContext(), R.color.f3412131099849));
this.bankName.setText(c1236Yq.a);
}
@Override // o.InterfaceC6636cYn.RVV
public final void b() {
CounterEditText counterEditText = this.nickNameCounterEditText;
counterEditText.errorText.setVisibility(0);
counterEditText.editText.setBackground(nMh.getDrawable(counterEditText.getContext(), R.drawable.shape_red_reounded_reactangle_border));
}
@Override // o.InterfaceC6636cYn.RVV
public final void c() {
C10457eEr.aqd_(this, new Intent("com.scb.phone/BROADCAST_RELOAD_MANAGE_RECIPIENTS_GROUP_BULK_TRANSFER"));
getActivity().finish();
}
private void e(boolean z) {
this.remainingLimitError.setVisibility(z ? 8 : 0);
this.textRemainingLimit.setVisibility(z ? 0 : 8);
this.remainingLimit.setVisibility(z ? 0 : 8);
this.remainingLimitLinearLayout.setVisibility(z ? 0 : 8);
}
@OnClick
public void navigateBack() {
C10457eEr.aqd_(this, new Intent("com.scb.phone.ACTION_ADD_RECIPIENT_BACK"));
}
@OnClick
public void onReviewButtonClick() {
String str;
C2677ajC c2677ajC = this.addNewRecipientPresenter;
String string = getArguments().getString("com.scb.phone.EXTRA_GROUP_ID");
String obj = this.accountNumberEditText.getText().toString();
String obj2 = this.nickNameCounterEditText.editText.getText().toString();
String obj3 = this.amountEditText.getText().toString();
if (!((Boolean) C6583cXR.c(new Object[]{obj2}, -1032102340, 1032102340, (int) System.currentTimeMillis())).booleanValue()) {
ZI.IeS ieS = new ZI.IeS() { // from class: o.ajz
@Override // o.ZI.IeS
public final void e(Object obj4) {
((InterfaceC6636cYn.RVV) obj4).b();
}
};
if (c2677ajC.f != 0) {
ieS.e(c2677ajC.f);
return;
}
return;
}
if (c2677ajC.f != 0) {
c2677ajC.f.y();
}
if (c2677ajC.c.d == null) {
str = "";
} else {
str = c2677ajC.c.d.c;
}
C1133Whh d = C1133Whh.d();
d.d = obj;
d.a = C6583cXR.c(obj3).doubleValue();
d.e = obj2;
d.c = c2677ajC.c.d.c;
d.b = "014".equalsIgnoreCase(str) ? "SCB" : "OTHER";
ArrayList arrayList = new ArrayList(1);
arrayList.add(d);
pZV d2 = pZV.d();
d2.d = arrayList;
d2.e = string;
c2677ajC.d.c(d2);
iNh inh = c2677ajC.d;
inh.d(inh.i, new C2677ajC.IeS(c2677ajC, (byte) 0));
}
@Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment
public void onDestroyView() {
super.onDestroyView();
fSJ fsj = this.c;
if (fsj != null && !fsj.isDisposed()) {
this.c.dispose();
}
this.addNewRecipientPresenter.w_();
}
public static /* synthetic */ void e(AddNewRecipientFragment addNewRecipientFragment) {
boolean z = (TextUtils.isEmpty(addNewRecipientFragment.amountEditText.getText()) || C6583cXR.q(addNewRecipientFragment.amountEditText.getText().toString()) || TextUtils.isEmpty(addNewRecipientFragment.nickNameCounterEditText.editText.getText().toString()) || TextUtils.isEmpty(addNewRecipientFragment.accountNumberEditText.getText())) ? false : true;
if (addNewRecipientFragment.reviewButton.isEnabled() != z) {
addNewRecipientFragment.reviewButton.setButtonEnabled(z);
}
}
}