what-the-bank/sources/com/scb/phone/view/fragment/mwpartner/MwEditCreateQrFragment.java

290 lines
10 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.fragment.mwpartner;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.FragmentActivity;
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.MwAmountEditText;
import com.scb.phone.view.custom.common.NoteEditText;
import com.scb.phone.view.custom.item.ItemIconCustom;
import com.scb.phone.view.fragment.BaseFragment;
import com.scb.phone.view.fragment.mwpartner.MwEditCreateQrFragment;
import o.C0646LgD;
import o.C0947Sa;
import o.C4245bUc;
import o.C4248bUf;
import o.C5756bz;
import o.C6583cXR;
import o.InterfaceC13391fZD;
import o.InterfaceC9403djA;
import o.VPY;
import o.YpL;
import o.ZI;
import o.fLM;
/* loaded from: classes5.dex */
public class MwEditCreateQrFragment extends Hilt_MwEditCreateQrFragment implements InterfaceC9403djA {
@BindView
ItemIconCustom accountSummary;
@BindView
MwAmountEditText amountEditText;
@BindView
TextInputLayout amountInputLayout;
private fLM c;
@BindView
ConstraintLayout constraintLayout;
@BindView
Button createQrBtn;
@InterfaceC13391fZD
public C4248bUf presenter;
@BindView
NoteEditText shopReference;
public static MwEditCreateQrFragment e(String str, String str2) {
Bundle bundle = new Bundle();
bundle.putString("EXTRA_AMOUNT", str);
bundle.putString("EXTRA_REFERENCE", str2);
MwEditCreateQrFragment mwEditCreateQrFragment = new MwEditCreateQrFragment();
mwEditCreateQrFragment.setArguments(bundle);
return mwEditCreateQrFragment;
}
@Override // androidx.fragment.app.Fragment
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
final String str;
final String str2;
View inflate = layoutInflater.inflate(R.layout.2131559773, viewGroup, false);
((BaseFragment) this).a = ButterKnife.c(this, inflate);
this.presenter.e((C4248bUf) this);
if (getArguments() != null) {
str = getArguments().getString("EXTRA_AMOUNT");
str2 = getArguments().getString("EXTRA_REFERENCE");
} else {
str = "";
str2 = "";
}
final C4248bUf c4248bUf = this.presenter;
C0646LgD c0646LgD = c4248bUf.c.c;
if (c4248bUf.c.g() && c0646LgD != null) {
c4248bUf.d = Double.parseDouble(c0646LgD.b);
c4248bUf.b = Double.parseDouble(c0646LgD.c);
}
ZI.IeS ieS = new ZI.IeS(c4248bUf, str, str2) { // from class: o.bUd
private String a;
private C4248bUf c;
private String d;
@Override // o.ZI.IeS
public final void e(Object obj) {
C4248bUf.e(this.c, this.a, this.d, (InterfaceC9403djA) obj);
}
{
this.c = c4248bUf;
this.a = str;
this.d = str2;
}
};
if (c4248bUf.f != 0) {
ieS.e(c4248bUf.f);
}
c4248bUf.e.e();
VPY vpy = c4248bUf.e;
vpy.d(vpy.i, new C4248bUf.AnonymousClass4(c4248bUf));
return inflate;
}
@Override // o.InterfaceC9403djA
public final void b(String str, String str2, double d, double d2) {
String str3 = (String) C6583cXR.c(new Object[]{Double.valueOf(d)}, -150997759, 150997764, (int) System.currentTimeMillis());
String str4 = (String) C6583cXR.c(new Object[]{Double.valueOf(d2)}, -150997759, 150997764, (int) System.currentTimeMillis());
this.amountEditText.setCustomHint(getString(R.string.mw_edit_qr_amount_hint, str3, str4));
String format = String.format(getString(R.string.mw_edit_qr_error_limit), str3, str4);
fLM flm = new fLM(this.amountEditText, this.amountInputLayout, d2, d, getString(R.string.mw_edit_qr_error_limit), format, format);
this.c = flm;
this.amountEditText.setCurrencyFormattingTextWatcher(flm);
this.amountEditText.setOnAmountChangeListener(new MwAmountEditText.Sts(this) { // from class: com.scb.phone.view.fragment.mwpartner.MwEditCreateQrFragment.5
private MwEditCreateQrFragment a;
{
this.a = this;
}
@Override // com.scb.phone.view.custom.common.MwAmountEditText.Sts
public final void c(double d3) {
this.a.presenter.d(d3);
}
@Override // com.scb.phone.view.custom.common.MwAmountEditText.Sts
public final void c() {
this.a.aN_();
}
});
this.amountEditText.setOnHandleDismissKeyboardListener(new MwAmountEditText.LWm(this) { // from class: o.fnU
private MwEditCreateQrFragment d;
@Override // com.scb.phone.view.custom.common.MwAmountEditText.LWm
public final void c() {
MwEditCreateQrFragment.b(this.d);
}
{
this.d = this;
}
});
this.amountEditText.setOnFocusChangeListener(new View.OnFocusChangeListener(this) { // from class: o.fnS
private MwEditCreateQrFragment a;
@Override // android.view.View.OnFocusChangeListener
public final void onFocusChange(View view, boolean z) {
MwEditCreateQrFragment.a(this.a, z);
}
{
this.a = this;
}
});
if (str != null && !str.isEmpty()) {
this.amountEditText.setText(str);
}
this.shopReference.setErrorMessage(getString(R.string.mw_edit_qr_error_inline_reference));
this.shopReference.setOnNoteInputListener(new NoteEditText.IeS(this) { // from class: o.fnV
private MwEditCreateQrFragment e;
@Override // com.scb.phone.view.custom.common.NoteEditText.IeS
public final void d(boolean z) {
MwEditCreateQrFragment.e(this.e, z);
}
{
this.e = this;
}
}, "^[a-zA-Z0-9]+$", true);
if (str2 != null && !str2.isEmpty()) {
this.shopReference.setText(str2);
}
this.constraintLayout.setOnTouchListener(new View.OnTouchListener(this) { // from class: o.fnY
private MwEditCreateQrFragment e;
@Override // android.view.View.OnTouchListener
public final boolean onTouch(View view, MotionEvent motionEvent) {
return MwEditCreateQrFragment.a(this.e);
}
{
this.e = this;
}
});
}
/* JADX INFO: Access modifiers changed from: package-private */
@OnClick
public void onCreateQrClick() {
C4248bUf c4248bUf = this.presenter;
String obj = this.amountEditText.getText().toString();
String obj2 = this.shopReference.mNoteEditText.getText().toString();
if (c4248bUf.f != 0) {
c4248bUf.f.y();
}
if (c4248bUf.c.e.d() == null || c4248bUf.c.e.d().l == null) {
return;
}
YpL ypL = c4248bUf.c;
ypL.d(ypL.e.c(new C5756bz(c4248bUf.c.e.d().l.get(0).b, obj.replaceAll("[,]", ""), obj2)), new C4248bUf.AnonymousClass2(c4248bUf));
}
@Override // o.InterfaceC9403djA
public final void c() {
this.amountEditText.setText("");
this.c.c(false);
this.shopReference.mNoteEditText.setText("");
this.constraintLayout.requestFocus();
}
@Override // o.InterfaceC9403djA
public final void b(boolean z) {
this.createQrBtn.setEnabled(z);
}
@Override // o.InterfaceC9403djA
public final void d(String str) {
if (isAdded()) {
FragmentActivity activity = getActivity();
activity.setResult(-1, new Intent().putExtra("EXTRA_QR_CODE", str).putExtra("EXTRA_AMOUNT", this.amountEditText.getText().toString()).putExtra("EXTRA_REFERENCE", this.shopReference.mNoteEditText.getText().toString()));
activity.finish();
}
}
public static /* synthetic */ boolean a(MwEditCreateQrFragment mwEditCreateQrFragment) {
if (mwEditCreateQrFragment.shopReference.mNoteEditText.getText().toString().isEmpty() && mwEditCreateQrFragment.amountEditText.getText().toString().isEmpty()) {
mwEditCreateQrFragment.c();
mwEditCreateQrFragment.createQrBtn.setEnabled(true);
} else if (!mwEditCreateQrFragment.shopReference.mNoteEditText.getText().toString().isEmpty() && mwEditCreateQrFragment.amountEditText.getText().toString().isEmpty()) {
mwEditCreateQrFragment.c.c(true);
}
mwEditCreateQrFragment.constraintLayout.requestFocus();
mwEditCreateQrFragment.aN_();
return false;
}
public static /* synthetic */ void b(MwEditCreateQrFragment mwEditCreateQrFragment) {
if (mwEditCreateQrFragment.amountEditText.getText().toString().isEmpty()) {
return;
}
mwEditCreateQrFragment.presenter.d(mwEditCreateQrFragment.amountEditText.c);
}
public static /* synthetic */ void a(MwEditCreateQrFragment mwEditCreateQrFragment, boolean z) {
if (z) {
return;
}
mwEditCreateQrFragment.presenter.d(mwEditCreateQrFragment.amountEditText.c);
}
public static /* synthetic */ void e(MwEditCreateQrFragment mwEditCreateQrFragment, boolean z) {
C4248bUf c4248bUf = mwEditCreateQrFragment.presenter;
c4248bUf.a = mwEditCreateQrFragment.shopReference.mNoteEditText.getText().toString().length() == 0 || z;
C4245bUc c4245bUc = new C4245bUc(c4248bUf);
if (c4248bUf.f != 0) {
c4245bUc.e(c4248bUf.f);
}
}
/* JADX INFO: Access modifiers changed from: package-private */
@OnClick
public void onResetToDefaultClick() {
C4248bUf c4248bUf = this.presenter;
ZI.IeS ieS = new ZI.IeS() { // from class: o.bUe
@Override // o.ZI.IeS
public final void e(Object obj) {
C4248bUf.a((InterfaceC9403djA) obj);
}
};
if (c4248bUf.f != 0) {
ieS.e(c4248bUf.f);
}
}
@Override // o.InterfaceC9403djA
public final void b(C0947Sa c0947Sa) {
this.accountSummary.setUpWithDisplay(c0947Sa.c);
}
}