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

371 lines
13 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.fragment.bulktransfer;
import android.content.DialogInterface;
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.ImageView;
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.CustomDialog;
import com.scb.phone.view.custom.common.CustomLimit;
import com.scb.phone.view.custom.common.DefaultButton;
import com.scb.phone.view.fragment.bulktransfer.EditRecipientFragment;
import java.util.concurrent.TimeUnit;
import o.AbstractC13163fSk;
import o.C10457eEr;
import o.C12891fKc;
import o.C13417fZt;
import o.C15715hv;
import o.C16256mjh;
import o.C2751akX;
import o.C6583cXR;
import o.FV;
import o.InterfaceC13391fZD;
import o.InterfaceC6636cYn;
import o.ZI;
import o.fRR;
import o.fSJ;
import o.fSQ;
import o.gjJ;
import o.iNh;
import o.miL;
import o.nMh;
/* loaded from: classes5.dex */
public class EditRecipientFragment extends Hilt_EditRecipientFragment implements InterfaceC6636cYn.ojQ {
@BindView
protected TextView accountNumberText;
@BindView
protected AmountEditText amountEditText;
@BindView
protected TextInputLayout amountInputLayout;
@BindView
protected ImageView bankIcon;
@BindView
protected TextView bankName;
private fSJ c;
@BindView
protected CustomLimit customLimit;
@InterfaceC13391fZD
public C2751akX editRecipientPresenter;
@BindView
protected CounterEditText nickNameCounterEditText;
@BindView
protected DefaultButton saveButton;
public static EditRecipientFragment a(String str, FV fv) {
EditRecipientFragment editRecipientFragment = new EditRecipientFragment();
Bundle bundle = new Bundle();
bundle.putParcelable("com.scb.phone.EXTRA_RECIPIENT", fv);
bundle.putString("com.scb.phone.EXTRA_GROUP_ID", str);
editRecipientFragment.setArguments(bundle);
return editRecipientFragment;
}
@Override // androidx.fragment.app.Fragment
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
byte b = 0;
View inflate = layoutInflater.inflate(R.layout.2131559631, viewGroup, false);
ButterKnife.c(this, inflate);
this.editRecipientPresenter.e((C2751akX) this);
C2751akX c2751akX = this.editRecipientPresenter;
final FV fv = (FV) getArguments().getParcelable("com.scb.phone.EXTRA_RECIPIENT");
c2751akX.e = fv;
if (c2751akX.f != 0) {
if ("OTHER".equalsIgnoreCase(fv.j)) {
ZI.IeS ieS = new ZI.IeS() { // from class: o.alg
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6636cYn.ojQ) obj).a();
}
};
if (c2751akX.f != 0) {
ieS.e(c2751akX.f);
}
c2751akX.c.c();
iNh inh = c2751akX.c;
inh.d(inh.i, new C2751akX.IeS(c2751akX, b));
}
ZI.IeS ieS2 = new ZI.IeS(fv) { // from class: o.ald
private FV d;
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6636cYn.ojQ) obj).a(this.d);
}
{
this.d = fv;
}
};
if (c2751akX.f != 0) {
ieS2.e(c2751akX.f);
}
}
this.c = AbstractC13163fSk.interval(1L, TimeUnit.SECONDS).subscribeOn(C13417fZt.c()).observeOn(fRR.e()).subscribe(new fSQ(this) { // from class: o.eIf
private EditRecipientFragment a;
@Override // o.fSQ
public final void c(Object obj) {
EditRecipientFragment.a(this.a);
}
{
this.a = this;
}
}, new fSQ() { // from class: o.eIg
@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.EditRecipientFragment.4
private EditRecipientFragment c;
@Override // com.scb.phone.view.custom.common.AmountEditText.RVV
public final void a() {
}
{
this.c = this;
}
@Override // com.scb.phone.view.custom.common.AmountEditText.RVV
public final void b(double d) {
C2751akX c2751akX2 = this.c.editRecipientPresenter;
if (TextUtils.isEmpty(this.c.amountEditText.getText().toString())) {
ZI.IeS ieS3 = new ZI.IeS() { // from class: o.ala
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6636cYn.ojQ) obj).e(C15715hv.tOB.incomplete_information);
}
};
if (c2751akX2.f != 0) {
ieS3.e(c2751akX2.f);
return;
}
return;
}
if (d == 0.0d) {
ZI.IeS ieS4 = new ZI.IeS() { // from class: o.akY
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6636cYn.ojQ) obj).e(C15715hv.tOB.incorrect_amount);
}
};
if (c2751akX2.f != 0) {
ieS4.e(c2751akX2.f);
return;
}
return;
}
ZI.IeS ieS5 = new ZI.IeS() { // from class: o.alf
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6636cYn.ojQ) obj).c();
}
};
if (c2751akX2.f != 0) {
ieS5.e(c2751akX2.f);
}
}
});
return inflate;
}
@Override // o.InterfaceC6636cYn.ojQ
public final void e(int i) {
this.amountInputLayout.setError(getString(i));
}
@Override // o.InterfaceC6636cYn.ojQ
public final void c() {
this.amountInputLayout.setError(null);
}
@Override // o.InterfaceC6636cYn.ojQ
public final void d(String str) {
this.customLimit.setText(str);
}
@Override // o.InterfaceC6636cYn.ojQ
public final void b() {
CustomLimit customLimit = this.customLimit;
customLimit.mLimitProgress.setVisibility(8);
customLimit.remainingLimit.setVisibility(0);
customLimit.remainingLimit.setText(R.string.limit_not_available);
}
@Override // o.InterfaceC6636cYn.ojQ
public final void e() {
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.ojQ
public final void d() {
C10457eEr.aqd_(this, new Intent("com.scb.phone/BROADCAST_RELOAD_MANAGE_RECIPIENTS_GROUP_BULK_TRANSFER"));
getActivity().finish();
}
@Override // o.InterfaceC6636cYn.ojQ
public final void a() {
CustomLimit customLimit = this.customLimit;
customLimit.mLimitProgress.setVisibility(0);
customLimit.remainingLimit.setVisibility(8);
}
@OnClick
public void navigateBack() {
getActivity().finish();
}
@OnClick
public void onSaveButtonClick() {
C2751akX c2751akX = this.editRecipientPresenter;
String string = getArguments().getString("com.scb.phone.EXTRA_GROUP_ID");
String obj = this.nickNameCounterEditText.editText.getText().toString();
String obj2 = this.amountEditText.getText().toString();
if (!((Boolean) C6583cXR.c(new Object[]{obj}, -1032102340, 1032102340, (int) System.currentTimeMillis())).booleanValue()) {
ZI.IeS ieS = new ZI.IeS() { // from class: o.alh
@Override // o.ZI.IeS
public final void e(Object obj3) {
((InterfaceC6636cYn.ojQ) obj3).e();
}
};
if (c2751akX.f != 0) {
ieS.e(c2751akX.f);
return;
}
return;
}
long j = c2751akX.e.f;
C16256mjh a = C16256mjh.a();
a.e = C6583cXR.c(obj2).doubleValue();
a.a = obj;
a.d = string;
a.b = j;
if (c2751akX.f != 0) {
c2751akX.f.y();
}
c2751akX.c.a(a);
iNh inh = c2751akX.c;
inh.d(inh.i, new C2751akX.HBt(c2751akX, (byte) 0));
}
@Override // o.InterfaceC6636cYn.ojQ
public final void a(String str) {
CustomDialog b = CustomDialog.b(getContext());
String string = getString(R.string.delete_recipient_dialog, str);
if (gjJ.a(string)) {
b.mTitleTextView.setVisibility(0);
b.mTitleTextView.setText(string);
}
String string2 = getString(R.string.are_you_sure_want_delete_recipient, str);
if (gjJ.a(string2)) {
b.mTextTextView.setVisibility(0);
b.mTextTextView.setText(string2);
}
((CustomDialog) CustomDialog.e(new Object[]{b.aoT_(R.string.confirm_delete_recipient, new DialogInterface.OnClickListener(this) { // from class: o.eIh
private EditRecipientFragment d;
@Override // android.content.DialogInterface.OnClickListener
public final void onClick(DialogInterface dialogInterface, int i) {
EditRecipientFragment.c(this.d);
}
{
this.d = this;
}
}), Integer.valueOf(R.string.cancel_delete_recipient), new DialogInterface.OnClickListener() { // from class: o.eIm
@Override // android.content.DialogInterface.OnClickListener
public final void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
}})).show();
}
@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.editRecipientPresenter.w_();
}
public static /* synthetic */ void c(EditRecipientFragment editRecipientFragment) {
C2751akX c2751akX = editRecipientFragment.editRecipientPresenter;
String string = editRecipientFragment.getArguments().getString("com.scb.phone.EXTRA_GROUP_ID");
if (c2751akX.f != 0) {
c2751akX.f.y();
}
iNh inh = c2751akX.c;
long j = c2751akX.e.f;
miL a = miL.a();
a.c = string;
a.d = j;
inh.e(a);
iNh inh2 = c2751akX.c;
inh2.d(inh2.i, new C2751akX.HBt(c2751akX, (byte) 0));
}
public static /* synthetic */ void a(EditRecipientFragment editRecipientFragment) {
boolean z = (TextUtils.isEmpty(editRecipientFragment.amountEditText.getText()) || C6583cXR.q(editRecipientFragment.amountEditText.getText().toString()) || TextUtils.isEmpty(editRecipientFragment.nickNameCounterEditText.editText.getText().toString())) ? false : true;
if (editRecipientFragment.saveButton.isEnabled() != z) {
editRecipientFragment.saveButton.setButtonEnabled(z);
}
}
@OnClick
public void onDeleteButtonClick() {
final C2751akX c2751akX = this.editRecipientPresenter;
ZI.IeS ieS = new ZI.IeS(c2751akX) { // from class: o.ale
private C2751akX b;
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6636cYn.ojQ) obj).a(this.b.e.g);
}
{
this.b = c2751akX;
}
};
if (c2751akX.f != 0) {
ieS.e(c2751akX.f);
}
}
@Override // o.InterfaceC6636cYn.ojQ
public final void a(FV fv) {
this.amountEditText.setFormattedAmount(fv.c);
this.bankName.setText(fv.d);
this.accountNumberText.setText(fv.b);
this.nickNameCounterEditText.setText(fv.g);
C12891fKc.azf_(getActivity(), R.drawable.shape_circle_lighter_gray_background, this.bankIcon, fv.a, getActivity().getResources().getDimensionPixelOffset(R.dimen.f15222131165286), nMh.getColor(getActivity(), R.color.f3412131099849));
}
}