package com.scb.phone.view.fragment.hml; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.text.Editable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.LinearLayout; import android.widget.Spinner; import android.widget.SpinnerAdapter; import android.widget.TextView; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import com.pingan.ai.face.common.PaFaceConstants; import com.scb.phone.R; import com.scb.phone.view.activity.hml.HmlCompanyNameActivity; import com.scb.phone.view.activity.hml.HmlConsentActivity; import com.scb.phone.view.activity.hml.HmlDocumentUploadGuidelineActivity; import com.scb.phone.view.activity.hml.HmlIssuerLandingActivity; import com.scb.phone.view.activity.hml.HmlWorkAddressActivity; import com.scb.phone.view.activity.hml.frictionlessmoa.HmlMoaActivity; import com.scb.phone.view.activity.ntb.fillinformation.OccupationSearchActivity; import com.scb.phone.view.custom.common.CustomDialog; import com.scb.phone.view.custom.common.CustomPhoneNumberInput; import com.scb.phone.view.custom.common.ProgressStateBar; import com.scb.phone.view.custom.investment.onboarding.CustomSpinnerWithTitle; import com.scb.phone.view.fragment.hml.HmlOccupationInfoFragment; import java.util.Arrays; import java.util.Comparator; import java.util.List; import o.AbstractC13163fSk; import o.AbstractC13175fSw; import o.C0403Fv; import o.C1259ZbO; import o.C13369fYh; import o.C14957gcv; import o.C5451btL; import o.C6583cXR; import o.CfP; import o.ETe; import o.InterfaceC13391fZD; import o.InterfaceC9334dhl; import o.MYp; import o.OVB; import o.Qve; import o.SSH; import o.ViewOnFocusChangeListenerC10337eBX; import o.ZI; import o.fJJ; import o.fSQ; import o.fSS; import o.fUY; import o.gjJ; import o.owj; /* loaded from: classes5.dex */ public class HmlOccupationInfoFragment extends Hilt_HmlOccupationInfoFragment implements InterfaceC9334dhl { @BindView ProgressStateBar breadcrumbnsNtb; private fJJ c; @BindView TextView companyName; @BindView TextView companyNameError; @BindView TextView experienceError; @BindView TextView job; @BindView TextView jobError; @BindView CustomPhoneNumberInput mobileNumberView; @BindView CustomSpinnerWithTitle monthsSpinner; @BindView Button nextButton; @InterfaceC13391fZD public C5451btL presenter; @BindView LinearLayout root; @BindView Spinner sourceOfIncome; @BindView TextView sourceOfIncomeError; @BindView TextView workAddress; @BindView TextView workAddressError; @BindView CustomSpinnerWithTitle yearsSpinner; public static HmlOccupationInfoFragment h() { return new HmlOccupationInfoFragment(); } @Override // androidx.fragment.app.Fragment public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { View inflate = layoutInflater.inflate(R.layout.2131559708, viewGroup, false); ButterKnife.c(this, inflate); this.root.requestFocus(); this.presenter.e((C5451btL) this); C5451btL c5451btL = this.presenter; if (c5451btL.f != 0) { c5451btL.f.y(); } AbstractC13163fSk> d = c5451btL.e.d(); final C5451btL.IeS ieS = C5451btL.IeS.c; AbstractC13163fSk flatMapIterable = d.flatMapIterable(new fSS(ieS) { // from class: o.btS private InterfaceC14894gbR e; @Override // o.fSS public final Object a(Object obj) { return C5451btL.a(this.e, obj); } { this.e = ieS; } }); final C5451btL.HBt hBt = new C5451btL.HBt(c5451btL); AbstractC13163fSk map = flatMapIterable.map(new fSS(hBt) { // from class: o.btV private InterfaceC14894gbR e; @Override // o.fSS public final Object a(Object obj) { return C5451btL.e(this.e, obj); } { this.e = hBt; } }); final C5451btL.jbe jbeVar = C5451btL.jbe.b; AbstractC13175fSw list = map.sorted(new Comparator(jbeVar) { // from class: o.btR private InterfaceC14937gcb e; @Override // java.util.Comparator public final int compare(Object obj, Object obj2) { return C5451btL.a(this.e, obj, obj2); } { this.e = jbeVar; } }).toList(); final C5451btL.saX sax = new C5451btL.saX(c5451btL); C13369fYh c13369fYh = new C13369fYh(list, new fSQ(sax) { // from class: o.buc private InterfaceC14894gbR e; @Override // o.fSQ public final void c(Object obj) { C5451btL.b(this.e, obj); } { this.e = sax; } }); final C5451btL.ojQ ojq = new C5451btL.ojQ(c5451btL); fUY fuy = new fUY(c13369fYh, new fSS(ojq) { // from class: o.btI private InterfaceC14894gbR a; @Override // o.fSS public final Object a(Object obj) { return C5451btL.d(this.a, obj); } { this.a = ojq; } }); final C5451btL.tOB tob = new C5451btL.tOB(c5451btL); c5451btL.h.d(fuy.doOnNext(new fSQ(tob) { // from class: o.btK private InterfaceC14894gbR a; @Override // o.fSQ public final void c(Object obj) { C5451btL.c(this.a, obj); } { this.a = tob; } }), new C5451btL.Sts(c5451btL)); d(this.yearsSpinner, R.array.f1252130903053); d(this.monthsSpinner, R.array.f1242130903052); return inflate; } @OnClick public void onJobClick() { Intent intent = new Intent(getContext(), (Class) OccupationSearchActivity.class); intent.putExtra("SEARCH_TITLE", getString(R.string.hml_review_job_title)); startActivityForResult(intent, 1001); } @Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment public void onActivityResult(int i, int i2, Intent intent) { if (i == 1001 && i2 == -1 && intent != null) { final String stringExtra = intent.getStringExtra("EXTRA_RESULT_OCCUPATION_CODE"); final String stringExtra2 = intent.getStringExtra("EXTRA_RESULT_OCCUPATION_DESCRIPTION"); String stringExtra3 = intent.getStringExtra("EXTRA_RESULT_OCCUPATION_ISIC_CODE"); String stringExtra4 = intent.getStringExtra("EXTRA_RESULT_OCCUPATION_GROUP_CODE"); String stringExtra5 = intent.getStringExtra("EXTRA_RESULT_OCCUPATION_OCCUPATION_GROUP"); C5451btL c5451btL = this.presenter; C14957gcv.e(stringExtra3, ""); ZI.IeS ieS = new ZI.IeS(stringExtra2, stringExtra) { // from class: o.btO private String a; private String b; @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC9334dhl) obj).b(this.a, this.b); } { this.a = stringExtra2; this.b = stringExtra; } }; if (c5451btL.f != 0) { ieS.e(c5451btL.f); } c5451btL.g = stringExtra5; c5451btL.k = new CfP(stringExtra, stringExtra2, stringExtra3, stringExtra4); c5451btL.a(C5451btL.LWm.JOB, true, stringExtra == null); } else if (i == 1002 && i2 == -1 && intent != null) { C5451btL c5451btL2 = this.presenter; final String stringExtra6 = intent.getStringExtra("com.scb.phone.EXTRA_RESULT_ADDRESS"); C14957gcv.e(stringExtra6, ""); c5451btL2.d = stringExtra6; ZI.IeS ieS2 = new ZI.IeS(stringExtra6) { // from class: o.btP private String a; @Override // o.ZI.IeS public final void e(Object obj) { C5451btL.c(this.a, (InterfaceC9334dhl) obj); } { this.a = stringExtra6; } }; if (c5451btL2.f != 0) { ieS2.e(c5451btL2.f); } c5451btL2.a(C5451btL.LWm.WORK_ADDRESS, true, stringExtra6.length() == 0); } else if (i == 1003 && i2 == -1 && intent != null) { String stringExtra7 = intent.getStringExtra("EXTRA_COMPANY_NAME"); this.companyName.setText(stringExtra7); C5451btL c5451btL3 = this.presenter; String stringExtra8 = intent.getStringExtra("EXTRA_COMPANY_ID"); C14957gcv.e(stringExtra8, ""); C14957gcv.e(stringExtra7, ""); c5451btL3.b = stringExtra8; c5451btL3.c = stringExtra7; C5451btL.LWm lWm = C5451btL.LWm.COMPANY_NAME; CfP cfP = c5451btL3.k; c5451btL3.a(lWm, C5451btL.c(stringExtra7, cfP != null ? cfP.b : null), stringExtra7.length() == 0); } super.onActivityResult(i, i2, intent); } @Override // o.InterfaceC9334dhl public final void b(String str, String str2) { if (str == null || str2 == null) { return; } this.job.setText(str); } @Override // o.InterfaceC9334dhl public final void d(List list) { this.sourceOfIncome.setAdapter((SpinnerAdapter) new ArrayAdapter(getContext(), R.layout.2131559352, list)); this.sourceOfIncome.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(this, list) { // from class: com.scb.phone.view.fragment.hml.HmlOccupationInfoFragment.2 private HmlOccupationInfoFragment a; private List e; @Override // android.widget.AdapterView.OnItemSelectedListener public final void onNothingSelected(AdapterView adapterView) { } { this.a = this; this.e = list; } @Override // android.widget.AdapterView.OnItemSelectedListener public final void onItemSelected(AdapterView adapterView, View view, int i, long j) { C5451btL c5451btL = this.a.presenter; C0403Fv c0403Fv = (C0403Fv) this.e.get(i); C14957gcv.e(c0403Fv, ""); c5451btL.a = c0403Fv; c5451btL.a(C5451btL.LWm.SOURCE_OF_INCOME, true, false); } }); } @Override // o.InterfaceC9334dhl public final void a(int i) { this.sourceOfIncome.setSelection(i); } @Override // o.InterfaceC9334dhl public final void e(String str) { this.companyName.setText(str); } public void e() { if (getContext() != null) { startActivityForResult(HmlCompanyNameActivity.afC_(getContext()), PaFaceConstants.MotionType.BLINK_EYE); } } @Override // o.InterfaceC9334dhl public final void b(String str) { this.workAddress.setText(str); } public void c() { startActivityForResult(HmlWorkAddressActivity.agx_(getContext()), 1002); } @Override // o.InterfaceC9334dhl public final void c(String str) { if (str != null) { this.mobileNumberView.setText(str); } fJJ fjj = new fJJ(this) { // from class: com.scb.phone.view.fragment.hml.HmlOccupationInfoFragment.1 private HmlOccupationInfoFragment a; { this.a = this; } @Override // o.fJJ, android.text.TextWatcher public final void afterTextChanged(Editable editable) { C5451btL c5451btL = this.a.presenter; String obj = this.a.mobileNumberView.mEditText.getText().toString(); C14957gcv.e(obj, ""); String v = C6583cXR.v(obj); C5451btL.LWm lWm = C5451btL.LWm.WORK_CONTACT; C14957gcv.c((Object) v, ""); C14957gcv.e(v, ""); c5451btL.a(lWm, v == null ? false : c5451btL.m.c.matcher(v).matches(), v.length() == 0); } }; this.c = fjj; CustomPhoneNumberInput customPhoneNumberInput = this.mobileNumberView; customPhoneNumberInput.mEditText.addTextChangedListener(fjj); customPhoneNumberInput.d.add(fjj); this.mobileNumberView.setErrorText(getString(R.string.easycash_invalid_format)); this.mobileNumberView.clearFocus(); CustomPhoneNumberInput customPhoneNumberInput2 = this.mobileNumberView; customPhoneNumberInput2.mEditText.setOnFocusChangeListener(new ViewOnFocusChangeListenerC10337eBX(customPhoneNumberInput2, customPhoneNumberInput2.getOnFocusChangeListener())); } private void d(CustomSpinnerWithTitle customSpinnerWithTitle, int i) { customSpinnerWithTitle.b(); customSpinnerWithTitle.setItems(Arrays.asList(getResources().getStringArray(i)), true, false); customSpinnerWithTitle.setMandatory(true); customSpinnerWithTitle.setOnCustomSpinnerWithTitleCompletion(new CustomSpinnerWithTitle.LWm(this, customSpinnerWithTitle) { // from class: com.scb.phone.view.fragment.hml.HmlOccupationInfoFragment.4 private CustomSpinnerWithTitle c; private HmlOccupationInfoFragment e; @Override // com.scb.phone.view.custom.investment.onboarding.CustomSpinnerWithTitle.LWm public final void bn_() { } { this.e = this; this.c = customSpinnerWithTitle; } @Override // com.scb.phone.view.custom.investment.onboarding.CustomSpinnerWithTitle.LWm public final void bo_() { if (((MYp) this.c.c.e()).c.getSelectedItemPosition() > 0) { int selectedItemPosition = ((MYp) this.c.c.e()).c.getSelectedItemPosition() - 1; if (this.c.equals(this.e.yearsSpinner)) { C5451btL c5451btL = this.e.presenter; c5451btL.f8586o = Integer.valueOf(selectedItemPosition); c5451btL.a(C5451btL.LWm.EXPERIENCE, true, c5451btL.f8586o == null || c5451btL.l == null); } else { C5451btL c5451btL2 = this.e.presenter; c5451btL2.l = Integer.valueOf(selectedItemPosition); c5451btL2.a(C5451btL.LWm.EXPERIENCE, true, c5451btL2.f8586o == null || c5451btL2.l == null); } } } }); } @Override // o.InterfaceC9334dhl public final void b(Integer num) { if (num != null) { this.yearsSpinner.setSelectionIndex(num.intValue() + 1); } } @Override // o.InterfaceC9334dhl public final void e(Integer num) { if (num != null) { this.monthsSpinner.setSelectionIndex(num.intValue() + 1); } } @OnClick public void onNextButtonClick() { String str; C5451btL c5451btL = this.presenter; String obj = this.mobileNumberView.mEditText.getText().toString(); C14957gcv.e(obj, ""); if (c5451btL.f != 0) { c5451btL.f.y(); } CfP cfP = c5451btL.k; boolean z = ((cfP != null ? cfP.c : null) == null || cfP.a == null) ? false : true; String str2 = c5451btL.c; CfP cfP2 = c5451btL.k; boolean c = C5451btL.c(str2, cfP2 != null ? cfP2.b : null); String v = C6583cXR.v(obj); c5451btL.a(C5451btL.LWm.JOB, z, (cfP != null ? cfP.a : null) == null || cfP.c == null); C5451btL.LWm lWm = C5451btL.LWm.SOURCE_OF_INCOME; C0403Fv c0403Fv = c5451btL.a; String str3 = c0403Fv != null ? c0403Fv.a : null; c5451btL.a(lWm, true, str3 == null || str3.length() == 0); C5451btL.LWm lWm2 = C5451btL.LWm.COMPANY_NAME; CfP cfP3 = c5451btL.k; String str4 = cfP3 != null ? cfP3.b : null; c5451btL.a(lWm2, c, str4 == null || str4.length() == 0); C5451btL.LWm lWm3 = C5451btL.LWm.WORK_ADDRESS; String str5 = c5451btL.d; boolean z2 = str5 == null || str5.length() == 0; String str6 = c5451btL.d; c5451btL.a(lWm3, !z2, str6 == null || str6.length() == 0); C5451btL.LWm lWm4 = C5451btL.LWm.WORK_CONTACT; C14957gcv.c((Object) v, ""); C14957gcv.e(v, ""); String str7 = v; c5451btL.a(lWm4, v == null ? false : c5451btL.m.c.matcher(v).matches(), str7.length() == 0); C5451btL.LWm lWm5 = C5451btL.LWm.EXPERIENCE; Integer num = c5451btL.l; c5451btL.a(lWm5, (num == null || c5451btL.f8586o == null) ? false : true, num == null || c5451btL.f8586o == null); if (z && c && (str = c5451btL.d) != null && str.length() != 0 && str7.length() != 0) { C14957gcv.e(v, ""); SSH ssh = c5451btL.m; if (v != null && ssh.c.matcher(v).matches() && c5451btL.f8586o != null && c5451btL.l != null) { owj owjVar = c5451btL.i; C0403Fv c0403Fv2 = c5451btL.a; owjVar.e(cfP, new Qve(c0403Fv2 != null ? c0403Fv2.c : null), c5451btL.b, c5451btL.c, v, c5451btL.g, new ETe(c5451btL.f8586o, c5451btL.l)); owj owjVar2 = c5451btL.i; owjVar2.d(owjVar2.i, new C5451btL.RVV(c5451btL)); return; } } if (c5451btL.f != 0) { c5451btL.f.ar_(); } } public void d() { startActivity(HmlDocumentUploadGuidelineActivity.afL_(requireContext())); } public void a() { startActivity(HmlConsentActivity.afE_(requireContext(), OVB.NCB_CONSENT)); } @Override // o.InterfaceC9334dhl public final void j() { HmlMoaActivity.IeS ieS = HmlMoaActivity.k; Context requireContext = requireContext(); C14957gcv.e(requireContext, ""); startActivity(new Intent(requireContext, (Class) HmlMoaActivity.class)); } @Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment public void onDestroy() { CustomPhoneNumberInput customPhoneNumberInput = this.mobileNumberView; fJJ fjj = this.c; customPhoneNumberInput.mEditText.removeTextChangedListener(fjj); customPhoneNumberInput.d.remove(fjj); this.presenter.w_(); super.onDestroy(); } @Override // o.InterfaceC9334dhl public final void g() { CustomDialog b = CustomDialog.b(getContext()); String string = getString(R.string.hml_occupation_back_dialog_title); if (gjJ.a(string)) { b.mTitleTextView.setVisibility(0); b.mTitleTextView.setText(string); } String string2 = getString(R.string.hml_occupation_back_dialog_text); if (gjJ.a(string2)) { b.mTextTextView.setVisibility(0); b.mTextTextView.setText(string2); } b.aoU_(getString(R.string.hml_occupation_back_dialog_confirm), new DialogInterface.OnClickListener(this) { // from class: o.fdm private HmlOccupationInfoFragment a; @Override // android.content.DialogInterface.OnClickListener public final void onClick(DialogInterface dialogInterface, int i) { HmlOccupationInfoFragment.b(this.a); } { this.a = this; } }).aoO_(getString(R.string.hml_occupation_back_dialog_cancel), new DialogInterface.OnClickListener() { // from class: o.fdl @Override // android.content.DialogInterface.OnClickListener public final void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }).show(); } /* renamed from: com.scb.phone.view.fragment.hml.HmlOccupationInfoFragment$3, reason: invalid class name */ /* loaded from: classes5.dex */ static /* synthetic */ class AnonymousClass3 { static final int[] a; static { int[] iArr = new int[C5451btL.LWm.values().length]; a = iArr; try { iArr[C5451btL.LWm.JOB.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { a[C5451btL.LWm.SOURCE_OF_INCOME.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { a[C5451btL.LWm.WORK_CONTACT.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } try { a[C5451btL.LWm.WORK_ADDRESS.ordinal()] = 4; } catch (NoSuchFieldError unused4) { } try { a[C5451btL.LWm.COMPANY_NAME.ordinal()] = 5; } catch (NoSuchFieldError unused5) { } try { a[C5451btL.LWm.EXPERIENCE.ordinal()] = 6; } catch (NoSuchFieldError unused6) { } } } @Override // o.InterfaceC9334dhl public final void e(C5451btL.LWm lWm) { switch (AnonymousClass3.a[lWm.ordinal()]) { case 1: this.jobError.setVisibility(0); return; case 2: this.sourceOfIncomeError.setText(getString(R.string.hml_occupation_source_of_income_error)); this.sourceOfIncome.setVisibility(0); return; case 3: this.mobileNumberView.setErrorText(getString(R.string.hml_occupation_work_contact_error)); this.mobileNumberView.c(); return; case 4: this.workAddressError.setText(getString(R.string.hml_occupation_work_address_error)); this.workAddressError.setVisibility(0); return; case 5: this.companyNameError.setText(getString(R.string.hml_occupation_incomplete)); this.companyNameError.setVisibility(0); return; case 6: this.experienceError.setVisibility(0); return; default: return; } } @Override // o.InterfaceC9334dhl public final void a(C5451btL.LWm lWm) { int i = AnonymousClass3.a[lWm.ordinal()]; if (i == 3) { this.mobileNumberView.setErrorText(getString(R.string.hml_occupation_invalid_format)); this.mobileNumberView.c(); } else if (i == 5) { this.companyNameError.setText(getString(R.string.hml_occupation_company_error)); this.companyNameError.setVisibility(0); } } @Override // o.InterfaceC9334dhl public final void b(C5451btL.LWm lWm) { switch (AnonymousClass3.a[lWm.ordinal()]) { case 1: this.jobError.setVisibility(8); return; case 2: this.sourceOfIncomeError.setVisibility(8); return; case 3: this.mobileNumberView.e(); return; case 4: this.workAddressError.setVisibility(8); return; case 5: this.companyNameError.setVisibility(8); return; case 6: this.experienceError.setVisibility(8); return; default: return; } } @Override // o.InterfaceC9334dhl public final void b() { if (getActivity() != null) { getActivity().finish(); } } @Override // o.InterfaceC9334dhl public final void f() { if (getContext() != null) { HmlIssuerLandingActivity.LWm lWm = HmlIssuerLandingActivity.f7283o; startActivity(new Intent(getContext(), (Class) HmlIssuerLandingActivity.class)); } } public static /* synthetic */ void b(HmlOccupationInfoFragment hmlOccupationInfoFragment) { C5451btL c5451btL = hmlOccupationInfoFragment.presenter; ZI.IeS ieS = new ZI.IeS() { // from class: o.btM @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC9334dhl) obj).b(); } }; if (c5451btL.f != 0) { ieS.e(c5451btL.f); } } @OnClick public void onCompanyNameClick() { C5451btL c5451btL = this.presenter; ZI.IeS ieS = new ZI.IeS() { // from class: o.btJ @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC9334dhl) obj).e(); } }; if (c5451btL.f != 0) { ieS.e(c5451btL.f); } } @OnClick public void onWorkAddressClick() { C5451btL c5451btL = this.presenter; ZI.IeS ieS = new ZI.IeS() { // from class: o.btU @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC9334dhl) obj).c(); } }; if (c5451btL.f != 0) { ieS.e(c5451btL.f); } } }