package com.scb.phone.view.fragment.bond; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.text.SpannableString; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.NumberPicker; 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.activity.bond.BondErrorNoAccountsActivity; import com.scb.phone.view.activity.bond.BondSelectionActivity; import com.scb.phone.view.activity.bond.BondTermsAndConditionsActivity; import com.scb.phone.view.custom.common.AmountEditText; import com.scb.phone.view.custom.common.CommonInputViewGroup; import com.scb.phone.view.custom.common.CustomDialog; import com.scb.phone.view.custom.common.CustomEditText; import com.scb.phone.view.custom.common.CustomInfoArrow; import com.scb.phone.view.custom.common.DefaultButton; import com.scb.phone.view.custom.common.TintInputViewGroup; import com.scb.phone.view.custom.easycash.CustomAccountSelector; import com.scb.phone.view.custom.transferandpay.CustomTransferAndPayItem; import com.scb.phone.view.fragment.bond.BondInputFragment; import com.scb.phone.view.fragment.transferandpay.AccountSourceSelectFragment; import java.util.List; import java.util.Objects; import o.AbstractC13482fbE; import o.C1171Xc; import o.C17603yF; import o.C2585ahQ; import o.C5913cD; import o.C6583cXR; import o.DeS; import o.DialogInterfaceC17187ufv; import o.EV; import o.FI; import o.FJ; import o.InterfaceC1244Ytw; import o.InterfaceC13391fZD; import o.InterfaceC8981dbB; import o.PRA; import o.QAJ; import o.WW; import o.YKU; import o.ZI; import o.cXH; import o.fLM; import o.gjJ; import o.nMh; import o.wxK; /* loaded from: classes5.dex */ public class BondInputFragment extends Hilt_BondInputFragment implements InterfaceC8981dbB, AccountSourceSelectFragment.Sts { @BindView AmountEditText amountEditText; @BindView TextInputLayout amountInputLayout; @BindView CustomTransferAndPayItem amountPayable; @BindView TextView bondAccountDisclaimer; @BindView CustomAccountSelector bondAccounts; @BindView TextView bondCalculationDisclaimer; @BindView CustomInfoArrow bondSelection; @BindView public TintInputViewGroup mobileNumberInput; @InterfaceC13391fZD public C2585ahQ presenter; @BindView CustomTransferAndPayItem pricePerUnit; @BindView DefaultButton reviewButton; @BindView ViewGroup root; @BindView TextView tvBondMobileLabel; @BindView TextView tvSelectBondLabel; @BindView CustomTransferAndPayItem unit; @Override // com.scb.phone.view.fragment.transferandpay.AccountSourceSelectFragment.Sts public final void e_(boolean z) { } public static BondInputFragment d(FI fi, cXH.IeS.EnumC0105IeS enumC0105IeS) { Bundle bundle = new Bundle(); bundle.putParcelable("com.scb.phone.EXTRA_DISPLAY", fi); bundle.putSerializable("PURCHASE_BOND_FLOW", enumC0105IeS); BondInputFragment bondInputFragment = new BondInputFragment(); bondInputFragment.setArguments(bundle); return bondInputFragment; } @Override // androidx.fragment.app.Fragment public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { View inflate = layoutInflater.inflate(R.layout.2131559470, viewGroup, false); ButterKnife.c(this, inflate); this.presenter.e((C2585ahQ) this); v("bond_purchase_input"); if (getArguments() != null && getArguments().getParcelable("com.scb.phone.EXTRA_DISPLAY") != null && getArguments().getSerializable("PURCHASE_BOND_FLOW") != null) { C2585ahQ c2585ahQ = this.presenter; final FI fi = (FI) getArguments().getParcelable("com.scb.phone.EXTRA_DISPLAY"); cXH.IeS.EnumC0105IeS enumC0105IeS = (cXH.IeS.EnumC0105IeS) getArguments().getSerializable("PURCHASE_BOND_FLOW"); c2585ahQ.c = fi; c2585ahQ.g = enumC0105IeS; ZI.IeS ieS = new ZI.IeS(fi) { // from class: o.ahT private FI b; @Override // o.ZI.IeS public final void e(Object obj) { C2585ahQ.c(this.b, (InterfaceC8981dbB) obj); } { this.b = fi; } }; if (c2585ahQ.f != 0) { ieS.e(c2585ahQ.f); } FI fi2 = c2585ahQ.c; fi2.a = !fi2.h.isEmpty() ? c2585ahQ.c.h.get(0) : null; if (enumC0105IeS == cXH.IeS.EnumC0105IeS.DLT) { if (c2585ahQ.f != 0) { c2585ahQ.f.y(); } ZI.IeS ieS2 = new ZI.IeS() { // from class: o.ahS @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC8981dbB) obj).i(); } }; if (c2585ahQ.f != 0) { ieS2.e(c2585ahQ.f); } QAJ qaj = c2585ahQ.a; C5913cD c5913cD = new C5913cD(); c5913cD.d = "all"; qaj.b(c5913cD); QAJ qaj2 = c2585ahQ.a; qaj2.d(qaj2.i, new C2585ahQ.AnonymousClass5(c2585ahQ)); } } return inflate; } @Override // o.InterfaceC8981dbB public final void d(List list) { this.bondAccounts.d(list, new CustomAccountSelector.Sts(this) { // from class: o.eHA private BondInputFragment c; @Override // com.scb.phone.view.custom.easycash.CustomAccountSelector.Sts public final void e(int i) { BondInputFragment.d(this.c, i); } { this.c = this; } }); } @Override // o.InterfaceC8981dbB public final void c(C1171Xc c1171Xc) { AbstractC13482fbE a = getChildFragmentManager().a(); a.b(R.id.fragment_account_source_select, AccountSourceSelectFragment.b(c1171Xc), null, 2); a.b(); } @Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment public void onDestroy() { this.presenter.w_(); super.onDestroy(); } @Override // o.InterfaceC8981dbB public final void b(List list) { startActivityForResult(BondSelectionActivity.Yy_(getContext(), list), 123); } @Override // o.InterfaceC8981dbB public final void b(List list, FJ fj) { Object[] objArr = {getContext(), list, fj}; startActivityForResult((Intent) BondSelectionActivity.a(objArr), 123); } @Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment public void onActivityResult(int i, int i2, Intent intent) { super.onActivityResult(i, i2, intent); if (i == 123 && i2 == -1) { final C2585ahQ c2585ahQ = this.presenter; final FJ fj = (FJ) intent.getParcelableExtra("BOND_SELECTED_DISPLAY_EXTRA"); if (!fj.h) { ZI.IeS ieS = new ZI.IeS() { // from class: o.ahZ @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC8981dbB) obj).a(); } }; if (c2585ahQ.f != 0) { ieS.e(c2585ahQ.f); } } final double doubleValue = C6583cXR.c(fj.g).doubleValue(); c2585ahQ.c.m = C6583cXR.c(fj.k).doubleValue(); c2585ahQ.c.j = doubleValue; c2585ahQ.c.l = fj; ZI.IeS ieS2 = new ZI.IeS(c2585ahQ, fj, doubleValue) { // from class: o.aig private double a; private FJ c; private C2585ahQ d; @Override // o.ZI.IeS public final void e(Object obj) { C2585ahQ.e(this.d, this.c, this.a, (InterfaceC8981dbB) obj); } { this.d = c2585ahQ; this.c = fj; this.a = doubleValue; } }; if (c2585ahQ.f != 0) { ieS2.e(c2585ahQ.f); } } } @Override // o.InterfaceC8981dbB public final void g(String str) { this.pricePerUnit.setVisibility(0); this.pricePerUnit.setValue(str); } @Override // com.scb.phone.view.fragment.transferandpay.AccountSourceSelectFragment.Sts public final void a(final WW ww) { final C2585ahQ c2585ahQ = this.presenter; c2585ahQ.c.f8156o = ww; ZI.IeS ieS = new ZI.IeS(c2585ahQ, ww) { // from class: o.aia private WW c; private C2585ahQ d; @Override // o.ZI.IeS public final void e(Object obj) { C2585ahQ.d(this.d, this.c, (InterfaceC8981dbB) obj); } { this.d = c2585ahQ; this.c = ww; } }; if (c2585ahQ.f != 0) { ieS.e(c2585ahQ.f); } } @Override // o.InterfaceC8981dbB public final void a(double d, double d2) { AmountEditText amountEditText = this.amountEditText; amountEditText.setCurrencyFormattingTextWatcher(new fLM(amountEditText, this.amountInputLayout, Double.MAX_VALUE, d, d2, getResources().getString(R.string.min_error_amount), getResources().getString(R.string.not_enough_funds_on_selected_account), getResources().getString(R.string.invalid_amount_transfer_input))); this.amountEditText.setOnAmountChangeListener(new AmountEditText.RVV(this) { // from class: com.scb.phone.view.fragment.bond.BondInputFragment.4 private BondInputFragment a; { this.a = this; } @Override // com.scb.phone.view.custom.common.AmountEditText.RVV public final void b(double d3) { final C2585ahQ c2585ahQ = this.a.presenter; c2585ahQ.c.c = d3; c2585ahQ.c.n = (long) (c2585ahQ.c.c / c2585ahQ.c.m); c2585ahQ.c.b = c2585ahQ.c.n * c2585ahQ.c.m; ZI.IeS ieS = new ZI.IeS(c2585ahQ) { // from class: o.ahV private C2585ahQ a; @Override // o.ZI.IeS public final void e(Object obj) { C2585ahQ.c(this.a, (InterfaceC8981dbB) obj); } { this.a = c2585ahQ; } }; if (c2585ahQ.f != 0) { ieS.e(c2585ahQ.f); } } @Override // com.scb.phone.view.custom.common.AmountEditText.RVV public final void a() { C2585ahQ c2585ahQ = this.a.presenter; ZI.IeS ieS = new ZI.IeS() { // from class: o.ahP @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC8981dbB) obj).aN_(); } }; if (c2585ahQ.f != 0) { ieS.e(c2585ahQ.f); } } }); this.amountEditText.setHandleDismissKeyboard(new AmountEditText.LWm(this) { // from class: o.eHv private BondInputFragment a; @Override // com.scb.phone.view.custom.common.AmountEditText.LWm public final void d() { this.a.aN_(); } { this.a = this; } }); } @Override // o.InterfaceC8981dbB public final void c(double d) { this.amountEditText.setAvailableBalanceCurrencyFormattingTextWatcher(d); } @Override // o.InterfaceC8981dbB public final void b_(boolean z) { this.amountEditText.setEnabled(z); } @Override // o.InterfaceC8981dbB public final void m(String str) { this.unit.setValue(str); } @Override // o.InterfaceC8981dbB public final void c(String str) { this.amountPayable.setValue(str); } @Override // o.InterfaceC8981dbB public final void d(String str) { this.bondCalculationDisclaimer.setText(str); } @Override // o.InterfaceC8981dbB public final void b(String str) { this.bondAccountDisclaimer.setText(str); } @OnClick public void onReviewButtomClick() { final C2585ahQ c2585ahQ = this.presenter; if (c2585ahQ.g == cXH.IeS.EnumC0105IeS.DLT) { if (c2585ahQ.c.g) { ZI.IeS ieS = new ZI.IeS(c2585ahQ) { // from class: o.ahO private C2585ahQ e; @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC8981dbB) obj).a(this.e.c.i.d); } { this.e = c2585ahQ; } }; if (c2585ahQ.f != 0) { ieS.e(c2585ahQ.f); return; } return; } ZI.IeS ieS2 = new ZI.IeS(c2585ahQ) { // from class: o.ahW private C2585ahQ e; @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC8981dbB) obj).a((String) C6583cXR.c(new Object[]{false, true, this.e.c.i.b}, -1092823629, 1092823630, (int) System.currentTimeMillis())); } { this.e = c2585ahQ; } }; if (c2585ahQ.f != 0) { ieS2.e(c2585ahQ.f); return; } return; } c2585ahQ.a(); } @Override // o.InterfaceC8981dbB public final void b(FI fi, cXH.IeS.EnumC0105IeS enumC0105IeS) { startActivity((Intent) BondTermsAndConditionsActivity.d(new Object[]{getContext(), fi, enumC0105IeS}, -1775987258, 1775987259, (int) System.currentTimeMillis())); } @Override // o.InterfaceC8981dbB public final void h(String str) { Context context = getContext(); EV.IeS a = EV.a(); a.d = R.drawable.ic_bond_empty_state; a.b = getString(R.string.bond_msg_no_bonds_title); a.a = getString(R.string.bond_msg_no_bonds_description_not_clickable); a.e = getString(R.string.bond_msg_no_bonds_description_clickable); a.c = getString(R.string.bond_selection_title); BondErrorNoAccountsActivity.a(context, new EV(a, (byte) 0), str); } @Override // o.InterfaceC8981dbB public final void b(boolean z) { this.reviewButton.setButtonEnabled(z); } @Override // o.InterfaceC8981dbB public final void a() { this.amountEditText.clearFocus(); this.amountEditText.setHint(getString(R.string.transfer_to_account_amount_hint)); this.amountEditText.getText().clear(); this.root.requestFocus(); this.amountInputLayout.setError(null); } @Override // o.InterfaceC8981dbB public final void b() { this.mobileNumberInput.setTitle(getString(R.string.auto_purchase_bond_dlt_mobile_number_title)); this.mobileNumberInput.setHint(getString(R.string.auto_purchase_bond_dlt_mobile_number_placeholder)); this.mobileNumberInput.setOnBackListener(new CustomEditText.LWm(this) { // from class: o.eHu private BondInputFragment a; @Override // com.scb.phone.view.custom.common.CustomEditText.LWm public final void a() { BondInputFragment bondInputFragment = this.a; bondInputFragment.mobileNumberInput.setFocusable(true); bondInputFragment.mobileNumberInput.setFocusableInTouchMode(true); bondInputFragment.mobileNumberInput.requestFocus(); } { this.a = this; } }); this.mobileNumberInput.mEditText.setOnFocusChangeListener(new View.OnFocusChangeListener(this) { // from class: o.eHt private BondInputFragment b; @Override // android.view.View.OnFocusChangeListener public final void onFocusChange(View view, boolean z) { BondInputFragment.a(this.b, z); } { this.b = this; } }); this.mobileNumberInput.setOnEditorActionListener(new TextView.OnEditorActionListener(this) { // from class: o.eHw private BondInputFragment a; @Override // android.widget.TextView.OnEditorActionListener public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { return BondInputFragment.b(this.a, i); } { this.a = this; } }); } @Override // o.InterfaceC8981dbB public final void e(String str) { this.mobileNumberInput.setText(str); TintInputViewGroup tintInputViewGroup = this.mobileNumberInput; tintInputViewGroup.e = true; tintInputViewGroup.mEditClearImageButton.setVisibility(0); this.mobileNumberInput.setClearTextIconColorFilter(R.color.f3412131099849); this.mobileNumberInput.setClearTextIconListener(new CommonInputViewGroup.Sts(this) { // from class: o.eHx private BondInputFragment a; @Override // com.scb.phone.view.custom.common.CommonInputViewGroup.Sts public final void c() { BondInputFragment.e(this.a); } { this.a = this; } }); } @Override // o.InterfaceC8981dbB public final void h() { this.mobileNumberInput.setErrorText(getString(R.string.error_prompt_pay_mobile_validation)); TintInputViewGroup tintInputViewGroup = this.mobileNumberInput; tintInputViewGroup.mEditText.setBackground(nMh.getDrawable(tintInputViewGroup.getContext(), R.drawable.shape_red_reounded_reactangle_border)); tintInputViewGroup.mErrorTextView.setVisibility(0); } @Override // o.InterfaceC8981dbB public final void d() { this.mobileNumberInput.setErrorText(getString(R.string.incomplete_information)); TintInputViewGroup tintInputViewGroup = this.mobileNumberInput; tintInputViewGroup.mEditText.setBackground(nMh.getDrawable(tintInputViewGroup.getContext(), R.drawable.shape_red_reounded_reactangle_border)); tintInputViewGroup.mErrorTextView.setVisibility(0); } @Override // o.InterfaceC8981dbB public final void b(String[] strArr, int i) { View inflate = LayoutInflater.from(getContext()).inflate(R.layout.2131559289, this.root, false); final NumberPicker numberPicker = (NumberPicker) inflate.findViewById(R.id.mobile_number_picker); TextView textView = (TextView) inflate.findViewById(R.id.tv_mobile_number_picker_title); Button button = (Button) inflate.findViewById(R.id.bt_done); DialogInterfaceC17187ufv.HBt hBt = new DialogInterfaceC17187ufv.HBt((Context) Objects.requireNonNull(getContext())); hBt.b.B = inflate; hBt.b.A = 0; hBt.b.G = false; textView.setText(R.string.auto_purchase_bond_dlt_mobile_number_title); numberPicker.setMinValue(0); numberPicker.setMaxValue(strArr.length - 1); numberPicker.setValue(i); numberPicker.setDisplayedValues(strArr); numberPicker.setWrapSelectorWheel(false); final DialogInterfaceC17187ufv b = hBt.b(); b.setCancelable(false); b.requestWindowFeature(1); b.show(); button.setOnClickListener(new View.OnClickListener(this, numberPicker, b) { // from class: o.eHy private BondInputFragment a; private DialogInterfaceC17187ufv b; private NumberPicker c; @Override // android.view.View.OnClickListener public final void onClick(View view) { BondInputFragment.aqM_(this.a, this.c, this.b); } { this.a = this; this.c = numberPicker; this.b = b; } }); } @Override // o.InterfaceC8981dbB public final void f(String str) { this.mobileNumberInput.setFocusable(true); this.mobileNumberInput.setFocusableInTouchMode(true); this.mobileNumberInput.requestFocus(); this.mobileNumberInput.setText(str); } @Override // o.InterfaceC8981dbB public final void a(String str) { CustomDialog b = CustomDialog.b(getContext()); SpannableString Vb_ = C2585ahQ.Vb_(getString(R.string.auto_purchase_bond_dlt_popup_message), str); if (gjJ.a(Vb_)) { b.mTextTextView.setVisibility(0); b.mTextTextView.setText(Vb_); } ((CustomDialog) CustomDialog.e(new Object[]{b.aoT_(R.string.confirm, new DialogInterface.OnClickListener(this) { // from class: o.eHB private BondInputFragment e; @Override // android.content.DialogInterface.OnClickListener public final void onClick(DialogInterface dialogInterface, int i) { this.e.presenter.a(); } { this.e = this; } }), Integer.valueOf(R.string.cancel), new DialogInterface.OnClickListener() { // from class: o.eHz @Override // android.content.DialogInterface.OnClickListener public final void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }})).show(); } @Override // o.InterfaceC8981dbB public final void i() { this.tvSelectBondLabel.setText(R.string.auto_purchase_bond_dlt_input_bond_order); this.tvBondMobileLabel.setVisibility(0); this.mobileNumberInput.setVisibility(0); } @Override // o.InterfaceC8981dbB public final void c() { TintInputViewGroup tintInputViewGroup = this.mobileNumberInput; tintInputViewGroup.e = false; tintInputViewGroup.mEditClearImageButton.setVisibility(8); } public static /* synthetic */ boolean b(BondInputFragment bondInputFragment, int i) { if (i != 6) { return false; } bondInputFragment.mobileNumberInput.setFocusable(true); bondInputFragment.mobileNumberInput.setFocusableInTouchMode(true); bondInputFragment.mobileNumberInput.requestFocus(); bondInputFragment.aN_(); return true; } public static /* synthetic */ void d(BondInputFragment bondInputFragment, int i) { FI fi = bondInputFragment.presenter.c; fi.a = fi.h.get(i); } public static /* synthetic */ void aqM_(BondInputFragment bondInputFragment, NumberPicker numberPicker, DialogInterfaceC17187ufv dialogInterfaceC17187ufv) { final C2585ahQ c2585ahQ = bondInputFragment.presenter; final int value = numberPicker.getValue(); c2585ahQ.h = value; FI fi = c2585ahQ.c; C17603yF c17603yF = c2585ahQ.d; fi.i = C17603yF.a(c2585ahQ.e.get(value).b, true); c2585ahQ.c.g = true; c2585ahQ.a(c2585ahQ.e.get(value).b); ZI.IeS ieS = new ZI.IeS(c2585ahQ, value) { // from class: o.ahU private C2585ahQ a; private int e; @Override // o.ZI.IeS public final void e(Object obj) { C2585ahQ.d(this.a, this.e, (InterfaceC8981dbB) obj); } { this.a = c2585ahQ; this.e = value; } }; if (c2585ahQ.f != 0) { ieS.e(c2585ahQ.f); } dialogInterfaceC17187ufv.dismiss(); } public static /* synthetic */ void a(BondInputFragment bondInputFragment, boolean z) { final C2585ahQ c2585ahQ = bondInputFragment.presenter; final String obj = bondInputFragment.mobileNumberInput.mEditText.getText().toString(); if (!z) { c2585ahQ.a(obj); return; } c2585ahQ.c.i = null; c2585ahQ.c.g = false; ZI.IeS ieS = new ZI.IeS(c2585ahQ, obj) { // from class: o.ahX private C2585ahQ a; private String d; @Override // o.ZI.IeS public final void e(Object obj2) { C2585ahQ.e(this.a, this.d, (InterfaceC8981dbB) obj2); } { this.a = c2585ahQ; this.d = obj; } }; if (c2585ahQ.f != 0) { ieS.e(c2585ahQ.f); } } public static /* synthetic */ void e(BondInputFragment bondInputFragment) { final C2585ahQ c2585ahQ = bondInputFragment.presenter; YKU yku = new YKU(c2585ahQ.e); final List list = (List) new YKU(yku.a, new wxK(yku.b, new InterfaceC1244Ytw() { // from class: o.aib @Override // o.InterfaceC1244Ytw public final Object d(Object obj) { return ((C1003Tl) obj).d; } })).a(new PRA.Sts(new PRA.AnonymousClass4(), new PRA.AnonymousClass8())); final String[] strArr = new String[list.size()]; ZI.IeS ieS = new ZI.IeS(c2585ahQ, list, strArr) { // from class: o.ahY private String[] c; private List d; private C2585ahQ e; @Override // o.ZI.IeS public final void e(Object obj) { InterfaceC8981dbB interfaceC8981dbB = (InterfaceC8981dbB) obj; interfaceC8981dbB.b((String[]) this.d.toArray(this.c), this.e.h); } { this.e = c2585ahQ; this.d = list; this.c = strArr; } }; if (c2585ahQ.f != 0) { ieS.e(c2585ahQ.f); } } @Override // o.InterfaceC8981dbB public final void e() { TintInputViewGroup tintInputViewGroup = this.mobileNumberInput; tintInputViewGroup.mEditText.setBackground(nMh.getDrawable(tintInputViewGroup.getContext(), R.drawable.shape_gray_rounded_rectangle_with_focus_color)); tintInputViewGroup.mErrorTextView.setVisibility(8); } @OnClick public void onBondSelectionClick() { C2585ahQ c2585ahQ = this.presenter; if (c2585ahQ.f != 0) { c2585ahQ.f.y(); } c2585ahQ.b.b(c2585ahQ.c.a.s); DeS deS = c2585ahQ.b; deS.d(deS.i, new C2585ahQ.AnonymousClass4(c2585ahQ)); } @Override // o.InterfaceC8981dbB public final void d(FJ fj) { this.bondSelection.setSubtitle(fj.d); this.bondSelection.setDescription(fj.j); this.bondSelection.divider.setVisibility(0); } @Override // o.InterfaceC8981dbB public final void d(int i, String str) { this.mobileNumberInput.mEditText.setFilters(C2585ahQ.Va_(i)); this.mobileNumberInput.mEditText.setText(str); } }