package com.scb.phone.view.fragment.closeaccount; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.recyclerview.widget.RecyclerView; import butterknife.BindView; import butterknife.ButterKnife; import com.scb.phone.R; import com.scb.phone.view.adapter.closeaccount.AccountTargetAdapter; import com.scb.phone.view.fragment.closeaccount.CloseAccountSelectionOwnFragment; import java.util.ArrayList; import java.util.List; import java.util.Objects; import o.AbstractC13163fSk; import o.C0690Mh; import o.C13377fYp; import o.C15608hA; import o.C16413oD; import o.C3486ayU; import o.InterfaceC12832fIg; import o.InterfaceC13204fTr; import o.InterfaceC13391fZD; import o.InterfaceC9129ddr; import o.USY; import o.ZI; import o.fIU; import o.fSD; import o.fSQ; import o.fSS; import o.wRi; /* loaded from: classes5.dex */ public class CloseAccountSelectionOwnFragment extends Hilt_CloseAccountSelectionOwnFragment implements InterfaceC9129ddr { private InterfaceC12832fIg c; private AccountTargetAdapter d; @InterfaceC13391fZD public C3486ayU presenter; @BindView RecyclerView recyclerView; @BindView ViewGroup viewGroupNoTargets; public static CloseAccountSelectionOwnFragment d() { return new CloseAccountSelectionOwnFragment(); } /* JADX WARN: Multi-variable type inference failed */ @Override // com.scb.phone.view.fragment.closeaccount.Hilt_CloseAccountSelectionOwnFragment, com.scb.phone.view.fragment.transferandpay.Hilt_BaseReplaceableFragment, com.scb.phone.view.fragment.Hilt_BaseFragment, androidx.fragment.app.Fragment public void onAttach(Context context) { if (getParentFragment() instanceof InterfaceC12832fIg) { this.c = (InterfaceC12832fIg) getParentFragment(); } else if (context instanceof InterfaceC12832fIg) { this.c = (InterfaceC12832fIg) context; } else { StringBuilder sb = new StringBuilder(); sb.append(context.toString()); sb.append(" must implement AccountTargetSelectionListener"); throw new ClassCastException(sb.toString()); } super.onAttach(context); } @Override // androidx.fragment.app.Fragment public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { AbstractC13163fSk c13377fYp; View inflate = layoutInflater.inflate(R.layout.2131559969, viewGroup, false); ButterKnife.c(this, inflate); this.presenter.e((C3486ayU) this); final C3486ayU c3486ayU = this.presenter; c3486ayU.c = new ArrayList(); AbstractC13163fSk sorted = c3486ayU.e.c().flatMap(new fSS(c3486ayU) { // from class: o.ayT private C3486ayU a; @Override // o.fSS public final Object a(Object obj) { InterfaceC13169fSq a; a = this.a.a.a((String) obj, EnumC15671hdu.CLOSE_ACCOUNT_TARGET); return a; } { this.a = c3486ayU; } }).flatMapIterable(new fSS() { // from class: o.ayS @Override // o.fSS public final Object a(Object obj) { return C3486ayU.d((List) obj); } }).sorted(new C15608hA()); final List list = c3486ayU.c; Objects.requireNonNull(list); fSD list2 = sorted.doOnNext(new fSQ(list) { // from class: o.ayW private List e; @Override // o.fSQ public final void c(Object obj) { this.e.add((USY) obj); } { this.e = list; } }).map(new fSS(c3486ayU) { // from class: o.ayV private C3486ayU c; @Override // o.fSS public final Object a(Object obj) { C16413oD d; d = this.c.d.d((USY) obj, r1.i.a.K().m > 0); return d; } { this.c = c3486ayU; } }).toList(); if (list2 instanceof InterfaceC13204fTr) { c13377fYp = ((InterfaceC13204fTr) list2).b(); } else { c13377fYp = new C13377fYp(list2); } c3486ayU.a.d(c13377fYp, new C3486ayU.AnonymousClass5(c3486ayU)); return inflate; } @Override // o.InterfaceC9129ddr public final void e() { this.viewGroupNoTargets.setVisibility(0); this.recyclerView.setVisibility(8); } @Override // o.InterfaceC9129ddr public final void a(List list) { this.viewGroupNoTargets.setVisibility(8); this.recyclerView.setVisibility(0); AccountTargetAdapter accountTargetAdapter = this.d; if (accountTargetAdapter == null) { AccountTargetAdapter accountTargetAdapter2 = new AccountTargetAdapter(list, new fIU(this) { // from class: o.eNw private CloseAccountSelectionOwnFragment a; @Override // o.fIU public final void b(int i) { CloseAccountSelectionOwnFragment.d(this.a, i); } { this.a = this; } }); this.d = accountTargetAdapter2; this.recyclerView.setAdapter(accountTargetAdapter2); } else { accountTargetAdapter.d = list; accountTargetAdapter.notifyDataSetChanged(); } } @Override // o.InterfaceC9129ddr public final void c() { this.c.i(); } @Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment public void onDestroy() { this.presenter.w_(); super.onDestroy(); } public static /* synthetic */ void d(CloseAccountSelectionOwnFragment closeAccountSelectionOwnFragment, int i) { C3486ayU c3486ayU = closeAccountSelectionOwnFragment.presenter; c3486ayU.b.d(c3486ayU.b.e(c3486ayU.c.get(i)), new wRi.LWm(c3486ayU) { // from class: o.ayU.3 private C3486ayU a; { this.a = c3486ayU; } @Override // o.wRi.LWm, o.InterfaceC13174fSv public final void onComplete() { C3486ayU c3486ayU2 = this.a; ZI.IeS ieS = new ZI.IeS() { // from class: o.ayY @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC9129ddr) obj).c(); } }; if (c3486ayU2.f != 0) { ieS.e(c3486ayU2.f); } } @Override // o.wRi.LWm, o.InterfaceC13174fSv public final void onError(Throwable th) { if (this.a.i(th)) { return; } C3486ayU.c(this.a, th, C0690Mh.IeS.JUST_DISMISS); } }); } }