package com.scb.phone.view.fragment.easycash.issuer; import android.content.DialogInterface; import android.content.Intent; import android.os.AsyncTask; 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.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.OnClick; import com.scb.phone.R; import com.scb.phone.view.adapter.easycash.IssuerSearchAdapter; import com.scb.phone.view.custom.common.CustomInputDialog; import com.scb.phone.view.fragment.easycash.issuer.EasycashIssuerSearchFragment; import java.util.List; import o.C0639Le; import o.C6583cXR; import o.GEP; import o.InterfaceC13391fZD; import o.InterfaceC6621cYR; import o.Jel; import o.PRA; import o.YKU; import o.aWL; import o.eBM; import o.fIU; import o.gjJ; import o.xWK; /* loaded from: classes5.dex */ public class EasycashIssuerSearchFragment extends Hilt_EasycashIssuerSearchFragment implements InterfaceC6621cYR.NOK, fIU { @BindView protected Button addButton; private IssuerSearchAdapter c; @BindView protected ImageButton clearButton; private CustomInputDialog d; @BindView protected LinearLayout emptyContainer; @BindView protected EditText mSearchEdit; @BindView protected TextView notFoundInstruction; @BindView protected TextView notFoundText; @BindView protected RecyclerView recyclerView; @InterfaceC13391fZD public aWL searchPresenter; @Override // androidx.fragment.app.Fragment public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { byte b = 0; View inflate = layoutInflater.inflate(R.layout.2131560220, viewGroup, false); ButterKnife.c(this, inflate); this.searchPresenter.e((aWL) this); aWL awl = this.searchPresenter; if (awl.f != 0) { awl.f.y(); } awl.d.e(); xWK xwk = awl.d; xwk.d(xwk.i, new aWL.HBt(awl, b)); this.mSearchEdit.setText(""); this.mSearchEdit.setHint(R.string.easycash_issuer_search_hint); this.notFoundText.setText(R.string.easycash_issuer_search_no_result_found); this.addButton.setText(R.string.easycash_issuer_search_add_dialog_title); this.notFoundInstruction.setText(R.string.easycash_issuer_search_add_instruction); this.clearButton.setVisibility(8); this.mSearchEdit.addTextChangedListener(new Sts(this)); return inflate; } @Override // o.InterfaceC6621cYR.NOK public final void b(List list) { this.c = new IssuerSearchAdapter(list, this, this.searchPresenter.d.a.M()); getContext(); this.recyclerView.setLayoutManager(new LinearLayoutManager()); this.recyclerView.setAdapter(this.c); this.recyclerView.setNestedScrollingEnabled(true); this.recyclerView.setVisibility(0); } @Override // o.InterfaceC6621cYR.NOK public final void c() { this.emptyContainer.setVisibility(0); this.recyclerView.setVisibility(8); } @Override // o.fIU public final void b(int i) { List list = this.c.a; d(list != null ? list.get(i) : null); } /* loaded from: classes5.dex */ public class Sts implements TextWatcher { private HBt a; final EasycashIssuerSearchFragment b; @Override // android.text.TextWatcher public final void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override // android.text.TextWatcher public final void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { } public Sts(EasycashIssuerSearchFragment easycashIssuerSearchFragment) { this.b = easycashIssuerSearchFragment; } @Override // android.text.TextWatcher public final void afterTextChanged(Editable editable) { byte b = 0; if (editable.toString().length() > 0) { this.b.clearButton.setVisibility(0); } else { this.b.clearButton.setVisibility(8); } HBt hBt = this.a; if (hBt != null) { hBt.cancel(true); } HBt hBt2 = new HBt(this, b); this.a = hBt2; hBt2.execute(editable.toString()); } /* loaded from: classes5.dex */ class HBt extends AsyncTask> { private Sts e; private HBt(Sts sts) { this.e = sts; } @Override // android.os.AsyncTask protected final /* synthetic */ List doInBackground(String[] strArr) { String[] strArr2 = strArr; final String str = strArr2.length > 0 ? strArr2[0] : ""; aWL awl = this.e.b.searchPresenter; if (gjJ.b((CharSequence) str)) { return awl.e; } YKU yku = new YKU(awl.e); return (List) new YKU(yku.a, new GEP(yku.b, new Jel(str) { // from class: o.aWS private String b; @Override // o.Jel public final boolean e(Object obj) { return aWL.d(this.b, (C0639Le) obj); } { this.b = str; } })).a(new PRA.Sts(new PRA.AnonymousClass4(), new PRA.AnonymousClass8())); } @Override // android.os.AsyncTask protected final /* synthetic */ void onPostExecute(List list) { List list2 = list; if (list2 != null && !list2.isEmpty()) { this.e.b.emptyContainer.setVisibility(8); this.e.b.b(list2); } else { this.e.b.c(); } } /* synthetic */ HBt(Sts sts, byte b) { this(sts); } } } private void d(C0639Le c0639Le) { if (getActivity() != null) { Intent intent = new Intent(); intent.putExtra("EXTRA_RESULT_ISSUER_SEARCH", c0639Le); getActivity().setResult(-1, intent); getActivity().finish(); } } /* JADX INFO: Access modifiers changed from: package-private */ @OnClick public void onAddButtonClick() { CustomInputDialog b = CustomInputDialog.b(getContext()); this.d = b; String string = getString(R.string.easycash_issuer_search_add_dialog_title); if (string != null) { b.mTitleTextView.setVisibility(0); b.mTitleTextView.setText(string); } CustomInputDialog customInputDialog = this.d; String string2 = getString(R.string.easycash_issuer_search_add_dialog_content); if (string2 != null) { customInputDialog.mTextTextView.setVisibility(0); customInputDialog.mTextTextView.setText(string2); } this.d.mEditTextView.setHint(R.string.easycash_issuer_search_add_dialog_hint); CustomInputDialog customInputDialog2 = this.d; customInputDialog2.mEditTextView.addTextChangedListener(new TextWatcher(this) { // from class: com.scb.phone.view.fragment.easycash.issuer.EasycashIssuerSearchFragment.2 private EasycashIssuerSearchFragment 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) { } { this.b = this; } @Override // android.text.TextWatcher public final void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { if (String.valueOf(this.b.d.mEditTextView.getText()).length() >= 3 && String.valueOf(this.b.d.mEditTextView.getText()).length() <= 30) { if (C6583cXR.p(String.valueOf(this.b.d.mEditTextView.getText()))) { this.b.d.mErrorTextView.setVisibility(8); this.b.d.mPositiveButton.setEnabled(true); return; } CustomInputDialog customInputDialog3 = this.b.d; String string3 = this.b.getString(R.string.easycash_issuer_input_error_character); customInputDialog3.mErrorTextView.setVisibility(0); customInputDialog3.mErrorTextView.setText(string3); this.b.d.mPositiveButton.setEnabled(false); return; } CustomInputDialog customInputDialog4 = this.b.d; String string4 = this.b.getString(R.string.easycash_occupation_inline_error_length); customInputDialog4.mErrorTextView.setVisibility(0); customInputDialog4.mErrorTextView.setText(string4); this.b.d.mPositiveButton.setEnabled(false); } }); this.d.mEditTextView.setVisibility(0); this.d.setCanceledOnTouchOutside(false); this.d.apc_(R.string.cancel, new DialogInterface.OnClickListener() { // from class: o.eVA @Override // android.content.DialogInterface.OnClickListener public final void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }); CustomInputDialog customInputDialog3 = this.d; String string3 = getString(R.string.ok); DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener(this) { // from class: o.eVF private EasycashIssuerSearchFragment b; @Override // android.content.DialogInterface.OnClickListener public final void onClick(DialogInterface dialogInterface, int i) { EasycashIssuerSearchFragment.d(this.b); } { this.b = this; } }; if (string3 != null) { customInputDialog3.mPositiveButton.setText(string3); customInputDialog3.mPositiveButton.setOnClickListener(new eBM(customInputDialog3, onClickListener, false)); } this.d.show(); } @OnClick public void onClickClear() { this.mSearchEdit.setText(""); } @OnClick public void onClickCancel() { if (getActivity() != null) { getActivity().finish(); } } public static /* synthetic */ void d(EasycashIssuerSearchFragment easycashIssuerSearchFragment) { if (String.valueOf(easycashIssuerSearchFragment.d.mEditTextView.getText()).isEmpty()) { easycashIssuerSearchFragment.d.dismiss(); } else { String valueOf = String.valueOf(easycashIssuerSearchFragment.d.mEditTextView.getText()); easycashIssuerSearchFragment.d(new C0639Le(0, valueOf, valueOf, valueOf, valueOf)); } } }