package com.scb.phone.view.fragment.requesttopay; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.SpinnerAdapter; import android.widget.TextView; import androidx.core.widget.NestedScrollView; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import butterknife.BindView; import butterknife.ButterKnife; import com.huawei.hms.support.api.entity.auth.AuthCode; import com.scb.phone.R; import com.scb.phone.view.activity.requesttopay.SummaryDetailActivity; import com.scb.phone.view.adapter.requesttopay.IncomingAdapter; import com.scb.phone.view.fragment.requesttopay.IncomingFragment; import java.util.ArrayList; import java.util.List; import o.BB; import o.C0693Mj; import o.C10461eEv; import o.C10732eN; import o.C1168Xb; import o.C1189Xo; import o.C16157lj; import o.C5966cEj; import o.HjH; import o.InterfaceC13391fZD; import o.InterfaceC8929daC; import o.VF; import o.VL; import o.irv; import o.kVY; /* loaded from: classes5.dex */ public class IncomingFragment extends Hilt_IncomingFragment implements InterfaceC8929daC.RVV, IncomingAdapter.IeS { @BindView TextView emptyIncomingTextView; private IncomingAdapter h; private String i; @InterfaceC13391fZD public C5966cEj incomingPresenter; @BindView RecyclerView incomingRecyclerView; public static IncomingFragment d(String str) { IncomingFragment incomingFragment = new IncomingFragment(); Bundle bundle = new Bundle(); bundle.putString("source", str); incomingFragment.setArguments(bundle); return incomingFragment; } @Override // androidx.fragment.app.Fragment public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { View inflate = layoutInflater.inflate(R.layout.2131559875, viewGroup, false); ButterKnife.c(this, inflate); this.i = Q(); this.h = new IncomingAdapter(this); this.incomingPresenter.e((C5966cEj) this); C5966cEj c5966cEj = this.incomingPresenter; c5966cEj.e.a(); HjH hjH = c5966cEj.e; hjH.d(hjH.i, new C5966cEj.HBt(c5966cEj, (byte) 0)); NestedScrollView nestedScrollView = this.scrollView; if (nestedScrollView != null) { nestedScrollView.setOnScrollChangeListener(new C10461eEv(this)); } this.toolbarProxy.a(R.menu.2131689479); ((BaseRequestToPayFragment) this).c = this.toolbarProxy.jO_().findItem(R.id.menu_proxy_filter); return inflate; } @Override // androidx.fragment.app.Fragment public void setMenuVisibility(boolean z) { super.setMenuVisibility(z); if (!z || this.incomingPresenter == null) { return; } this.customSpinner.setSelection(0); } @Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment public void onDestroyView() { this.incomingPresenter.w_(); RecyclerView recyclerView = this.incomingRecyclerView; if (recyclerView != null) { recyclerView.setItemAnimator(null); this.incomingRecyclerView.setAdapter(null); this.incomingRecyclerView = null; } super.onDestroyView(); } @Override // o.InterfaceC8929daC.RVV public final void c(List list) { if (!list.isEmpty()) { this.toolbarProxy.setVisibility(8); this.newAliasLayout.setVisibility(0); ArrayList arrayList = new ArrayList(); ArrayList arrayList2 = new ArrayList(); arrayList.add(new C10732eN(getString(R.string.request_money_all_alias), "ALL")); arrayList.addAll(a(list)); arrayList2.addAll(d(list)); if (this.f == null) { this.f = new ArrayAdapter(this, getActivity(), arrayList) { // from class: com.scb.phone.view.fragment.requesttopay.IncomingFragment.2 private IncomingFragment d; { this.d = this; } @Override // android.widget.ArrayAdapter, android.widget.Adapter public final View getView(int i, View view, ViewGroup viewGroup) { View view2 = super.getView(i, view, viewGroup); ((TextView) view2).setGravity(5); return view2; } }; this.customSpinner.setAdapter((SpinnerAdapter) this.f); try { this.customSpinner.setSelection(1); } catch (Exception unused) { } this.customSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(this, arrayList, arrayList2) { // from class: com.scb.phone.view.fragment.requesttopay.IncomingFragment.4 private IncomingFragment b; private ArrayList c; private ArrayList d; @Override // android.widget.AdapterView.OnItemSelectedListener public final void onNothingSelected(AdapterView adapterView) { } { this.b = this; this.c = arrayList; this.d = arrayList2; } @Override // android.widget.AdapterView.OnItemSelectedListener public final void onItemSelected(AdapterView adapterView, View view, int i, long j) { if (TextUtils.equals(((C10732eN) this.c.get(i)).c, "ALL")) { ((BaseRequestToPayFragment) this.b).d = this.d; } else { ((BaseRequestToPayFragment) this.b).d = IncomingFragment.e((C10732eN) this.d.get(i - 1)); } this.b.incomingRecyclerView.setAdapter(null); IncomingAdapter incomingAdapter = this.b.h; if (incomingAdapter.a) { incomingAdapter.a = false; } this.b.incomingPresenter.a(); IncomingFragment incomingFragment = this.b; incomingFragment.e(((BaseRequestToPayFragment) incomingFragment).d); } }); } } else { new irv(getContext(), this.toolbarProxy.findViewById(R.id.menu_proxy_filter)).c.clear(); } ((BaseRequestToPayFragment) this).c.setTitle(getString(R.string.request_money_selecting_proxy_title)); this.proxyIdTextView.setTag(null); this.container.setVisibility(8); } @Override // o.InterfaceC8929daC.RVV public final void e(boolean z, List list, int i) { if (list == null) { IncomingAdapter incomingAdapter = this.h; if (incomingAdapter.a) { incomingAdapter.a = false; } } else if (list.isEmpty() || i == 0) { this.emptyIncomingTextView.setVisibility(0); this.container.setVisibility(8); } else { getContext(); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(1, false); if (z) { IncomingAdapter incomingAdapter2 = this.h; incomingAdapter2.e = list; incomingAdapter2.notifyDataSetChanged(); } else { IncomingAdapter incomingAdapter3 = this.h; incomingAdapter3.e.addAll(list); incomingAdapter3.notifyDataSetChanged(); } this.incomingRecyclerView.setLayoutManager(linearLayoutManager); this.incomingRecyclerView.setNestedScrollingEnabled(false); this.incomingRecyclerView.setAdapter(this.h); IncomingAdapter incomingAdapter4 = this.h; if (incomingAdapter4.a) { incomingAdapter4.a = false; } this.emptyIncomingTextView.setVisibility(8); this.container.setVisibility(0); } this.selectionProxyTextView.setVisibility(8); } @Override // o.InterfaceC8929daC.RVV public final void b(C0693Mj c0693Mj) { this.emptyIncomingTextView.setVisibility(0); this.emptyIncomingTextView.setText(c0693Mj.c); this.container.setVisibility(8); this.incomingRecyclerView.setAdapter(null); this.selectionProxyTextView.setVisibility(8); } @Override // com.scb.phone.view.fragment.BaseFragment public final void aJ_() { super.aJ_(); e(((BaseRequestToPayFragment) this).d); } @Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment public void onActivityResult(int i, int i2, Intent intent) { super.onActivityResult(i, i2, intent); if (i == 6001 && i2 == -1) { IncomingAdapter incomingAdapter = this.h; if (incomingAdapter.a) { incomingAdapter.a = false; } this.incomingPresenter.a(); e(((BaseRequestToPayFragment) this).d); this.incomingRecyclerView.setAdapter(null); } } /* JADX INFO: Access modifiers changed from: private */ public void e(final List list) { if (!isMenuVisible() || this.incomingPresenter.b()) { return; } this.container.setVisibility(0); IncomingAdapter incomingAdapter = this.h; IncomingAdapter.HBt hBt = new IncomingAdapter.HBt(this, list) { // from class: o.fzl private List b; private IncomingFragment e; @Override // com.scb.phone.view.adapter.requesttopay.IncomingAdapter.HBt public final void d(boolean z) { IncomingFragment.a(this.e, this.b, true); } { this.e = this; this.b = list; } }; if (!incomingAdapter.a) { incomingAdapter.a = true; hBt.d(true); } this.selectionProxyTextView.setVisibility(8); this.emptyIncomingTextView.setVisibility(8); } public static /* synthetic */ void a(IncomingFragment incomingFragment, List list, boolean z) { if (z) { incomingFragment.incomingPresenter.a((List) list); } } @Override // com.scb.phone.view.adapter.requesttopay.IncomingAdapter.IeS public final void a(int i) { kVY kvy = ((IncomingAdapter) this.incomingRecyclerView.g).e.get(i).a; C1189Xo h = C1189Xo.h(); Intent intent = new Intent(getContext(), (Class) SummaryDetailActivity.class); boolean z = "PENDING".compareTo(kvy.l) == 0; C5966cEj c5966cEj = this.incomingPresenter; BB bb = c5966cEj.c; boolean T = c5966cEj.d.b.T(); h.ab = kvy.m; h.ac = kvy.j; h.Z = BB.b(kvy.m, kvy.i, T); h.Y = kvy.g; h.T = kvy.h; h.U = BB.b(kvy.g, kvy.f, T); C1168Xb.LWm lWm = new C1168Xb.LWm(); lWm.b = BB.c(Double.valueOf(kvy.b)); h.j = new C1168Xb(lWm, (byte) 0); String str = ""; h.w = kvy.c == null ? "" : bb.a(kvy.c); h.O = kvy.a; if (kvy.n != null) { str = (String) C16157lj.c(new Object[]{bb, kvy.n}, 838289628, -838289623, System.identityHashCode(bb)); } h.au = str; h.aB = kvy.k; h.aj = kvy.f9191o; h.e("rtp.detail"); intent.addFlags(603979776); intent.putExtra("request_to_pay.SummaryDetailActivity.titleName", getString(R.string.request_to_pay_incoming_detail_title)); intent.putExtra("request_to_pay.SummaryDetailActivity.button.paynow", z); intent.putExtra("source", this.i); intent.putExtra("com.scb.phone.EXTRA_REVIEW", h); startActivityForResult(intent, AuthCode.StatusCode.WAITING_CONNECT); } }