package com.scb.phone.view.fragment.search; import android.content.Context; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.TextView; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import butterknife.BindView; import butterknife.ButterKnife; import com.scb.phone.R; import com.scb.phone.view.adapter.search.SequentialSearchAdapter; import com.scb.phone.view.custom.common.ClearableFullWidthEditText; import com.scb.phone.view.custom.common.CustomNoteEditText; import com.scb.phone.view.fragment.BaseFragment; import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import o.AbstractC14961gcz; import o.C12919fLP; import o.C14866gag; import o.C14881gav; import o.C14957gcv; import o.C16067kr; import o.C2974aoj; import o.C6000cFg; import o.EnumC1120Wa; import o.InterfaceC11835emo; import o.InterfaceC13391fZD; import o.InterfaceC14894gbR; import o.InterfaceC9572dmK; import o.PHe; import o.VX; import o.VZ; import o.ZI; import o.gdZ; /* loaded from: classes5.dex */ public final class SequentialSearchFragment extends Hilt_SequentialSearchFragment implements InterfaceC9572dmK { public static final RVV d = new RVV(0); public InterfaceC11835emo c; private SequentialSearchAdapter i; @InterfaceC13391fZD public C6000cFg presenter; @BindView public RecyclerView recyclerView; @BindView public TextView textSearchHeader; @BindView public View viewNoItem; @BindView public ClearableFullWidthEditText viewSearchBox; /* loaded from: classes5.dex */ public static final class RVV { private RVV() { } public /* synthetic */ RVV(byte b) { this(); } } @Override // androidx.fragment.app.Fragment public final void onCreate(Bundle bundle) { VX vx; super.onCreate(bundle); Bundle arguments = getArguments(); if (arguments == null || (vx = (VX) arguments.getParcelable("EXTRA_PAGE_ITEM")) == null) { return; } C6000cFg c6000cFg = this.presenter; VX vx2 = null; if (c6000cFg == null) { C14957gcv.a(""); c6000cFg = null; } Serializable serializable = arguments.getSerializable("EXTRA_SEARCH_TYPE"); C14957gcv.d(serializable, ""); EnumC1120Wa enumC1120Wa = (EnumC1120Wa) serializable; C14957gcv.c(vx, ""); String string = arguments.getString("EXTRA_VALUE", ""); C14957gcv.c((Object) string, ""); C14957gcv.e(enumC1120Wa, ""); C14957gcv.e(vx, ""); C14957gcv.e(string, ""); c6000cFg.d = enumC1120Wa; c6000cFg.b = vx; c6000cFg.c = string; if (c6000cFg.f != 0) { c6000cFg.f.y(); } C16067kr c16067kr = c6000cFg.g; C6000cFg.IeS ieS = new C6000cFg.IeS(c6000cFg); C6000cFg.Sts sts = new C6000cFg.Sts(c6000cFg); EnumC1120Wa enumC1120Wa2 = c6000cFg.d; if (enumC1120Wa2 == null) { C14957gcv.a(""); enumC1120Wa2 = null; } VX vx3 = c6000cFg.b; if (vx3 == null) { C14957gcv.a(""); } else { vx2 = vx3; } HashMap hashMap = vx2.d; if (hashMap != null) { hashMap.put("KEY_RESULT", vx2.c); } else { hashMap = new HashMap<>(); } C14957gcv.e(ieS, ""); C14957gcv.e(sts, ""); C14957gcv.e(enumC1120Wa2, ""); C14957gcv.e(hashMap, ""); c16067kr.b(c16067kr.b, ieS, sts, new PHe.Sts(enumC1120Wa2.name(), hashMap), C16067kr.HBt.e); } @Override // androidx.fragment.app.Fragment public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { C14957gcv.e(layoutInflater, ""); View inflate = layoutInflater.inflate(R.layout.2131559914, viewGroup, false); ((BaseFragment) this).a = ButterKnife.c(this, inflate); return inflate; } @Override // androidx.fragment.app.Fragment public final void onViewCreated(View view, Bundle bundle) { C14957gcv.e(view, ""); super.onViewCreated(view, bundle); C6000cFg c6000cFg = this.presenter; C6000cFg c6000cFg2 = null; if (c6000cFg == null) { C14957gcv.a(""); c6000cFg = null; } c6000cFg.e((C6000cFg) this); RecyclerView recyclerView = this.recyclerView; if (recyclerView == null) { C14957gcv.a(""); recyclerView = null; } SequentialSearchAdapter sequentialSearchAdapter = new SequentialSearchAdapter(new HBt(this)); C14957gcv.e(sequentialSearchAdapter, ""); this.i = sequentialSearchAdapter; getContext(); recyclerView.setLayoutManager(new LinearLayoutManager()); SequentialSearchAdapter sequentialSearchAdapter2 = this.i; if (sequentialSearchAdapter2 == null) { C14957gcv.a(""); sequentialSearchAdapter2 = null; } recyclerView.setAdapter(sequentialSearchAdapter2); d(); ClearableFullWidthEditText clearableFullWidthEditText = this.viewSearchBox; if (clearableFullWidthEditText == null) { C14957gcv.a(""); clearableFullWidthEditText = null; } IeS ieS = new IeS(this); C14957gcv.e(ieS, ""); CustomNoteEditText customNoteEditText = clearableFullWidthEditText.inputEditText; C14957gcv.c(customNoteEditText, ""); ieS.invoke(customNoteEditText); clearableFullWidthEditText.setEnabledEditTextIcon(true); clearableFullWidthEditText.setErrorVisible(false); clearableFullWidthEditText.inputEditText.addTextChangedListener(new LWm(this)); C6000cFg c6000cFg3 = this.presenter; if (c6000cFg3 == null) { C14957gcv.a(""); c6000cFg3 = null; } VX vx = c6000cFg3.b; if (vx == null) { C14957gcv.a(""); vx = null; } C6000cFg c6000cFg4 = this.presenter; if (c6000cFg4 == null) { C14957gcv.a(""); c6000cFg4 = null; } String str = c6000cFg4.c; if (str == null) { C14957gcv.a(""); str = null; } InterfaceC11835emo interfaceC11835emo = this.c; if (interfaceC11835emo == null) { C14957gcv.a(""); interfaceC11835emo = null; } interfaceC11835emo.e(vx.e(getContext())); TextView textView = this.textSearchHeader; if (textView == null) { C14957gcv.a(""); textView = null; } Context context = getContext(); String string = context != null ? context.getString(vx.e, str) : null; if (string == null) { string = ""; } textView.setText(string); ClearableFullWidthEditText clearableFullWidthEditText2 = this.viewSearchBox; if (clearableFullWidthEditText2 == null) { C14957gcv.a(""); clearableFullWidthEditText2 = null; } Context context2 = getContext(); String string2 = context2 != null ? context2.getString(vx.b, str) : null; if (string2 == null) { string2 = ""; } clearableFullWidthEditText2.setHint(string2); C6000cFg c6000cFg5 = this.presenter; if (c6000cFg5 != null) { c6000cFg2 = c6000cFg5; } else { C14957gcv.a(""); } c6000cFg2.b(); } /* loaded from: classes5.dex */ static final class IeS extends AbstractC14961gcz implements InterfaceC14894gbR { private SequentialSearchFragment d; @Override // o.InterfaceC14894gbR public final /* synthetic */ C14866gag invoke(EditText editText) { EditText editText2 = editText; C14957gcv.e(editText2, ""); C6000cFg c6000cFg = this.d.presenter; EnumC1120Wa enumC1120Wa = null; if (c6000cFg == null) { C14957gcv.a(""); c6000cFg = null; } EnumC1120Wa enumC1120Wa2 = c6000cFg.d; if (enumC1120Wa2 == null) { C14957gcv.a(""); } else { enumC1120Wa = enumC1120Wa2; } if (enumC1120Wa.e()) { editText2.setFilters(new C12919fLP[]{new C12919fLP("[^\\u0E01-\\u0E39\\u0E40-\\u0E4C]")}); } return C14866gag.c; } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ IeS(SequentialSearchFragment sequentialSearchFragment) { super(1); this.d = sequentialSearchFragment; } } /* loaded from: classes5.dex */ public static final class LWm implements TextWatcher { private SequentialSearchFragment b; @Override // android.text.TextWatcher public final void afterTextChanged(Editable editable) { } @Override // android.text.TextWatcher public final void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } LWm(SequentialSearchFragment sequentialSearchFragment) { this.b = sequentialSearchFragment; } @Override // android.text.TextWatcher public final void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { List list; C6000cFg c6000cFg = this.b.presenter; final List list2 = null; if (c6000cFg == null) { C14957gcv.a(""); c6000cFg = null; } String valueOf = String.valueOf(charSequence); C14957gcv.e(valueOf, ""); c6000cFg.a = valueOf; String str = c6000cFg.a; VZ vz = c6000cFg.e; if (vz != null && (list = vz.d) != null) { ArrayList arrayList = new ArrayList(); for (Object obj : list) { if (gdZ.d((CharSequence) C2974aoj.d((String) obj), (CharSequence) C2974aoj.d(str), false)) { arrayList.add(obj); } } list2 = C14881gav.d((Iterable) arrayList); } List list3 = list2; if (list3 == null || list3.isEmpty()) { ZI.IeS ieS = new ZI.IeS() { // from class: o.cFo @Override // o.ZI.IeS public final void e(Object obj2) { ((InterfaceC9572dmK) obj2).b(); } }; if (c6000cFg.f != 0) { ieS.e(c6000cFg.f); return; } return; } ZI.IeS ieS2 = new ZI.IeS(list2) { // from class: o.cFl private List d; @Override // o.ZI.IeS public final void e(Object obj2) { ((InterfaceC9572dmK) obj2).d((List) this.d); } { this.d = list2; } }; if (c6000cFg.f != 0) { ieS2.e(c6000cFg.f); } } } /* loaded from: classes5.dex */ public static final class HBt implements SequentialSearchAdapter.HBt { private SequentialSearchFragment c; HBt(SequentialSearchFragment sequentialSearchFragment) { this.c = sequentialSearchFragment; } @Override // com.scb.phone.view.adapter.search.SequentialSearchAdapter.HBt public final void e(String str) { C14957gcv.e(str, ""); C6000cFg c6000cFg = this.c.presenter; InterfaceC11835emo interfaceC11835emo = null; if (c6000cFg == null) { C14957gcv.a(""); c6000cFg = null; } VX vx = c6000cFg.b; if (vx == null) { C14957gcv.a(""); vx = null; } InterfaceC11835emo interfaceC11835emo2 = this.c.c; if (interfaceC11835emo2 != null) { interfaceC11835emo = interfaceC11835emo2; } else { C14957gcv.a(""); } interfaceC11835emo.c(vx.a, vx.c, str); } } @Override // o.InterfaceC9572dmK public final void d(List list) { C14957gcv.e(list, ""); d(); SequentialSearchAdapter sequentialSearchAdapter = this.i; if (sequentialSearchAdapter == null) { C14957gcv.a(""); sequentialSearchAdapter = null; } C14957gcv.e(list, ""); sequentialSearchAdapter.c = list; sequentialSearchAdapter.notifyDataSetChanged(); } private final void d() { RecyclerView recyclerView = this.recyclerView; View view = null; if (recyclerView == null) { C14957gcv.a(""); recyclerView = null; } recyclerView.setVisibility(0); View view2 = this.viewNoItem; if (view2 != null) { view = view2; } else { C14957gcv.a(""); } view.setVisibility(8); } @Override // o.InterfaceC9572dmK public final void b() { View view = this.viewNoItem; RecyclerView recyclerView = null; if (view == null) { C14957gcv.a(""); view = null; } view.setVisibility(0); RecyclerView recyclerView2 = this.recyclerView; if (recyclerView2 != null) { recyclerView = recyclerView2; } else { C14957gcv.a(""); } recyclerView.setVisibility(8); } /* JADX WARN: Multi-variable type inference failed */ @Override // com.scb.phone.view.fragment.search.Hilt_SequentialSearchFragment, com.scb.phone.view.fragment.Hilt_BaseFragment, androidx.fragment.app.Fragment public final void onAttach(Context context) { C14957gcv.e(context, ""); super.onAttach(context); if (context instanceof InterfaceC11835emo) { InterfaceC11835emo interfaceC11835emo = (InterfaceC11835emo) context; C14957gcv.e(interfaceC11835emo, ""); this.c = interfaceC11835emo; } } @Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment public final void onDestroyView() { C6000cFg c6000cFg = this.presenter; if (c6000cFg == null) { C14957gcv.a(""); c6000cFg = null; } c6000cFg.w_(); super.onDestroyView(); } @Override // androidx.fragment.app.Fragment public final void onDetach() { InterfaceC11835emo interfaceC11835emo = this.c; VX vx = null; if (interfaceC11835emo == null) { C14957gcv.a(""); interfaceC11835emo = null; } C6000cFg c6000cFg = this.presenter; if (c6000cFg == null) { C14957gcv.a(""); c6000cFg = null; } VX vx2 = c6000cFg.b; if (vx2 == null) { C14957gcv.a(""); } else { vx = vx2; } interfaceC11835emo.c(vx.c); super.onDetach(); } }