package com.scb.phone.view.custom; import android.content.Context; import android.util.AttributeSet; import androidx.recyclerview.widget.RecyclerView; import com.scb.phone.view.custom.InfiniteRecyclerView; import java.util.ArrayList; import java.util.Objects; import java.util.concurrent.TimeUnit; import o.AbstractC12010eqD; import o.AbstractC13155fSc; import o.AbstractC13173fSu; import o.AbstractC14961gcz; import o.C10297eAB; import o.C11786els; import o.C13194fTh; import o.C13199fTm; import o.C13215fUF; import o.C13247fUz; import o.C13417fZt; import o.C14866gag; import o.C14957gcv; import o.InterfaceC10322eAr; import o.InterfaceC13393fZL; import o.InterfaceC14890gbN; import o.InterfaceC14894gbR; import o.fJF; import o.fRR; import o.fSJ; import o.fSQ; import o.fZZ; import o.gxT; /* loaded from: classes5.dex */ public final class InfiniteRecyclerView extends RecyclerView implements InterfaceC10322eAr { private boolean aa; private final InterfaceC13393fZL ab; public fSJ ac; private final InterfaceC13393fZL ag; private /* synthetic */ InfiniteRecyclerView(Context context, AttributeSet attributeSet, int i, byte b) { this(context, (i & 2) != 0 ? null : attributeSet, 0); } public static final /* synthetic */ gxT a(InfiniteRecyclerView infiniteRecyclerView) { return (gxT) infiniteRecyclerView.ab.e(); } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ public InfiniteRecyclerView(Context context, AttributeSet attributeSet, int i) { super(context, attributeSet, i); C14957gcv.e(context, ""); jbe jbeVar = jbe.c; C14957gcv.e(jbeVar, ""); this.ab = new fZZ(jbeVar); tOB tob = new tOB(this, context); C14957gcv.e(tob, ""); this.ag = new fZZ(tob); } @Override // androidx.recyclerview.widget.RecyclerView public final void setAdapter(RecyclerView.Sts sts) { int i; AbstractC12010eqD abstractC12010eqD = sts instanceof AbstractC12010eqD ? (AbstractC12010eqD) sts : null; if (abstractC12010eqD == null) { throw new IllegalArgumentException("we accept Adapter extends from BaseInfiniteAdapter only"); } abstractC12010eqD.registerAdapterDataObserver(new LWm(this, abstractC12010eqD)); super.setAdapter(abstractC12010eqD); ((gxT) this.ab.e()).a(this); Sts sts2 = new Sts(this, new HBt(this)); if (this.S == null) { this.S = new ArrayList(); } this.S.add(sts2); if (abstractC12010eqD.getItemCount() > 0) { int i2 = abstractC12010eqD.a; i = i2 + abstractC12010eqD.b(i2); } else { i = 0; } d(i); } /* loaded from: classes5.dex */ public static final class LWm extends RecyclerView.LWm { private AbstractC12010eqD a; private InfiniteRecyclerView d; LWm(InfiniteRecyclerView infiniteRecyclerView, AbstractC12010eqD abstractC12010eqD) { this.d = infiniteRecyclerView; this.a = abstractC12010eqD; } @Override // androidx.recyclerview.widget.RecyclerView.LWm public final void c() { int i; super.c(); InfiniteRecyclerView infiniteRecyclerView = this.d; AbstractC12010eqD abstractC12010eqD = this.a; if (abstractC12010eqD.getItemCount() > 0) { int i2 = abstractC12010eqD.a; i = i2 + abstractC12010eqD.b(i2); } else { i = 0; } infiniteRecyclerView.d(i); } } /* loaded from: classes5.dex */ static final class HBt extends AbstractC14961gcz implements InterfaceC14894gbR { private InfiniteRecyclerView b; @Override // o.InterfaceC14894gbR public final /* synthetic */ C14866gag invoke(Integer num) { int intValue = num.intValue(); InfiniteRecyclerView infiniteRecyclerView = this.b; boolean z = true; if (intValue != 1 && intValue != 2) { z = false; } infiniteRecyclerView.aa = z; return C14866gag.c; } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ HBt(InfiniteRecyclerView infiniteRecyclerView) { super(1); this.b = infiniteRecyclerView; } } @Override // androidx.recyclerview.widget.RecyclerView public final void e(int i) { ((RVV) this.ag.e()).f = i; RecyclerView.tOB tob = this.x; if (tob != null) { tob.b((RVV) this.ag.e()); } } @Override // androidx.recyclerview.widget.RecyclerView, android.view.ViewGroup, android.view.View public final void onDetachedFromWindow() { super.onDetachedFromWindow(); fSJ fsj = this.ac; if (fsj != null) { fsj.dispose(); } } public static /* synthetic */ void setOnSnapPositionChangeListener$default(InfiniteRecyclerView infiniteRecyclerView, fJF.RVV rvv, fJF.HBt hBt, int i, Object obj) { if ((i & 1) != 0) { rvv = fJF.RVV.NOTIFY_ON_SCROLL; } infiniteRecyclerView.setOnSnapPositionChangeListener(rvv, hBt); } public final void setOnSnapPositionChangeListener(fJF.RVV rvv, fJF.HBt hBt) { C14957gcv.e(rvv, ""); C14957gcv.e(hBt, ""); fJF fjf = new fJF((gxT) this.ab.e(), rvv, hBt); if (this.S == null) { this.S = new ArrayList(); } this.S.add(fjf); } public final void g() { AbstractC13155fSc c = AbstractC13155fSc.c(TimeUnit.MILLISECONDS); AbstractC13173fSu b = C13417fZt.b(); Objects.requireNonNull(b, "scheduler is null"); Objects.requireNonNull(b, "scheduler is null"); C13215fUF c13215fUF = new C13215fUF(c, b, true); AbstractC13173fSu e = fRR.e(); int a = AbstractC13155fSc.a(); Objects.requireNonNull(e, "scheduler is null"); C13199fTm.c(a, "bufferSize"); this.ac = new C13247fUz(c13215fUF, e, a).a(new fSQ(new IeS(this)) { // from class: o.eAo private InterfaceC14894gbR a; @Override // o.fSQ public final void c(Object obj) { InfiniteRecyclerView.a(this.a, obj); } { this.a = r1; } }, C13194fTh.a, C13194fTh.c); } /* loaded from: classes5.dex */ public static final class IeS extends AbstractC14961gcz implements InterfaceC14894gbR { private InfiniteRecyclerView d; @Override // o.InterfaceC14894gbR public final /* synthetic */ C14866gag invoke(Long l) { RecyclerView.Sts sts = this.d.g; if (sts != null) { int itemCount = sts.getItemCount(); if (!this.d.aa && itemCount > 1) { InfiniteRecyclerView infiniteRecyclerView = this.d; infiniteRecyclerView.e(infiniteRecyclerView.a(infiniteRecyclerView, InfiniteRecyclerView.a(infiniteRecyclerView)) + 1); } } return C14866gag.c; } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ IeS(InfiniteRecyclerView infiniteRecyclerView) { super(1); this.d = infiniteRecyclerView; } } /* loaded from: classes5.dex */ public final class Sts extends RecyclerView.dAO { private InfiniteRecyclerView a; private final InterfaceC14894gbR c; /* JADX WARN: Multi-variable type inference failed */ public Sts(InfiniteRecyclerView infiniteRecyclerView, InterfaceC14894gbR interfaceC14894gbR) { C14957gcv.e(interfaceC14894gbR, ""); this.a = infiniteRecyclerView; this.c = interfaceC14894gbR; } @Override // androidx.recyclerview.widget.RecyclerView.dAO public final void onScrollStateChanged(RecyclerView recyclerView, int i) { C14957gcv.e(recyclerView, ""); super.onScrollStateChanged(recyclerView, i); this.c.invoke(Integer.valueOf(i)); } } /* loaded from: classes5.dex */ public final class RVV extends C11786els { private InfiniteRecyclerView a; @Override // o.C11786els public final int a() { return -1; } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ public RVV(InfiniteRecyclerView infiniteRecyclerView, Context context) { super(context); C14957gcv.e(context, ""); this.a = infiniteRecyclerView; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes5.dex */ public static final class jbe extends AbstractC14961gcz implements InterfaceC14890gbN { public static final jbe c = new jbe(); @Override // o.InterfaceC14890gbN public final /* synthetic */ C10297eAB invoke() { return new C10297eAB(); } jbe() { super(0); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes5.dex */ public static final class tOB extends AbstractC14961gcz implements InterfaceC14890gbN { private InfiniteRecyclerView b; private Context c; @Override // o.InterfaceC14890gbN public final /* synthetic */ RVV invoke() { return new RVV(this.b, this.c); } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ tOB(InfiniteRecyclerView infiniteRecyclerView, Context context) { super(0); this.b = infiniteRecyclerView; this.c = context; } } public static /* synthetic */ void a(InterfaceC14894gbR interfaceC14894gbR, Object obj) { C14957gcv.e(interfaceC14894gbR, ""); interfaceC14894gbR.invoke(obj); } public final void setOnSnapPositionChangeListener(fJF.HBt hBt) { C14957gcv.e(hBt, ""); setOnSnapPositionChangeListener$default(this, null, hBt, 1, null); } /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */ public InfiniteRecyclerView(Context context, AttributeSet attributeSet) { this(context, attributeSet, 4, (byte) 0); C14957gcv.e(context, ""); } /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */ public InfiniteRecyclerView(Context context) { this(context, null, 6, (byte) 0); C14957gcv.e(context, ""); } }