package com.scb.phone.view.fragment.mailingaddress; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import butterknife.OnClick; import com.scb.phone.view.activity.BaseActivity; import com.scb.phone.view.custom.common.CustomAddressInput; import o.AbstractC14961gcz; import o.C0406Fx; import o.C14957gcv; import o.C15962jw; import o.C4128bQt; import o.C4160bRu; import o.C4486bb; import o.C4697bf; import o.C4803bh; import o.C5068bm; import o.C5174bo; import o.C5227bp; import o.FcG; import o.InterfaceC13391fZD; import o.InterfaceC13393fZL; import o.InterfaceC14890gbN; import o.InterfaceC17396wQp; import o.Kmx; import o.RA; import o.UdU; import o.ZI; import o.fZZ; /* loaded from: classes5.dex */ public final class MailingAddressInputFragment extends Hilt_MailingAddressInputFragment { public static final HBt c = new HBt(0); private IeS d; private final InterfaceC13393fZL i; @InterfaceC13391fZD public C4160bRu mailingAddressInputPresenter; private String h = ""; private String f = ""; /* loaded from: classes5.dex */ public interface IeS { void a(RA ra, C0406Fx c0406Fx, String str, String str2); void f(); } public MailingAddressInputFragment() { RVV rvv = RVV.d; C14957gcv.e(rvv, ""); this.i = new fZZ(rvv); } /* loaded from: classes5.dex */ public static final class HBt { private HBt() { } public /* synthetic */ HBt(byte b) { this(); } } @Override // com.scb.phone.view.fragment.mailingaddress.BaseMailingAddressFragment, androidx.fragment.app.Fragment public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { C14957gcv.e(layoutInflater, ""); InterfaceC17396wQp activity = getActivity(); C4160bRu c4160bRu = null; this.d = activity instanceof IeS ? (IeS) activity : null; C4160bRu c4160bRu2 = this.mailingAddressInputPresenter; if (c4160bRu2 != null) { c4160bRu = c4160bRu2; } else { C14957gcv.a(""); } c4160bRu.e((C4160bRu) this); return super.onCreateView(layoutInflater, viewGroup, bundle); } @Override // com.scb.phone.view.fragment.mailingaddress.BaseMailingAddressFragment, androidx.fragment.app.Fragment public final void onViewCreated(View view, Bundle bundle) { C14957gcv.e(view, ""); final C4128bQt c4128bQt = null; if (getArguments() != null) { Bundle arguments = getArguments(); if (arguments != null) { arguments.containsKey("EXTRA_MAILING_ADDRESS_SUB_DISTRICT_DISPLAY"); } Bundle arguments2 = getArguments(); c(arguments2 != null ? (C0406Fx) arguments2.getParcelable("EXTRA_MAILING_ADDRESS_SUB_DISTRICT_DISPLAY") : null); Bundle arguments3 = getArguments(); if (arguments3 != null) { arguments3.containsKey("EXTRA_INPUT_LOCALE"); } Bundle arguments4 = getArguments(); this.h = String.valueOf(arguments4 != null ? arguments4.getString("EXTRA_INPUT_LOCALE") : null); Bundle arguments5 = getArguments(); if (arguments5 != null) { arguments5.containsKey("TOKEN_ID"); } Bundle arguments6 = getArguments(); this.f = String.valueOf(arguments6 != null ? arguments6.getString("TOKEN_ID") : null); Bundle arguments7 = getArguments(); if (arguments7 != null) { arguments7.containsKey("EXTRA_MAILING_ADDRESS_DISPLAY"); } Bundle arguments8 = getArguments(); a(arguments8 != null ? (RA) arguments8.getParcelable("EXTRA_MAILING_ADDRESS_DISPLAY") : null); } super.onViewCreated(view, bundle); s(); C4128bQt c4128bQt2 = this.presenter; if (c4128bQt2 != null) { c4128bQt = c4128bQt2; } else { C14957gcv.a(""); } RA n = n(); C0406Fx k = k(); String str = this.h; C14957gcv.e(str, ""); c4128bQt.c = n; c4128bQt.h = k; String M = c4128bQt.d.M(); C14957gcv.c((Object) M, ""); c4128bQt.e = M; c4128bQt.a = str; if (c4128bQt.c == null) { ZI.IeS ieS = new ZI.IeS(c4128bQt) { // from class: o.bQJ private C4128bQt c; @Override // o.ZI.IeS public final void e(Object obj) { C4128bQt.c(this.c, (InterfaceC9445djq) obj); } { this.c = c4128bQt; } }; if (c4128bQt.f != 0) { ieS.e(c4128bQt.f); } } else { ZI.IeS ieS2 = new ZI.IeS() { // from class: o.bQK @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC9445djq) obj).b(); } }; if (c4128bQt.f != 0) { ieS2.e(c4128bQt.f); } } ZI.IeS ieS3 = new ZI.IeS(c4128bQt) { // from class: o.bQL private C4128bQt b; @Override // o.ZI.IeS public final void e(Object obj) { C4128bQt.i(this.b, (InterfaceC9445djq) obj); } { this.b = c4128bQt; } }; if (c4128bQt.f != 0) { ieS3.e(c4128bQt.f); } ZI.IeS ieS4 = new ZI.IeS(c4128bQt) { // from class: o.bQP private C4128bQt b; @Override // o.ZI.IeS public final void e(Object obj) { C4128bQt.d(this.b, (InterfaceC9445djq) obj); } { this.b = c4128bQt; } }; if (c4128bQt.f != 0) { ieS4.e(c4128bQt.f); } } @OnClick public final void onNextButtonClick() { C4486bb c4486bb; r(); CustomAddressInput customAddressInput = this.houseNo; if (customAddressInput == null) { C14957gcv.a(""); customAddressInput = null; } String trim = customAddressInput.inputTextField.getText().toString().trim(); C14957gcv.c((Object) trim, ""); CustomAddressInput customAddressInput2 = this.unit; if (customAddressInput2 == null) { C14957gcv.a(""); customAddressInput2 = null; } String trim2 = customAddressInput2.inputTextField.getText().toString().trim(); C14957gcv.c((Object) trim2, ""); CustomAddressInput customAddressInput3 = this.floor; if (customAddressInput3 == null) { C14957gcv.a(""); customAddressInput3 = null; } String trim3 = customAddressInput3.inputTextField.getText().toString().trim(); C14957gcv.c((Object) trim3, ""); CustomAddressInput customAddressInput4 = this.village; if (customAddressInput4 == null) { C14957gcv.a(""); customAddressInput4 = null; } String trim4 = customAddressInput4.inputTextField.getText().toString().trim(); C14957gcv.c((Object) trim4, ""); CustomAddressInput customAddressInput5 = this.moo; if (customAddressInput5 == null) { C14957gcv.a(""); customAddressInput5 = null; } String trim5 = customAddressInput5.inputTextField.getText().toString().trim(); C14957gcv.c((Object) trim5, ""); CustomAddressInput customAddressInput6 = this.road; if (customAddressInput6 == null) { C14957gcv.a(""); customAddressInput6 = null; } String trim6 = customAddressInput6.inputTextField.getText().toString().trim(); C14957gcv.c((Object) trim6, ""); CustomAddressInput customAddressInput7 = this.alley; if (customAddressInput7 == null) { C14957gcv.a(""); customAddressInput7 = null; } String trim7 = customAddressInput7.inputTextField.getText().toString().trim(); C14957gcv.c((Object) trim7, ""); TextView textView = this.districtLabel; if (textView == null) { C14957gcv.a(""); textView = null; } String obj = textView.getText().toString(); TextView textView2 = this.subDistrictLabel; if (textView2 == null) { C14957gcv.a(""); textView2 = null; } String obj2 = textView2.getText().toString(); TextView textView3 = this.provinceLabel; if (textView3 == null) { C14957gcv.a(""); textView3 = null; } String obj3 = textView3.getText().toString(); TextView textView4 = this.postalCodeLabel; if (textView4 == null) { C14957gcv.a(""); textView4 = null; } RA ra = new RA(trim, trim2, trim3, trim4, trim5, trim6, trim7, obj, obj2, obj3, textView4.getText().toString(), m()); C4160bRu c4160bRu = this.mailingAddressInputPresenter; if (c4160bRu == null) { C14957gcv.a(""); c4160bRu = null; } String str = this.h; C14957gcv.e(ra, ""); C14957gcv.e(str, ""); if (c4160bRu.f != 0) { c4160bRu.f.y(); } C15962jw c15962jw = c4160bRu.d; C4697bf c4697bf = new C4697bf(ra.g, ra.n, ra.i, ra.f, ra.b, ra.h, ra.f8335o, ra.c, ra.a, ra.e, ra.j); if ("en".equals(str)) { c4486bb = new C4486bb(c4697bf, null, 2); } else { c4486bb = new C4486bb(null, c4697bf, 1); } C5174bo c5174bo = new C5174bo(c4486bb); C4160bRu.LWm lWm = new C4160bRu.LWm(c4160bRu); C4160bRu.HBt hBt = new C4160bRu.HBt(c4160bRu); C14957gcv.e(c5174bo, ""); C14957gcv.e(lWm, ""); C14957gcv.e(hBt, ""); c15962jw.b(c15962jw.b, lWm, hBt, new UdU.IeS(c5174bo)); a(ra); } @Override // o.InterfaceC9445djq public final void f() { IeS ieS = this.d; if (ieS != null) { ieS.a(n(), k(), this.h, "INPUT_CONFIRM"); } } @Override // o.InterfaceC9445djq public final void c(C5068bm c5068bm) { String str; C4803bh c4803bh; C4803bh c4803bh2; C4803bh c4803bh3; C4803bh c4803bh4; ((Kmx) this.i.e()).e("change_mailing_address"); String str2 = null; ((Kmx) this.i.e()).d("EN_province", (c5068bm == null || (c4803bh4 = c5068bm.e) == null) ? null : c4803bh4.e); ((Kmx) this.i.e()).d("EN_postalCode", (c5068bm == null || (c4803bh3 = c5068bm.e) == null) ? null : c4803bh3.d); ((Kmx) this.i.e()).d("TH_province", (c5068bm == null || (c4803bh2 = c5068bm.c) == null) ? null : c4803bh2.e); Kmx kmx = (Kmx) this.i.e(); if (c5068bm != null && (c4803bh = c5068bm.c) != null) { str2 = c4803bh.d; } kmx.d("TH_postalCode", str2); ((Kmx) this.i.e()).d("type_of_new_address", (c5068bm == null || (str = c5068bm.d) == null || !str.equals("O")) ? "home_address" : "office_address"); Kmx kmx2 = (Kmx) this.i.e(); if (getActivity() != null) { kmx2.c(((BaseActivity) getActivity()).scbAnalytics, "change_mailing_address_new_address"); } } @OnClick public final void onConfirmButtonClick() { CustomAddressInput customAddressInput = this.houseNo; if (customAddressInput == null) { C14957gcv.a(""); customAddressInput = null; } String trim = customAddressInput.inputTextField.getText().toString().trim(); C14957gcv.c((Object) trim, ""); CustomAddressInput customAddressInput2 = this.unit; if (customAddressInput2 == null) { C14957gcv.a(""); customAddressInput2 = null; } String trim2 = customAddressInput2.inputTextField.getText().toString().trim(); C14957gcv.c((Object) trim2, ""); CustomAddressInput customAddressInput3 = this.floor; if (customAddressInput3 == null) { C14957gcv.a(""); customAddressInput3 = null; } String trim3 = customAddressInput3.inputTextField.getText().toString().trim(); C14957gcv.c((Object) trim3, ""); CustomAddressInput customAddressInput4 = this.village; if (customAddressInput4 == null) { C14957gcv.a(""); customAddressInput4 = null; } String trim4 = customAddressInput4.inputTextField.getText().toString().trim(); C14957gcv.c((Object) trim4, ""); CustomAddressInput customAddressInput5 = this.moo; if (customAddressInput5 == null) { C14957gcv.a(""); customAddressInput5 = null; } String trim5 = customAddressInput5.inputTextField.getText().toString().trim(); C14957gcv.c((Object) trim5, ""); CustomAddressInput customAddressInput6 = this.road; if (customAddressInput6 == null) { C14957gcv.a(""); customAddressInput6 = null; } String trim6 = customAddressInput6.inputTextField.getText().toString().trim(); C14957gcv.c((Object) trim6, ""); CustomAddressInput customAddressInput7 = this.alley; if (customAddressInput7 == null) { C14957gcv.a(""); customAddressInput7 = null; } String trim7 = customAddressInput7.inputTextField.getText().toString().trim(); C14957gcv.c((Object) trim7, ""); TextView textView = this.districtLabel; if (textView == null) { C14957gcv.a(""); textView = null; } String obj = textView.getText().toString(); TextView textView2 = this.subDistrictLabel; if (textView2 == null) { C14957gcv.a(""); textView2 = null; } String obj2 = textView2.getText().toString(); TextView textView3 = this.provinceLabel; if (textView3 == null) { C14957gcv.a(""); textView3 = null; } String obj3 = textView3.getText().toString(); TextView textView4 = this.postalCodeLabel; if (textView4 == null) { C14957gcv.a(""); textView4 = null; } c(new RA(trim, trim2, trim3, trim4, trim5, trim6, trim7, obj, obj2, obj3, textView4.getText().toString(), m())); C4160bRu c4160bRu = this.mailingAddressInputPresenter; if (c4160bRu == null) { C14957gcv.a(""); c4160bRu = null; } RA n = n(); C0406Fx k = k(); RA o2 = o(); String str = this.h; String str2 = this.f; C14957gcv.e(str, ""); C14957gcv.e(str2, ""); c4160bRu.e = n; c4160bRu.h = k; c4160bRu.a = str; c4160bRu.b = o2; c4160bRu.g = str2; if (C14957gcv.b((Object) str, (Object) "en")) { c4160bRu.c = c4160bRu.b(); c4160bRu.i = c4160bRu.a(); } else { c4160bRu.c = c4160bRu.a(); c4160bRu.i = c4160bRu.b(); } final C5227bp c5227bp = new C5227bp(str2, new C5068bm(c4160bRu.c, c4160bRu.i, n != null ? n.d : null)); ZI.IeS ieS = new ZI.IeS(c5227bp) { // from class: o.bRt private C5227bp e; @Override // o.ZI.IeS public final void e(Object obj4) { C4160bRu.a(this.e, (InterfaceC9445djq) obj4); } { this.e = c5227bp; } }; if (c4160bRu.f != 0) { ieS.e(c4160bRu.f); } C15962jw c15962jw = c4160bRu.d; C4160bRu.IeS ieS2 = new C4160bRu.IeS(c4160bRu); C4160bRu.RVV rvv = new C4160bRu.RVV(c4160bRu); C14957gcv.e(c5227bp, ""); C14957gcv.e(ieS2, ""); C14957gcv.e(rvv, ""); c15962jw.b(c15962jw.i, ieS2, rvv, new FcG.LWm(c5227bp)); } @Override // o.InterfaceC9445djq public final void g() { IeS ieS = this.d; if (ieS != null) { ieS.f(); } } /* loaded from: classes5.dex */ static final class RVV extends AbstractC14961gcz implements InterfaceC14890gbN { public static final RVV d = new RVV(); @Override // o.InterfaceC14890gbN public final /* synthetic */ Kmx invoke() { return new Kmx(); } RVV() { super(0); } } }