what-the-bank/sources/androidx/viewpager2/widget/ViewPager2.java

996 lines
31 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package androidx.viewpager2.widget;
import android.R;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.SparseArray;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import androidx.core.view.ViewCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
import androidx.core.view.accessibility.AccessibilityViewCommand;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import o.C14810gER;
import o.C16447oTw;
import o.DSo;
import o.Dyg;
import o.SxS;
import o.rFJ;
import o.vxJ;
/* loaded from: classes.dex */
public final class ViewPager2 extends ViewGroup {
public vxJ a;
RVV b;
boolean c;
public int d;
rFJ e;
public RecyclerView f;
public LinearLayoutManager g;
boolean h;
public C16447oTw i;
int j;
private SxS k;
private C14810gER l;
private vxJ m;
private RecyclerView.LWm n;
/* renamed from: o, reason: collision with root package name */
private Parcelable f6398o;
private int p;
private RecyclerView.jbe q;
private final Rect r;
private final Rect s;
private boolean t;
/* loaded from: classes.dex */
public interface HBt {
}
/* loaded from: classes.dex */
public static abstract class IeS {
public void b(int i) {
}
public void c(int i) {
}
public void d(int i, float f, int i2) {
}
}
public ViewPager2(Context context) {
super(context);
this.s = new Rect();
this.r = new Rect();
this.a = new vxJ();
this.c = false;
this.n = new Sts(this) { // from class: androidx.viewpager2.widget.ViewPager2.1
final ViewPager2 c;
{
this.c = this;
}
@Override // androidx.recyclerview.widget.RecyclerView.LWm
public final void c() {
this.c.c = true;
this.c.i.b = true;
}
};
this.p = -1;
this.q = null;
this.t = false;
this.h = true;
this.j = -1;
Cj_(context, null);
}
public ViewPager2(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.s = new Rect();
this.r = new Rect();
this.a = new vxJ();
this.c = false;
this.n = new Sts(this) { // from class: androidx.viewpager2.widget.ViewPager2.1
final ViewPager2 c;
{
this.c = this;
}
@Override // androidx.recyclerview.widget.RecyclerView.LWm
public final void c() {
this.c.c = true;
this.c.i.b = true;
}
};
this.p = -1;
this.q = null;
this.t = false;
this.h = true;
this.j = -1;
Cj_(context, attributeSet);
}
public ViewPager2(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.s = new Rect();
this.r = new Rect();
this.a = new vxJ();
this.c = false;
this.n = new Sts(this) { // from class: androidx.viewpager2.widget.ViewPager2.1
final ViewPager2 c;
{
this.c = this;
}
@Override // androidx.recyclerview.widget.RecyclerView.LWm
public final void c() {
this.c.c = true;
this.c.i.b = true;
}
};
this.p = -1;
this.q = null;
this.t = false;
this.h = true;
this.j = -1;
Cj_(context, attributeSet);
}
private void Cj_(Context context, AttributeSet attributeSet) {
this.b = new LWm(this);
RecyclerViewImpl recyclerViewImpl = new RecyclerViewImpl(this, context);
this.f = recyclerViewImpl;
recyclerViewImpl.setId(ViewCompat.a());
this.f.setDescendantFocusability(131072);
LinearLayoutManagerImpl linearLayoutManagerImpl = new LinearLayoutManagerImpl(this);
this.g = linearLayoutManagerImpl;
this.f.setLayoutManager(linearLayoutManagerImpl);
this.f.setScrollingTouchSlop(1);
Ck_(context, attributeSet);
this.f.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
RecyclerView recyclerView = this.f;
RecyclerView.NHB nhb = new RecyclerView.NHB(this) { // from class: androidx.viewpager2.widget.ViewPager2.2
final ViewPager2 c;
{
this.c = this;
}
@Override // androidx.recyclerview.widget.RecyclerView.NHB
public final void a(View view) {
RecyclerView.saX sax = (RecyclerView.saX) view.getLayoutParams();
if (((ViewGroup.LayoutParams) sax).width != -1 || ((ViewGroup.LayoutParams) sax).height != -1) {
throw new IllegalStateException("Pages must fill the whole ViewPager2 (use match_parent)");
}
}
};
if (recyclerView.z == null) {
recyclerView.z = new ArrayList();
}
recyclerView.z.add(nhb);
C16447oTw c16447oTw = new C16447oTw(this);
this.i = c16447oTw;
this.e = new rFJ(this, c16447oTw, this.f);
ZqN zqN = new ZqN(this);
this.k = zqN;
zqN.a(this.f);
RecyclerView recyclerView2 = this.f;
C16447oTw c16447oTw2 = this.i;
if (recyclerView2.S == null) {
recyclerView2.S = new ArrayList();
}
recyclerView2.S.add(c16447oTw2);
vxJ vxj = new vxJ();
this.m = vxj;
this.i.a = vxj;
IeS ieS = new IeS(this) { // from class: androidx.viewpager2.widget.ViewPager2.5
final ViewPager2 c;
{
this.c = this;
}
@Override // androidx.viewpager2.widget.ViewPager2.IeS
public final void c(int i) {
if (this.c.d != i) {
this.c.d = i;
this.c.b.a();
}
}
@Override // androidx.viewpager2.widget.ViewPager2.IeS
public final void b(int i) {
if (i == 0) {
this.c.a();
}
}
};
IeS ieS2 = new IeS(this) { // from class: androidx.viewpager2.widget.ViewPager2.3
final ViewPager2 c;
{
this.c = this;
}
@Override // androidx.viewpager2.widget.ViewPager2.IeS
public final void c(int i) {
this.c.clearFocus();
if (this.c.hasFocus()) {
this.c.f.requestFocus(2);
}
}
};
this.m.e.add(ieS);
this.m.e.add(ieS2);
this.b.e(this.f);
vxJ vxj2 = this.m;
vxj2.e.add(this.a);
C14810gER c14810gER = new C14810gER(this.g);
this.l = c14810gER;
this.m.e.add(c14810gER);
RecyclerView recyclerView3 = this.f;
attachViewToParent(recyclerView3, 0, recyclerView3.getLayoutParams());
}
@Override // android.view.ViewGroup, android.view.View
public final CharSequence getAccessibilityClassName() {
if (this.b.c()) {
return this.b.b();
}
return super.getAccessibilityClassName();
}
private void Ck_(Context context, AttributeSet attributeSet) {
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, DSo.RVV.ViewPager2);
if (Build.VERSION.SDK_INT >= 29) {
saveAttributeDataForStyleable(context, DSo.RVV.ViewPager2, attributeSet, obtainStyledAttributes, 0, 0);
}
try {
setOrientation(obtainStyledAttributes.getInt(DSo.RVV.ViewPager2_android_orientation, 0));
} finally {
obtainStyledAttributes.recycle();
}
}
@Override // android.view.View
protected final Parcelable onSaveInstanceState() {
saX sax = new saX(super.onSaveInstanceState());
sax.a = this.f.getId();
int i = this.p;
if (i == -1) {
i = this.d;
}
sax.e = i;
Parcelable parcelable = this.f6398o;
if (parcelable != null) {
sax.b = parcelable;
} else {
Object obj = this.f.g;
if (obj instanceof Dyg) {
sax.b = ((Dyg) obj).Ci_();
}
}
return sax;
}
@Override // android.view.View
protected final void onRestoreInstanceState(Parcelable parcelable) {
if (!(parcelable instanceof saX)) {
super.onRestoreInstanceState(parcelable);
return;
}
saX sax = (saX) parcelable;
super.onRestoreInstanceState(sax.getSuperState());
this.p = sax.e;
this.f6398o = sax.b;
}
/* JADX WARN: Multi-variable type inference failed */
private void c() {
RecyclerView.Sts sts;
if (this.p == -1 || (sts = this.f.g) == 0) {
return;
}
Parcelable parcelable = this.f6398o;
if (parcelable != null) {
if (sts instanceof Dyg) {
((Dyg) sts).Ch_(parcelable);
}
this.f6398o = null;
}
int max = Math.max(0, Math.min(this.p, sts.getItemCount() - 1));
this.d = max;
this.p = -1;
this.f.d(max);
this.b.e();
}
@Override // android.view.ViewGroup, android.view.View
protected final void dispatchRestoreInstanceState(SparseArray<Parcelable> sparseArray) {
Parcelable parcelable = sparseArray.get(getId());
if (parcelable instanceof saX) {
int i = ((saX) parcelable).a;
sparseArray.put(this.f.getId(), sparseArray.get(i));
sparseArray.remove(i);
}
super.dispatchRestoreInstanceState(sparseArray);
c();
}
/* loaded from: classes.dex */
static class saX extends View.BaseSavedState {
public static final Parcelable.Creator<saX> CREATOR = new Parcelable.ClassLoaderCreator<saX>() { // from class: androidx.viewpager2.widget.ViewPager2.saX.1
@Override // android.os.Parcelable.Creator
public final /* synthetic */ Object createFromParcel(Parcel parcel) {
return new saX(parcel, null);
}
@Override // android.os.Parcelable.ClassLoaderCreator
public final /* synthetic */ saX createFromParcel(Parcel parcel, ClassLoader classLoader) {
return new saX(parcel, classLoader);
}
@Override // android.os.Parcelable.Creator
public final /* bridge */ /* synthetic */ Object[] newArray(int i) {
return new saX[i];
}
};
int a;
Parcelable b;
int e;
saX(Parcel parcel, ClassLoader classLoader) {
super(parcel, classLoader);
this.a = parcel.readInt();
this.e = parcel.readInt();
this.b = parcel.readParcelable(classLoader);
}
saX(Parcelable parcelable) {
super(parcelable);
}
@Override // android.view.View.BaseSavedState, android.view.AbsSavedState, android.os.Parcelable
public final void writeToParcel(Parcel parcel, int i) {
super.writeToParcel(parcel, i);
parcel.writeInt(this.a);
parcel.writeInt(this.e);
parcel.writeParcelable(this.b, i);
}
}
@Override // android.view.ViewGroup
public final void onViewAdded(View view) {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" does not support direct child views");
throw new IllegalStateException(sb.toString());
}
@Override // android.view.View
protected final void onMeasure(int i, int i2) {
measureChild(this.f, i, i2);
int measuredWidth = this.f.getMeasuredWidth();
int measuredHeight = this.f.getMeasuredHeight();
int measuredState = this.f.getMeasuredState();
int paddingLeft = getPaddingLeft();
int paddingRight = getPaddingRight();
int paddingTop = getPaddingTop();
int paddingBottom = getPaddingBottom();
setMeasuredDimension(resolveSizeAndState(Math.max(measuredWidth + paddingLeft + paddingRight, getSuggestedMinimumWidth()), i, measuredState), resolveSizeAndState(Math.max(measuredHeight + paddingTop + paddingBottom, getSuggestedMinimumHeight()), i2, measuredState << 16));
}
@Override // android.view.ViewGroup, android.view.View
protected final void onLayout(boolean z, int i, int i2, int i3, int i4) {
int measuredWidth = this.f.getMeasuredWidth();
int measuredHeight = this.f.getMeasuredHeight();
this.s.left = getPaddingLeft();
this.s.right = (i3 - i) - getPaddingRight();
this.s.top = getPaddingTop();
this.s.bottom = (i4 - i2) - getPaddingBottom();
Gravity.apply(8388659, measuredWidth, measuredHeight, this.s, this.r);
this.f.layout(this.r.left, this.r.top, this.r.right, this.r.bottom);
if (this.c) {
a();
}
}
final void a() {
SxS sxS = this.k;
if (sxS == null) {
throw new IllegalStateException("Design assumption violated.");
}
View b = sxS.b(this.g);
if (b == null) {
return;
}
int f = LinearLayoutManager.f(b);
if (f != this.d && this.i.c == 0) {
this.m.c(f);
}
this.c = false;
}
final int b() {
int height;
int paddingBottom;
RecyclerView recyclerView = this.f;
if (this.g.h == 0) {
height = recyclerView.getWidth() - recyclerView.getPaddingLeft();
paddingBottom = recyclerView.getPaddingRight();
} else {
height = recyclerView.getHeight() - recyclerView.getPaddingTop();
paddingBottom = recyclerView.getPaddingBottom();
}
return height - paddingBottom;
}
public final void setOrientation(int i) {
this.g.e(i);
this.b.h();
}
public final void setCurrentItem(int i) {
setCurrentItem(i, true);
}
public final void setCurrentItem(int i, boolean z) {
boolean z2 = this.e.c.d;
a(i, z);
}
final void a(int i, boolean z) {
RecyclerView.Sts sts = this.f.g;
if (sts == null) {
if (this.p != -1) {
this.p = Math.max(i, 0);
return;
}
return;
}
if (sts.getItemCount() <= 0) {
return;
}
int min = Math.min(Math.max(i, 0), sts.getItemCount() - 1);
if (min == this.d && this.i.c == 0) {
return;
}
int i2 = this.d;
if (min == i2 && z) {
return;
}
double d = i2;
this.d = min;
this.b.a();
if (this.i.c != 0) {
this.i.a();
d = r0.e.c + r0.e.a;
}
this.i.b(min, z);
if (!z) {
this.f.d(min);
return;
}
double d2 = min;
if (Math.abs(d2 - d) > 3.0d) {
this.f.d(d2 > d ? min - 3 : min + 3);
RecyclerView recyclerView = this.f;
recyclerView.post(new tOB(min, recyclerView));
return;
}
this.f.e(min);
}
public final void setUserInputEnabled(boolean z) {
this.h = z;
this.b.f();
}
public final void setOffscreenPageLimit(int i) {
if (i <= 0 && i != -1) {
throw new IllegalArgumentException("Offscreen page limit must be OFFSCREEN_PAGE_LIMIT_DEFAULT or a number > 0");
}
this.j = i;
this.f.requestLayout();
}
@Override // android.view.View
public final boolean canScrollHorizontally(int i) {
return this.f.canScrollHorizontally(i);
}
@Override // android.view.View
public final boolean canScrollVertically(int i) {
return this.f.canScrollVertically(i);
}
@Override // android.view.View
public final void setLayoutDirection(int i) {
super.setLayoutDirection(i);
this.b.d();
}
@Override // android.view.View
public final void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
this.b.Cp_(accessibilityNodeInfo);
}
@Override // android.view.View
public final boolean performAccessibilityAction(int i, Bundle bundle) {
if (this.b.a(i)) {
return this.b.b(i);
}
return super.performAccessibilityAction(i, bundle);
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public class RecyclerViewImpl extends RecyclerView {
final ViewPager2 ac;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
RecyclerViewImpl(ViewPager2 viewPager2, Context context) {
super(context);
this.ac = viewPager2;
}
@Override // androidx.recyclerview.widget.RecyclerView, android.view.ViewGroup, android.view.View
public CharSequence getAccessibilityClassName() {
RVV rvv = this.ac.b;
return super.getAccessibilityClassName();
}
@Override // android.view.View
public void onInitializeAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
super.onInitializeAccessibilityEvent(accessibilityEvent);
accessibilityEvent.setFromIndex(this.ac.d);
accessibilityEvent.setToIndex(this.ac.d);
this.ac.b.Cq_(accessibilityEvent);
}
@Override // androidx.recyclerview.widget.RecyclerView, android.view.ViewGroup
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
return this.ac.h && super.onInterceptTouchEvent(motionEvent);
}
@Override // androidx.recyclerview.widget.RecyclerView, android.view.View
public boolean onTouchEvent(MotionEvent motionEvent) {
return this.ac.h && super.onTouchEvent(motionEvent);
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public class LinearLayoutManagerImpl extends LinearLayoutManager {
final ViewPager2 a;
@Override // androidx.recyclerview.widget.RecyclerView.tOB
public final boolean Iv_(RecyclerView recyclerView, View view, Rect rect, boolean z, boolean z2) {
return false;
}
LinearLayoutManagerImpl(ViewPager2 viewPager2) {
this.a = viewPager2;
}
@Override // androidx.recyclerview.widget.RecyclerView.tOB
public final boolean Cn_(RecyclerView.huo huoVar, RecyclerView.AcL acL, int i, Bundle bundle) {
RVV rvv = this.a.b;
return super.Cn_(huoVar, acL, i, bundle);
}
@Override // androidx.recyclerview.widget.RecyclerView.tOB
public final void a(RecyclerView.huo huoVar, RecyclerView.AcL acL, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) {
super.a(huoVar, acL, accessibilityNodeInfoCompat);
RVV rvv = this.a.b;
}
@Override // androidx.recyclerview.widget.LinearLayoutManager
public final void a(RecyclerView.AcL acL, int[] iArr) {
int i = this.a.j;
if (i == -1) {
super.a(acL, iArr);
return;
}
int b = this.a.b() * i;
iArr[0] = b;
iArr[1] = b;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public class ZqN extends SxS {
final ViewPager2 e;
ZqN(ViewPager2 viewPager2) {
this.e = viewPager2;
}
@Override // o.SxS, o.gxT
public final View b(RecyclerView.tOB tob) {
boolean z = this.e.e.c.d;
return super.b(tob);
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public static class tOB implements Runnable {
private final RecyclerView a;
private final int c;
tOB(int i, RecyclerView recyclerView) {
this.c = i;
this.a = recyclerView;
}
@Override // java.lang.Runnable
public final void run() {
this.a.e(this.c);
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public abstract class RVV {
final ViewPager2 a;
void Cp_(AccessibilityNodeInfo accessibilityNodeInfo) {
}
void Cq_(AccessibilityEvent accessibilityEvent) {
}
void a() {
}
boolean a(int i) {
return false;
}
void b(RecyclerView.Sts<?> sts) {
}
boolean c() {
return false;
}
void d() {
}
void d(RecyclerView.Sts<?> sts) {
}
void e() {
}
void e(RecyclerView recyclerView) {
}
void f() {
}
void h() {
}
private RVV(ViewPager2 viewPager2) {
this.a = viewPager2;
}
/* synthetic */ RVV(ViewPager2 viewPager2, byte b) {
this(viewPager2);
}
String b() {
throw new IllegalStateException("Not implemented.");
}
boolean b(int i) {
throw new IllegalStateException("Not implemented.");
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public class LWm extends RVV {
final ViewPager2 b;
private RecyclerView.LWm c;
private final AccessibilityViewCommand d;
private final AccessibilityViewCommand e;
@Override // androidx.viewpager2.widget.ViewPager2.RVV
public final boolean a(int i) {
return i == 8192 || i == 4096;
}
@Override // androidx.viewpager2.widget.ViewPager2.RVV
public final boolean c() {
return true;
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
LWm(ViewPager2 viewPager2) {
super(viewPager2, (byte) 0);
this.b = viewPager2;
this.d = new AccessibilityViewCommand(this) { // from class: androidx.viewpager2.widget.ViewPager2.LWm.2
final LWm c;
{
this.c = this;
}
@Override // androidx.core.view.accessibility.AccessibilityViewCommand
public final boolean d(View view) {
LWm lWm = this.c;
int i = ((ViewPager2) view).d + 1;
if (lWm.b.h) {
lWm.b.a(i, true);
}
return true;
}
};
this.e = new AccessibilityViewCommand(this) { // from class: androidx.viewpager2.widget.ViewPager2.LWm.3
final LWm a;
{
this.a = this;
}
@Override // androidx.core.view.accessibility.AccessibilityViewCommand
public final boolean d(View view) {
LWm lWm = this.a;
int i = ((ViewPager2) view).d - 1;
if (lWm.b.h) {
lWm.b.a(i, true);
}
return true;
}
};
}
@Override // androidx.viewpager2.widget.ViewPager2.RVV
public final void e(RecyclerView recyclerView) {
ViewCompat.g(recyclerView, 2);
this.c = new Sts(this) { // from class: androidx.viewpager2.widget.ViewPager2.LWm.5
final LWm d;
{
this.d = this;
}
@Override // androidx.recyclerview.widget.RecyclerView.LWm
public final void c() {
this.d.g();
}
};
if (ViewCompat.n(this.b) == 0) {
ViewCompat.g(this.b, 1);
}
}
@Override // androidx.viewpager2.widget.ViewPager2.RVV
public final String b() {
return "androidx.viewpager.widget.ViewPager";
}
@Override // androidx.viewpager2.widget.ViewPager2.RVV
public final void e() {
g();
}
@Override // androidx.viewpager2.widget.ViewPager2.RVV
public final void b(RecyclerView.Sts<?> sts) {
g();
if (sts != null) {
sts.registerAdapterDataObserver(this.c);
}
}
@Override // androidx.viewpager2.widget.ViewPager2.RVV
public final void d(RecyclerView.Sts<?> sts) {
if (sts != null) {
sts.unregisterAdapterDataObserver(this.c);
}
}
@Override // androidx.viewpager2.widget.ViewPager2.RVV
public final void h() {
g();
}
@Override // androidx.viewpager2.widget.ViewPager2.RVV
public final void a() {
g();
}
@Override // androidx.viewpager2.widget.ViewPager2.RVV
public final void f() {
g();
}
@Override // androidx.viewpager2.widget.ViewPager2.RVV
public final void d() {
g();
}
@Override // androidx.viewpager2.widget.ViewPager2.RVV
public final void Cp_(AccessibilityNodeInfo accessibilityNodeInfo) {
int i;
int i2;
int itemCount;
if (this.b.f.g == null) {
i = 0;
i2 = 0;
} else if (this.b.g.h == 1) {
i = this.b.f.g.getItemCount();
i2 = 0;
} else {
i2 = this.b.f.g.getItemCount();
i = 0;
}
AccessibilityNodeInfoCompat.tU_(accessibilityNodeInfo).e(AccessibilityNodeInfoCompat.CollectionInfoCompat.e(i, i2, false, 0));
RecyclerView.Sts sts = this.b.f.g;
if (sts == null || (itemCount = sts.getItemCount()) == 0 || !this.b.h) {
return;
}
if (this.b.d > 0) {
accessibilityNodeInfo.addAction(8192);
}
if (this.b.d < itemCount - 1) {
accessibilityNodeInfo.addAction(4096);
}
accessibilityNodeInfo.setScrollable(true);
}
@Override // androidx.viewpager2.widget.ViewPager2.RVV
public final boolean b(int i) {
int i2;
if (i != 8192 && i != 4096) {
throw new IllegalStateException();
}
if (i == 8192) {
i2 = this.b.d - 1;
} else {
i2 = this.b.d + 1;
}
if (this.b.h) {
this.b.a(i2, true);
}
return true;
}
@Override // androidx.viewpager2.widget.ViewPager2.RVV
public final void Cq_(AccessibilityEvent accessibilityEvent) {
accessibilityEvent.setSource(this.b);
accessibilityEvent.setClassName("androidx.viewpager.widget.ViewPager");
}
final void g() {
int itemCount;
ViewPager2 viewPager2 = this.b;
int i = R.id.accessibilityActionPageLeft;
ViewCompat.b(viewPager2, R.id.accessibilityActionPageLeft);
ViewCompat.b(viewPager2, R.id.accessibilityActionPageRight);
ViewCompat.b(viewPager2, R.id.accessibilityActionPageUp);
ViewCompat.b(viewPager2, R.id.accessibilityActionPageDown);
if (this.b.f.g == null || (itemCount = this.b.f.g.getItemCount()) == 0 || !this.b.h) {
return;
}
if (this.b.g.h != 0) {
if (this.b.d < itemCount - 1) {
ViewCompat.a(viewPager2, new AccessibilityNodeInfoCompat.AccessibilityActionCompat(R.id.accessibilityActionPageDown, null), null, this.d);
}
if (this.b.d > 0) {
ViewCompat.a(viewPager2, new AccessibilityNodeInfoCompat.AccessibilityActionCompat(R.id.accessibilityActionPageUp, null), null, this.e);
return;
}
return;
}
boolean z = ViewCompat.m(this.b.g.s) == 1;
int i2 = z ? 16908360 : 16908361;
if (z) {
i = 16908361;
}
if (this.b.d < itemCount - 1) {
ViewCompat.a(viewPager2, new AccessibilityNodeInfoCompat.AccessibilityActionCompat(i2, null), null, this.d);
}
if (this.b.d > 0) {
ViewCompat.a(viewPager2, new AccessibilityNodeInfoCompat.AccessibilityActionCompat(i, null), null, this.e);
}
}
}
/* loaded from: classes.dex */
static abstract class Sts extends RecyclerView.LWm {
private Sts() {
}
/* synthetic */ Sts(byte b) {
this();
}
@Override // androidx.recyclerview.widget.RecyclerView.LWm
public final void c(int i, int i2) {
c();
}
@Override // androidx.recyclerview.widget.RecyclerView.LWm
public final void c(int i, int i2, Object obj) {
c();
}
@Override // androidx.recyclerview.widget.RecyclerView.LWm
public final void b(int i, int i2) {
c();
}
@Override // androidx.recyclerview.widget.RecyclerView.LWm
public final void a(int i, int i2) {
c();
}
@Override // androidx.recyclerview.widget.RecyclerView.LWm
public final void d(int i, int i2) {
c();
}
}
public final void setAdapter(RecyclerView.Sts sts) {
RecyclerView.Sts<?> sts2 = this.f.g;
this.b.d(sts2);
if (sts2 != null) {
sts2.unregisterAdapterDataObserver(this.n);
}
this.f.setAdapter(sts);
this.d = 0;
c();
this.b.b((RecyclerView.Sts<?>) sts);
if (sts != null) {
sts.registerAdapterDataObserver(this.n);
}
}
public final void setPageTransformer(HBt hBt) {
if (hBt != null) {
if (!this.t) {
this.q = this.f.t;
this.t = true;
}
this.f.setItemAnimator(null);
} else if (this.t) {
this.f.setItemAnimator(this.q);
this.q = null;
this.t = false;
}
if (hBt == this.l.b) {
return;
}
this.l.b = hBt;
if (this.l.b != null) {
this.i.a();
double d = r5.e.c + r5.e.a;
int i = (int) d;
float f = (float) (d - i);
this.l.d(i, f, Math.round(b() * f));
}
}
}