package com.scb.phone.view.fragment.sme.gifting; 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.TextView; import butterknife.BindView; import butterknife.ButterKnife; import com.google.android.material.textfield.TextInputLayout; import com.scb.phone.R; import com.scb.phone.view.activity.BaseActivity; import com.scb.phone.view.activity.sme.gifting.GiftingMoneyReviewActivity; import com.scb.phone.view.activity.sme.gifting.GiftingSelectRecipientActivity; import com.scb.phone.view.custom.common.AmountEditText; import com.scb.phone.view.fragment.sme.gifting.GiftingMoneyTransferInputFragment; import com.scb.phone.view.fragment.transferandpay.AccountSourceSelectFragment; import o.AbstractC13482fbE; import o.C1171Xc; import o.C1189Xo; import o.C14801g; import o.C15602gz; import o.C16124lSp; import o.C6583cXR; import o.InterfaceC13391fZD; import o.InterfaceC6673cZp; import o.WG; import o.WM; import o.WW; import o.YE; import o.Ydl; import o.ZI; import o.cJP; import o.fLM; import o.qhK; /* loaded from: classes5.dex */ public class GiftingMoneyTransferInputFragment extends Hilt_GiftingMoneyTransferInputFragment implements InterfaceC6673cZp.HBt, AccountSourceSelectFragment.Sts { @BindView ViewGroup giftLimitProgress; @InterfaceC13391fZD public cJP giftingTransferInputPresenter; @BindView TextInputLayout mAmountInputLayout; @BindView AmountEditText mAmountValue; @BindView TextView mRemainingLimit; @Override // com.scb.phone.view.fragment.transferandpay.AccountSourceSelectFragment.Sts public final void e_(boolean z) { } public static GiftingMoneyTransferInputFragment c(WM wm) { Bundle bundle = new Bundle(); bundle.putParcelable("GIFT_TRANSFER_DISPLAY", wm); GiftingMoneyTransferInputFragment giftingMoneyTransferInputFragment = new GiftingMoneyTransferInputFragment(); giftingMoneyTransferInputFragment.setArguments(bundle); return giftingMoneyTransferInputFragment; } @Override // com.scb.phone.view.fragment.sme.gifting.BaseGiftTransferInputFragment, androidx.fragment.app.Fragment public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { View onCreateView = super.onCreateView(layoutInflater, viewGroup, bundle); this.giftingTransferInputPresenter.e((cJP) this); cJP cjp = this.giftingTransferInputPresenter; final WM wm = (WM) getArguments().getParcelable("GIFT_TRANSFER_DISPLAY"); cjp.a = wm; if (cjp.f != 0) { ZI.IeS ieS = new ZI.IeS(wm) { // from class: o.cJN private WM d; @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC6673cZp.HBt) obj).a(this.d); } { this.d = wm; } }; if (cjp.f != 0) { ieS.e(cjp.f); } } AbstractC13482fbE a = getChildFragmentManager().a(); C1171Xc.IeS ieS2 = new C1171Xc.IeS(YE.TRANSFER_FUNCTION); C1171Xc c1171Xc = ieS2.c; c1171Xc.a = false; c1171Xc.b = true; c1171Xc.j = true; c1171Xc.g = true; a.b(R.id.fragment_account_source_select, AccountSourceSelectFragment.b(ieS2.c), null, 2); a.b(); this.mAmountValue.setOnAmountChangeListener(new AmountEditText.RVV(this) { // from class: com.scb.phone.view.fragment.sme.gifting.GiftingMoneyTransferInputFragment.2 private GiftingMoneyTransferInputFragment b; @Override // com.scb.phone.view.custom.common.AmountEditText.RVV public final void b(double d) { } { this.b = this; } @Override // com.scb.phone.view.custom.common.AmountEditText.RVV public final void a() { this.b.noteEditText.requestFocus(); } }); this.mAmountValue.setCustomHint(getString(R.string.transfer_to_account_amount_hint), this.mAmountInputLayout); this.mAmountInputLayout.setHintEnabled(false); AmountEditText amountEditText = this.mAmountValue; amountEditText.setCurrencyFormattingTextWatcher(new fLM(amountEditText, this.mAmountInputLayout, 9.9999999999E8d, 0.0d, getResources().getString(R.string.error_limit), getResources().getString(R.string.not_enough_funds_on_selected_account), getResources().getString(R.string.invalid_amount_transfer_input))); this.mAmountValue.setHandleDismissKeyboard(new AmountEditText.LWm(this) { // from class: o.fBM private GiftingMoneyTransferInputFragment d; @Override // com.scb.phone.view.custom.common.AmountEditText.LWm public final void d() { this.d.aN_(); } { this.d = this; } }); this.mAmountValue.setOnFocusChangeListener(new View.OnFocusChangeListener(this) { // from class: o.fBL private GiftingMoneyTransferInputFragment d; @Override // android.view.View.OnFocusChangeListener public final void onFocusChange(View view, boolean z) { GiftingMoneyTransferInputFragment.c(this.d, z); } { this.d = this; } }); return onCreateView; } @Override // com.scb.phone.view.fragment.sme.gifting.BaseGiftTransferInputFragment protected final View axz_(LayoutInflater layoutInflater, ViewGroup viewGroup) { View inflate = layoutInflater.inflate(R.layout.2131559675, viewGroup, false); ButterKnife.c(this, inflate); this.mAmountValue.setOnPasteListener(new AmountEditText.HBt()); return inflate; } @Override // o.InterfaceC6673cZp.HBt public final void d(double d) { this.mAmountValue.setAvailableBalanceCurrencyFormattingTextWatcher(d); } @Override // com.scb.phone.view.fragment.sme.gifting.BaseGiftTransferInputFragment protected final void c(final WG wg) { String str; cJP cjp = this.giftingTransferInputPresenter; cjp.c = wg; if (wg != null) { if (cjp.f != 0) { ZI.IeS ieS = new ZI.IeS(wg) { // from class: o.cJU private WG e; @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC6673cZp.HBt) obj).b(this.e); } { this.e = wg; } }; if (cjp.f != 0) { ieS.e(cjp.f); } ZI.IeS ieS2 = new ZI.IeS() { // from class: o.cJV @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC6673cZp.HBt) obj).c(); } }; if (cjp.f != 0) { ieS2.e(cjp.f); } } Ydl ydl = cjp.d; if (C6583cXR.d(qhK.SCB).equalsIgnoreCase(wg.g)) { str = "SCB"; } else { str = C6583cXR.d(qhK.PROMPTPAY).equalsIgnoreCase(wg.g) ? "PROMPTPAY" : wg.g; } ydl.e(str); Ydl ydl2 = cjp.d; ydl2.d(ydl2.i, new cJP.HBt(cjp, (byte) 0)); return; } if (cjp.f != 0) { ZI.IeS ieS3 = new ZI.IeS() { // from class: o.cJW @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC6673cZp.HBt) obj).e(); } }; if (cjp.f != 0) { ieS3.e(cjp.f); } } } /* JADX INFO: Access modifiers changed from: protected */ @Override // com.scb.phone.view.fragment.sme.gifting.BaseGiftTransferInputFragment public final void g() { String str; cJP cjp = this.giftingTransferInputPresenter; boolean z = !this.mAmountInputLayout.f6485o.c; String obj = this.mAmountValue.getText().toString(); boolean isEnabled = this.sendGiftButton.isEnabled(); if (cjp.f != 0) { if (isEnabled != ((!z || (str = cjp.e) == null || str.isEmpty() || cjp.c == null || TextUtils.isEmpty(obj)) ? false : true)) { ZI.IeS ieS = new ZI.IeS() { // from class: o.cJS @Override // o.ZI.IeS public final void e(Object obj2) { ((InterfaceC6673cZp.HBt) obj2).f(); } }; if (cjp.f != 0) { ieS.e(cjp.f); } } } } @Override // o.InterfaceC6673cZp.HBt public final void d(String str) { this.mRemainingLimit.setVisibility(0); this.mRemainingLimit.setText(str); this.customSelectAccountGift.requestFocus(); } @Override // o.InterfaceC6673cZp.HBt public final void d() { this.mRemainingLimit.setVisibility(0); this.mRemainingLimit.setText(getString(R.string.custom_error_title)); this.customSelectAccountGift.requestFocus(); } @Override // com.scb.phone.view.fragment.sme.gifting.BaseGiftTransferInputFragment protected final void j() { cJP cjp = this.giftingTransferInputPresenter; String obj = this.mAmountValue.getText().toString(); String obj2 = this.noteEditText.mNoteEditText.getText().toString(); if (!TextUtils.isEmpty(obj2) && !((Boolean) C6583cXR.c(new Object[]{obj2}, -1032102340, 1032102340, (int) System.currentTimeMillis())).booleanValue()) { if (cjp.f != 0) { ZI.IeS ieS = new ZI.IeS() { // from class: o.cJR @Override // o.ZI.IeS public final void e(Object obj3) { ((InterfaceC6673cZp.HBt) obj3).b(); } }; if (cjp.f != 0) { ieS.e(cjp.f); return; } return; } return; } if (TextUtils.isEmpty(obj) || cjp.e == null) { return; } if (cjp.f != 0) { cjp.f.y(); } C16124lSp c16124lSp = cjp.b; C14801g d = C14801g.d(); d.c = cjp.e; d.e = C15602gz.e(C6583cXR.c(obj).doubleValue()); d.i = cjp.c.g; d.d = String.valueOf(cjp.a.f); d.f = obj2; if (cjp.c.g.equalsIgnoreCase(C6583cXR.d(qhK.PROMPTPAY))) { d.g = cjp.c.a; d.h = cjp.c.i; } else { d.a = cjp.c.a; d.b = cjp.c.c; } c16124lSp.d(d); C16124lSp c16124lSp2 = cjp.b; c16124lSp2.d(c16124lSp2.i, new cJP.IeS(cjp, cjp.a, cjp.e, cjp.c, obj, obj2)); } @Override // com.scb.phone.view.fragment.sme.gifting.BaseGiftTransferInputFragment protected void onPreviewButtonClicked() { ((BaseActivity) getActivity()).scbAnalytics.c("gifting_input_preview"); final cJP cjp = this.giftingTransferInputPresenter; final String obj = this.noteEditText.mNoteEditText.getText().toString(); if (cjp.f != 0) { ZI.IeS ieS = new ZI.IeS(cjp, obj) { // from class: o.cJQ private String a; private cJP b; @Override // o.ZI.IeS public final void e(Object obj2) { InterfaceC6673cZp.HBt hBt = (InterfaceC6673cZp.HBt) obj2; hBt.a(r0.i.a(r0.a, "money", this.b.b.a.J(), this.a)); } { this.b = cjp; this.a = obj; } }; if (cjp.f != 0) { ieS.e(cjp.f); } } } @Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment public void onDestroy() { super.onDestroy(); this.giftingTransferInputPresenter.w_(); if (((BaseGiftTransferInputFragment) this).c == null || ((BaseGiftTransferInputFragment) this).c.isDisposed()) { return; } ((BaseGiftTransferInputFragment) this).c.dispose(); } @Override // o.InterfaceC6673cZp.HBt public final void c() { ViewGroup viewGroup = this.giftLimitProgress; if (viewGroup != null) { viewGroup.setVisibility(0); } } @Override // o.InterfaceC6673cZp.HBt public final void a() { ViewGroup viewGroup = this.giftLimitProgress; if (viewGroup != null) { viewGroup.setVisibility(8); } } @Override // o.InterfaceC12872fJp public final void i() { Intent intent = new Intent(getActivity(), (Class) GiftingSelectRecipientActivity.class); intent.putExtra("RECIPIENT_TYPE", "money"); startActivityForResult(intent, 100); } @Override // o.InterfaceC6673cZp.HBt public final void b(C1189Xo c1189Xo) { GiftingMoneyReviewActivity.d(getActivity(), c1189Xo); } @Override // com.scb.phone.view.fragment.transferandpay.AccountSourceSelectFragment.Sts public final void a(WW ww) { if (ww != null) { cJP cjp = this.giftingTransferInputPresenter; String str = ww.s; final double doubleValue = ww.d.doubleValue(); cjp.e = str; if (cjp.f != 0) { ZI.IeS ieS = new ZI.IeS(doubleValue) { // from class: o.cJO private double a; @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC6673cZp.HBt) obj).d(this.a); } { this.a = doubleValue; } }; if (cjp.f != 0) { ieS.e(cjp.f); } } } } public static /* synthetic */ void c(GiftingMoneyTransferInputFragment giftingMoneyTransferInputFragment, boolean z) { if (z) { TextInputLayout textInputLayout = giftingMoneyTransferInputFragment.mAmountInputLayout; if (textInputLayout != null) { textInputLayout.setHintEnabled(false); } giftingMoneyTransferInputFragment.mAmountInputLayout.setHint(""); return; } if (C6583cXR.q(giftingMoneyTransferInputFragment.mAmountValue.getText().toString())) { giftingMoneyTransferInputFragment.mAmountValue.setText(""); } } }