package com.scb.phone.view.fragment.hml; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; import android.text.InputFilter; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.TextView; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; import com.scb.phone.R; import com.scb.phone.view.custom.common.CustomInputDialog; import com.scb.phone.view.custom.common.DefaultButton; import com.scb.phone.view.fragment.BaseFragment; import com.scb.phone.view.fragment.hml.HmlCompanyNameFragment; import java.util.ArrayList; import java.util.List; import o.AbstractC14961gcz; import o.C12227euI; import o.C12919fLP; import o.C14866gag; import o.C14957gcv; import o.C5264bpk; import o.C6583cXR; import o.InterfaceC0727Nd; import o.InterfaceC13391fZD; import o.InterfaceC14890gbN; import o.InterfaceC14894gbR; import o.InterfaceC9261dgR; import o.MQ; import o.ZI; import o.bTI; import o.eBM; import o.fHS; import o.fLO; import org.bouncycastle.crypto.tls.CipherSuite; /* loaded from: classes5.dex */ public final class HmlCompanyNameFragment extends Hilt_HmlCompanyNameFragment implements InterfaceC9261dgR { public static final RVV c = new RVV(0); @BindView public Button addButton; @BindView public ImageButton clearButton; private C12227euI d = new C12227euI(new LWm(this), new HBt(this)); @BindView public LinearLayout emptyContainer; private boolean f; private Unbinder h; private CustomInputDialog j; @BindView public EditText mSearchEdit; @BindView public TextView notFoundInstruction; @InterfaceC13391fZD public C5264bpk presenter; @BindView public RecyclerView recyclerView; @BindView public DefaultButton searchButton; @BindView public TextView tvInfo; /* loaded from: classes5.dex */ static final class LWm extends AbstractC14961gcz implements InterfaceC14894gbR { private HmlCompanyNameFragment c; @Override // o.InterfaceC14894gbR public final /* synthetic */ C14866gag invoke(MQ mq) { final MQ mq2 = mq; C14957gcv.e(mq2, ""); C5264bpk c5264bpk = this.c.presenter; if (c5264bpk == null) { C14957gcv.a(""); c5264bpk = null; } C14957gcv.e(mq2, ""); ZI.IeS ieS = new ZI.IeS(mq2) { // from class: o.bpr private MQ b; @Override // o.ZI.IeS public final void e(Object obj) { C5264bpk.c(this.b, (InterfaceC9261dgR) obj); } { this.b = mq2; } }; if (c5264bpk.f != 0) { ieS.e(c5264bpk.f); } return C14866gag.c; } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ LWm(HmlCompanyNameFragment hmlCompanyNameFragment) { super(1); this.c = hmlCompanyNameFragment; } } /* loaded from: classes5.dex */ static final class HBt extends AbstractC14961gcz implements InterfaceC14890gbN { private HmlCompanyNameFragment b; @Override // o.InterfaceC14890gbN public final /* synthetic */ C14866gag invoke() { String str; Dialog dialog = ((BaseFragment) this.b).e; if (dialog == null || !dialog.isShowing()) { C5264bpk c5264bpk = this.b.presenter; if (c5264bpk == null) { C14957gcv.a(""); c5264bpk = null; } if (!c5264bpk.b && (str = c5264bpk.d) != null) { c5264bpk.b(str, false); } } return C14866gag.c; } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ HBt(HmlCompanyNameFragment hmlCompanyNameFragment) { super(0); this.b = hmlCompanyNameFragment; } } /* loaded from: classes5.dex */ public static final class RVV { private RVV() { } public /* synthetic */ RVV(byte b) { this(); } } @Override // androidx.fragment.app.Fragment public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { C14957gcv.e(layoutInflater, ""); View inflate = layoutInflater.inflate(R.layout.2131558886, viewGroup, false); this.h = ButterKnife.c(this, inflate); C5264bpk c5264bpk = this.presenter; if (c5264bpk == null) { C14957gcv.a(""); c5264bpk = null; } c5264bpk.e((C5264bpk) this); C5264bpk c5264bpk2 = this.presenter; if (c5264bpk2 == null) { C14957gcv.a(""); c5264bpk2 = null; } ZI.IeS ieS = new ZI.IeS() { // from class: o.bpn @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC9261dgR) obj).a(false); } }; if (c5264bpk2.f != 0) { ieS.e(c5264bpk2.f); } final bTI f = c5264bpk2.a.a.f(); ZI.IeS ieS2 = new ZI.IeS(f) { // from class: o.bpq private bTI b; @Override // o.ZI.IeS public final void e(Object obj) { C5264bpk.b(this.b, (InterfaceC9261dgR) obj); } { this.b = f; } }; if (c5264bpk2.f != 0) { ieS2.e(c5264bpk2.f); } if (f == bTI.BUSINESS_OWNER) { c5264bpk2.b((String) null, true); } return inflate; } @Override // o.InterfaceC9261dgR public final void e(MQ mq) { C14957gcv.e(mq, ""); Bundle bundle = new Bundle(); bundle.putString("EXTRA_COMPANY_NAME", mq.a); bundle.putString("EXTRA_COMPANY_ID", mq.b); if (getActivity() instanceof fHS) { ((fHS) getActivity()).ayB_(bundle); } } @Override // o.InterfaceC9261dgR public final void a(boolean z) { DefaultButton defaultButton = this.searchButton; if (defaultButton == null) { C14957gcv.a(""); defaultButton = null; } defaultButton.setButtonEnabled(z); } @Override // o.InterfaceC9261dgR public final void a(bTI bti) { C14957gcv.e(bti, ""); RecyclerView recyclerView = null; if (bti == bTI.BUSINESS_OWNER) { u(getString(R.string.hml_business_company_search_activity_title)); EditText editText = this.mSearchEdit; if (editText == null) { C14957gcv.a(""); editText = null; } editText.setHint(getString(R.string.hml_business_company_search_input_hint)); TextView textView = this.notFoundInstruction; if (textView == null) { C14957gcv.a(""); textView = null; } textView.setText(getString(R.string.hml_business_company_search_no_results_text)); } else { EditText editText2 = this.mSearchEdit; if (editText2 == null) { C14957gcv.a(""); editText2 = null; } editText2.setHint(getString(R.string.hml_company_search_input_hint)); } EditText editText3 = this.mSearchEdit; if (editText3 == null) { C14957gcv.a(""); editText3 = null; } editText3.setFilters(new InputFilter[]{new InputFilter.LengthFilter(CipherSuite.TLS_RSA_WITH_SEED_CBC_SHA), new C12919fLP("^[0-9\\u0E01-\\u0E39\\u0E40-\\u0E4Ca-zA-Z_\"&*()@, ./\\-]+( [0-9\\u0E01-\\u0E39\\u0E40-\\u0E4Ca-zA-Z_\"&() *@,./\\-]+)?$")}); RecyclerView recyclerView2 = this.recyclerView; if (recyclerView2 == null) { C14957gcv.a(""); recyclerView2 = null; } getContext(); recyclerView2.setLayoutManager(new LinearLayoutManager(1, false)); RecyclerView recyclerView3 = this.recyclerView; if (recyclerView3 == null) { C14957gcv.a(""); recyclerView3 = null; } recyclerView3.setAdapter(this.d); DefaultButton defaultButton = this.searchButton; if (defaultButton == null) { C14957gcv.a(""); defaultButton = null; } defaultButton.setText(getString(R.string.hml_company_search_button)); DefaultButton defaultButton2 = this.searchButton; if (defaultButton2 == null) { C14957gcv.a(""); defaultButton2 = null; } defaultButton2.setButtonEnabled(false); DefaultButton defaultButton3 = this.searchButton; if (defaultButton3 == null) { C14957gcv.a(""); defaultButton3 = null; } defaultButton3.setOnClickListener(new View.OnClickListener(this) { // from class: o.fbi private HmlCompanyNameFragment b; @Override // android.view.View.OnClickListener public final void onClick(View view) { HmlCompanyNameFragment.c(this.b); } { this.b = this; } }); EditText editText4 = this.mSearchEdit; if (editText4 == null) { C14957gcv.a(""); editText4 = null; } editText4.addTextChangedListener(new fLO(new IeS(this))); editText4.setOnEditorActionListener(new TextView.OnEditorActionListener(this) { // from class: o.fbg private HmlCompanyNameFragment b; @Override // android.widget.TextView.OnEditorActionListener public final boolean onEditorAction(TextView textView2, int i, KeyEvent keyEvent) { return HmlCompanyNameFragment.c(this.b, i); } { this.b = this; } }); Button button = this.addButton; if (button == null) { C14957gcv.a(""); button = null; } button.setOnClickListener(new View.OnClickListener(this) { // from class: o.fbh private HmlCompanyNameFragment c; @Override // android.view.View.OnClickListener public final void onClick(View view) { HmlCompanyNameFragment.e(this.c); } { this.c = this; } }); ImageButton imageButton = this.clearButton; if (imageButton == null) { C14957gcv.a(""); imageButton = null; } imageButton.setOnClickListener(new View.OnClickListener(this) { // from class: o.fbj private HmlCompanyNameFragment b; @Override // android.view.View.OnClickListener public final void onClick(View view) { HmlCompanyNameFragment.d(this.b); } { this.b = this; } }); RecyclerView recyclerView4 = this.recyclerView; if (recyclerView4 != null) { recyclerView = recyclerView4; } else { C14957gcv.a(""); } Sts sts = new Sts(this); if (recyclerView.S == null) { recyclerView.S = new ArrayList(); } recyclerView.S.add(sts); } /* loaded from: classes5.dex */ static final class IeS extends AbstractC14961gcz implements InterfaceC14894gbR { private HmlCompanyNameFragment c; @Override // o.InterfaceC14894gbR public final /* synthetic */ C14866gag invoke(String str) { final String str2 = str; C14957gcv.e(str2, ""); final C5264bpk c5264bpk = this.c.presenter; if (c5264bpk == null) { C14957gcv.a(""); c5264bpk = null; } C14957gcv.e(str2, ""); c5264bpk.c = str2; c5264bpk.e = str2.length() >= 3; ZI.IeS ieS = new ZI.IeS(c5264bpk, str2) { // from class: o.bps private String c; private C5264bpk e; @Override // o.ZI.IeS public final void e(Object obj) { C5264bpk.b(this.e, this.c, (InterfaceC9261dgR) obj); } { this.e = c5264bpk; this.c = str2; } }; if (c5264bpk.f != 0) { ieS.e(c5264bpk.f); } return C14866gag.c; } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ IeS(HmlCompanyNameFragment hmlCompanyNameFragment) { super(1); this.c = hmlCompanyNameFragment; } } /* loaded from: classes5.dex */ public static final class Sts extends RecyclerView.dAO { private HmlCompanyNameFragment b; Sts(HmlCompanyNameFragment hmlCompanyNameFragment) { this.b = hmlCompanyNameFragment; } @Override // androidx.recyclerview.widget.RecyclerView.dAO public final void onScrollStateChanged(RecyclerView recyclerView, int i) { String str; C14957gcv.e(recyclerView, ""); super.onScrollStateChanged(recyclerView, i); if (recyclerView.canScrollVertically(1)) { return; } if (!this.b.f) { C5264bpk c5264bpk = this.b.presenter; if (c5264bpk == null) { C14957gcv.a(""); c5264bpk = null; } if (c5264bpk.b && (str = c5264bpk.d) != null) { c5264bpk.b(str, false); } } HmlCompanyNameFragment hmlCompanyNameFragment = this.b; hmlCompanyNameFragment.f = true ^ hmlCompanyNameFragment.f; } } @Override // o.InterfaceC9261dgR public final void c() { EditText editText = this.mSearchEdit; if (editText == null) { C14957gcv.a(""); editText = null; } editText.setText(""); } @Override // o.InterfaceC9261dgR public final void e(List list) { C14957gcv.e(list, ""); TextView textView = this.tvInfo; if (textView == null) { C14957gcv.a(""); textView = null; } textView.setVisibility(8); C12227euI c12227euI = this.d; C14957gcv.e(list, ""); c12227euI.d = list; c12227euI.notifyDataSetChanged(); } @Override // o.InterfaceC9261dgR public final void c(bTI bti) { C14957gcv.e(bti, ""); final CustomInputDialog b = CustomInputDialog.b(getContext()); String string = getString(bti == bTI.BUSINESS_OWNER ? R.string.hml_business_company_search_add_dialog_title : R.string.hml_company_search_add_dialog_title); if (string != null) { b.mTitleTextView.setVisibility(0); b.mTitleTextView.setText(string); } String string2 = getString(bti == bTI.BUSINESS_OWNER ? R.string.hml_business_company_search_add_dialog_label : R.string.hml_company_search_add_dialog_label); if (string2 != null) { b.mTextTextView.setVisibility(0); b.mTextTextView.setText(string2); } b.mEditTextView.setHint(getString(bti == bTI.BUSINESS_OWNER ? R.string.hml_business_company_search_add_dialog_hint : R.string.hml_company_search_add_dialog_hint)); b.mEditTextView.setFilters(new InputFilter[]{new InputFilter.LengthFilter(CipherSuite.TLS_RSA_WITH_SEED_CBC_SHA)}); b.mEditTextView.setVisibility(0); b.mPositiveButton.setEnabled(true); b.setCanceledOnTouchOutside(false); b.apc_(R.string.hml_company_search_add_dialog_cancel, new DialogInterface.OnClickListener() { // from class: o.fbk @Override // android.content.DialogInterface.OnClickListener public final void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }); String string3 = getString(R.string.hml_company_search_add_dialog_ok); DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener(b, this) { // from class: o.fbp private HmlCompanyNameFragment b; private CustomInputDialog d; @Override // android.content.DialogInterface.OnClickListener public final void onClick(DialogInterface dialogInterface, int i) { HmlCompanyNameFragment.d(this.d, this.b); } { this.d = b; this.b = this; } }; if (string3 != null) { b.mPositiveButton.setText(string3); b.mPositiveButton.setOnClickListener(new eBM(b, onClickListener, false)); } b.show(); this.j = b; } @Override // o.InterfaceC9261dgR public final void c(boolean z) { ImageButton imageButton = this.clearButton; if (imageButton == null) { C14957gcv.a(""); imageButton = null; } imageButton.setVisibility(z ? 0 : 8); } @Override // o.InterfaceC9261dgR public final void b(boolean z) { TextView textView = this.tvInfo; LinearLayout linearLayout = null; if (textView == null) { C14957gcv.a(""); textView = null; } textView.setVisibility(8); RecyclerView recyclerView = this.recyclerView; if (recyclerView == null) { C14957gcv.a(""); recyclerView = null; } recyclerView.setVisibility(z ? 8 : 0); LinearLayout linearLayout2 = this.emptyContainer; if (linearLayout2 != null) { linearLayout = linearLayout2; } else { C14957gcv.a(""); } linearLayout.setVisibility(z ? 0 : 8); } @Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment public final void onDestroyView() { Unbinder unbinder = ((BaseFragment) this).a; if (unbinder != null) { unbinder.a(); } super.onDestroyView(); } public static /* synthetic */ void d(HmlCompanyNameFragment hmlCompanyNameFragment) { C14957gcv.e(hmlCompanyNameFragment, ""); C5264bpk c5264bpk = hmlCompanyNameFragment.presenter; if (c5264bpk == null) { C14957gcv.a(""); c5264bpk = null; } ZI.IeS ieS = new ZI.IeS() { // from class: o.bpp @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC9261dgR) obj).c(); } }; if (c5264bpk.f != 0) { ieS.e(c5264bpk.f); } } public static /* synthetic */ void e(HmlCompanyNameFragment hmlCompanyNameFragment) { C14957gcv.e(hmlCompanyNameFragment, ""); final C5264bpk c5264bpk = hmlCompanyNameFragment.presenter; if (c5264bpk == null) { C14957gcv.a(""); c5264bpk = null; } ZI.IeS ieS = new ZI.IeS(c5264bpk) { // from class: o.bpm private C5264bpk e; @Override // o.ZI.IeS public final void e(Object obj) { C5264bpk.e(this.e, (InterfaceC9261dgR) obj); } { this.e = c5264bpk; } }; if (c5264bpk.f != 0) { ieS.e(c5264bpk.f); } } public static /* synthetic */ void d(CustomInputDialog customInputDialog, HmlCompanyNameFragment hmlCompanyNameFragment) { C14957gcv.e(hmlCompanyNameFragment, ""); String valueOf = String.valueOf(customInputDialog.mEditTextView.getText()); C14957gcv.c((Object) valueOf, ""); if (valueOf.length() == 0) { customInputDialog.dismiss(); return; } if (!((Boolean) C6583cXR.c(new Object[]{String.valueOf(customInputDialog.mEditTextView.getText())}, 1038494101, -1038494091, (int) System.currentTimeMillis())).booleanValue()) { String string = hmlCompanyNameFragment.getString(R.string.hml_company_search_add_dialog_error); customInputDialog.mErrorTextView.setVisibility(0); customInputDialog.mErrorTextView.setText(string); return; } customInputDialog.mErrorTextView.setVisibility(8); C5264bpk c5264bpk = hmlCompanyNameFragment.presenter; if (c5264bpk == null) { C14957gcv.a(""); c5264bpk = null; } final String valueOf2 = String.valueOf(customInputDialog.mEditTextView.getText()); C14957gcv.c((Object) valueOf2, ""); C14957gcv.e(valueOf2, ""); ZI.IeS ieS = new ZI.IeS(valueOf2) { // from class: o.bpv private String b; @Override // o.ZI.IeS public final void e(Object obj) { C5264bpk.e(this.b, (InterfaceC9261dgR) obj); } { this.b = valueOf2; } }; if (c5264bpk.f != 0) { ieS.e(c5264bpk.f); } } public static /* synthetic */ boolean c(HmlCompanyNameFragment hmlCompanyNameFragment, int i) { C14957gcv.e(hmlCompanyNameFragment, ""); if (i != 3) { return false; } C5264bpk c5264bpk = hmlCompanyNameFragment.presenter; if (c5264bpk == null) { C14957gcv.a(""); c5264bpk = null; } if (!c5264bpk.e) { return true; } String str = c5264bpk.c; c5264bpk.d = str; if (str == null) { return true; } c5264bpk.b(str, true); return true; } public static /* synthetic */ void c(HmlCompanyNameFragment hmlCompanyNameFragment) { C14957gcv.e(hmlCompanyNameFragment, ""); C5264bpk c5264bpk = hmlCompanyNameFragment.presenter; if (c5264bpk == null) { C14957gcv.a(""); c5264bpk = null; } if (c5264bpk.e) { String str = c5264bpk.c; c5264bpk.d = str; if (str != null) { c5264bpk.b(str, true); } } } }