package androidx.recyclerview.widget;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.PointF;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import androidx.annotation.NonNull;
import java.util.List;

/* JADX INFO: loaded from: classes.dex */
public class LinearLayoutManager extends q1 implements m0, d2 {
    static final boolean DEBUG = false;
    public static final int HORIZONTAL = 0;
    public static final int INVALID_OFFSET = Integer.MIN_VALUE;
    private static final float MAX_SCROLL_FACTOR = 0.33333334f;
    private static final String TAG = "LinearLayoutManager";
    public static final int VERTICAL = 1;
    final p0 mAnchorInfo;
    private int mInitialPrefetchItemCount;
    private boolean mLastStackFromEnd;
    private final q0 mLayoutChunkResult;
    private r0 mLayoutState;
    int mOrientation;
    x0 mOrientationHelper;
    s0 mPendingSavedState;
    int mPendingScrollPosition;
    int mPendingScrollPositionOffset;
    private boolean mRecycleChildrenOnDetach;
    private int[] mReusableIntPair;
    private boolean mReverseLayout;
    boolean mShouldReverseLayout;
    private boolean mSmoothScrollbarEnabled;
    private boolean mStackFromEnd;

    public LinearLayoutManager() {
        this(1, false);
    }

    public final void A(int i10, int i11) {
        this.mLayoutState.f3873c = i11 - this.mOrientationHelper.k();
        r0 r0Var = this.mLayoutState;
        r0Var.f3874d = i10;
        r0Var.f3875e = this.mShouldReverseLayout ? 1 : -1;
        r0Var.f3876f = -1;
        r0Var.f3872b = i11;
        r0Var.f3877g = Integer.MIN_VALUE;
    }

    @Override // androidx.recyclerview.widget.q1
    @SuppressLint({"UnknownNullness"})
    public void assertNotInLayoutOrScroll(String str) {
        if (this.mPendingSavedState == null) {
            super.assertNotInLayoutOrScroll(str);
        }
    }

    public void calculateExtraLayoutSpace(@NonNull f2 f2Var, @NonNull int[] iArr) {
        int i10;
        int extraLayoutSpace = getExtraLayoutSpace(f2Var);
        if (this.mLayoutState.f3876f == -1) {
            i10 = 0;
        } else {
            i10 = extraLayoutSpace;
            extraLayoutSpace = 0;
        }
        iArr[0] = extraLayoutSpace;
        iArr[1] = i10;
    }

    @Override // androidx.recyclerview.widget.q1
    public boolean canScrollHorizontally() {
        return this.mOrientation == 0;
    }

    @Override // androidx.recyclerview.widget.q1
    public boolean canScrollVertically() {
        return this.mOrientation == 1;
    }

    @Override // androidx.recyclerview.widget.q1
    @SuppressLint({"UnknownNullness"})
    public void collectAdjacentPrefetchPositions(int i10, int i11, f2 f2Var, o1 o1Var) {
        if (this.mOrientation != 0) {
            i10 = i11;
        }
        if (getChildCount() == 0 || i10 == 0) {
            return;
        }
        ensureLayoutState();
        y(i10 > 0 ? 1 : -1, Math.abs(i10), true, f2Var);
        collectPrefetchPositionsForLayoutState(f2Var, this.mLayoutState, o1Var);
    }

    @Override // androidx.recyclerview.widget.q1
    @SuppressLint({"UnknownNullness"})
    public void collectInitialPrefetchPositions(int i10, o1 o1Var) {
        boolean z10;
        int i11;
        s0 s0Var = this.mPendingSavedState;
        if (s0Var == null || (i11 = s0Var.f3889a) < 0) {
            x();
            z10 = this.mShouldReverseLayout;
            i11 = this.mPendingScrollPosition;
            if (i11 == -1) {
                i11 = z10 ? i10 - 1 : 0;
            }
        } else {
            z10 = s0Var.f3891c;
        }
        int i12 = z10 ? -1 : 1;
        for (int i13 = 0; i13 < this.mInitialPrefetchItemCount && i11 >= 0 && i11 < i10; i13++) {
            ((x) o1Var).a(i11, 0);
            i11 += i12;
        }
    }

    public void collectPrefetchPositionsForLayoutState(f2 f2Var, r0 r0Var, o1 o1Var) {
        int i10 = r0Var.f3874d;
        if (i10 < 0 || i10 >= f2Var.b()) {
            return;
        }
        ((x) o1Var).a(i10, Math.max(0, r0Var.f3877g));
    }

    @Override // androidx.recyclerview.widget.q1
    @SuppressLint({"UnknownNullness"})
    public int computeHorizontalScrollExtent(f2 f2Var) {
        return n(f2Var);
    }

    @Override // androidx.recyclerview.widget.q1
    @SuppressLint({"UnknownNullness"})
    public int computeHorizontalScrollOffset(f2 f2Var) {
        return o(f2Var);
    }

    @Override // androidx.recyclerview.widget.q1
    @SuppressLint({"UnknownNullness"})
    public int computeHorizontalScrollRange(f2 f2Var) {
        return p(f2Var);
    }

    @Override // androidx.recyclerview.widget.d2
    @SuppressLint({"UnknownNullness"})
    public PointF computeScrollVectorForPosition(int i10) {
        if (getChildCount() == 0) {
            return null;
        }
        int i11 = (i10 < getPosition(getChildAt(0))) != this.mShouldReverseLayout ? -1 : 1;
        return this.mOrientation == 0 ? new PointF(i11, 0.0f) : new PointF(0.0f, i11);
    }

    @Override // androidx.recyclerview.widget.q1
    @SuppressLint({"UnknownNullness"})
    public int computeVerticalScrollExtent(f2 f2Var) {
        return n(f2Var);
    }

    @Override // androidx.recyclerview.widget.q1
    @SuppressLint({"UnknownNullness"})
    public int computeVerticalScrollOffset(f2 f2Var) {
        return o(f2Var);
    }

    @Override // androidx.recyclerview.widget.q1
    @SuppressLint({"UnknownNullness"})
    public int computeVerticalScrollRange(f2 f2Var) {
        return p(f2Var);
    }

    public int convertFocusDirectionToLayoutDirection(int i10) {
        return i10 != 1 ? i10 != 2 ? i10 != 17 ? i10 != 33 ? i10 != 66 ? (i10 == 130 && this.mOrientation == 1) ? 1 : Integer.MIN_VALUE : this.mOrientation == 0 ? 1 : Integer.MIN_VALUE : this.mOrientation == 1 ? -1 : Integer.MIN_VALUE : this.mOrientation == 0 ? -1 : Integer.MIN_VALUE : (this.mOrientation != 1 && isLayoutRTL()) ? -1 : 1 : (this.mOrientation != 1 && isLayoutRTL()) ? 1 : -1;
    }

    public r0 createLayoutState() {
        r0 r0Var = new r0();
        r0Var.f3871a = true;
        r0Var.f3878h = 0;
        r0Var.f3879i = 0;
        r0Var.f3881k = null;
        return r0Var;
    }

    public void ensureLayoutState() {
        if (this.mLayoutState == null) {
            this.mLayoutState = createLayoutState();
        }
    }

    public int fill(y1 y1Var, r0 r0Var, f2 f2Var, boolean z10) {
        int i10;
        int i11 = r0Var.f3873c;
        int i12 = r0Var.f3877g;
        if (i12 != Integer.MIN_VALUE) {
            if (i11 < 0) {
                r0Var.f3877g = i12 + i11;
            }
            v(y1Var, r0Var);
        }
        int i13 = r0Var.f3873c + r0Var.f3878h;
        q0 q0Var = this.mLayoutChunkResult;
        while (true) {
            if ((!r0Var.f3882l && i13 <= 0) || (i10 = r0Var.f3874d) < 0 || i10 >= f2Var.b()) {
                break;
            }
            q0Var.f3862a = 0;
            q0Var.f3863b = false;
            q0Var.f3864c = false;
            q0Var.f3865d = false;
            layoutChunk(y1Var, f2Var, r0Var, q0Var);
            if (!q0Var.f3863b) {
                int i14 = r0Var.f3872b;
                int i15 = q0Var.f3862a;
                r0Var.f3872b = (r0Var.f3876f * i15) + i14;
                if (!q0Var.f3864c || r0Var.f3881k != null || !f2Var.f3706g) {
                    r0Var.f3873c -= i15;
                    i13 -= i15;
                }
                int i16 = r0Var.f3877g;
                if (i16 != Integer.MIN_VALUE) {
                    int i17 = i16 + i15;
                    r0Var.f3877g = i17;
                    int i18 = r0Var.f3873c;
                    if (i18 < 0) {
                        r0Var.f3877g = i17 + i18;
                    }
                    v(y1Var, r0Var);
                }
                if (z10 && q0Var.f3865d) {
                    break;
                }
            } else {
                break;
            }
        }
        return i11 - r0Var.f3873c;
    }

    public int findFirstCompletelyVisibleItemPosition() {
        View viewFindOneVisibleChild = findOneVisibleChild(0, getChildCount(), true, false);
        if (viewFindOneVisibleChild == null) {
            return -1;
        }
        return getPosition(viewFindOneVisibleChild);
    }

    public View findFirstVisibleChildClosestToEnd(boolean z10, boolean z11) {
        return this.mShouldReverseLayout ? findOneVisibleChild(0, getChildCount(), z10, z11) : findOneVisibleChild(getChildCount() - 1, -1, z10, z11);
    }

    public View findFirstVisibleChildClosestToStart(boolean z10, boolean z11) {
        return this.mShouldReverseLayout ? findOneVisibleChild(getChildCount() - 1, -1, z10, z11) : findOneVisibleChild(0, getChildCount(), z10, z11);
    }

    public int findFirstVisibleItemPosition() {
        View viewFindOneVisibleChild = findOneVisibleChild(0, getChildCount(), false, true);
        if (viewFindOneVisibleChild == null) {
            return -1;
        }
        return getPosition(viewFindOneVisibleChild);
    }

    public int findLastCompletelyVisibleItemPosition() {
        View viewFindOneVisibleChild = findOneVisibleChild(getChildCount() - 1, -1, true, false);
        if (viewFindOneVisibleChild == null) {
            return -1;
        }
        return getPosition(viewFindOneVisibleChild);
    }

    public int findLastVisibleItemPosition() {
        View viewFindOneVisibleChild = findOneVisibleChild(getChildCount() - 1, -1, false, true);
        if (viewFindOneVisibleChild == null) {
            return -1;
        }
        return getPosition(viewFindOneVisibleChild);
    }

    public View findOnePartiallyOrCompletelyInvisibleChild(int i10, int i11) {
        int i12;
        int i13;
        ensureLayoutState();
        if (i11 <= i10 && i11 >= i10) {
            return getChildAt(i10);
        }
        if (this.mOrientationHelper.g(getChildAt(i10)) < this.mOrientationHelper.k()) {
            i12 = 16644;
            i13 = 16388;
        } else {
            i12 = 4161;
            i13 = 4097;
        }
        return this.mOrientation == 0 ? this.mHorizontalBoundCheck.a(i10, i11, i12, i13) : this.mVerticalBoundCheck.a(i10, i11, i12, i13);
    }

    public View findOneVisibleChild(int i10, int i11, boolean z10, boolean z11) {
        ensureLayoutState();
        int i12 = z10 ? 24579 : 320;
        int i13 = z11 ? 320 : 0;
        return this.mOrientation == 0 ? this.mHorizontalBoundCheck.a(i10, i11, i12, i13) : this.mVerticalBoundCheck.a(i10, i11, i12, i13);
    }

    /* JADX WARN: Removed duplicated region for block: B:33:0x0073  */
    /* JADX WARN: Removed duplicated region for block: B:35:0x0077  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public View findReferenceChild(y1 y1Var, f2 f2Var, boolean z10, boolean z11) {
        int i10;
        int childCount;
        int i11;
        ensureLayoutState();
        int childCount2 = getChildCount();
        if (z11) {
            childCount = getChildCount() - 1;
            i10 = -1;
            i11 = -1;
        } else {
            i10 = childCount2;
            childCount = 0;
            i11 = 1;
        }
        int iB = f2Var.b();
        int iK = this.mOrientationHelper.k();
        int i12 = this.mOrientationHelper.i();
        View view = null;
        View view2 = null;
        View view3 = null;
        while (childCount != i10) {
            View childAt = getChildAt(childCount);
            int position = getPosition(childAt);
            int iG = this.mOrientationHelper.g(childAt);
            int iD = this.mOrientationHelper.d(childAt);
            if (position >= 0 && position < iB) {
                if (!((r1) childAt.getLayoutParams()).isItemRemoved()) {
                    boolean z12 = iD <= iK && iG < iK;
                    boolean z13 = iG >= i12 && iD > i12;
                    if (!z12 && !z13) {
                        return childAt;
                    }
                    if (z10) {
                        if (z13) {
                            view2 = childAt;
                        } else if (view == null) {
                            view = childAt;
                        }
                    } else if (!z12) {
                        if (view == null) {
                        }
                    }
                } else if (view3 == null) {
                    view3 = childAt;
                }
            }
            childCount += i11;
        }
        return view != null ? view : view2 != null ? view2 : view3;
    }

    @Override // androidx.recyclerview.widget.q1
    @SuppressLint({"UnknownNullness"})
    public View findViewByPosition(int i10) {
        int childCount = getChildCount();
        if (childCount == 0) {
            return null;
        }
        int position = i10 - getPosition(getChildAt(0));
        if (position >= 0 && position < childCount) {
            View childAt = getChildAt(position);
            if (getPosition(childAt) == i10) {
                return childAt;
            }
        }
        return super.findViewByPosition(i10);
    }

    @Override // androidx.recyclerview.widget.q1
    @SuppressLint({"UnknownNullness"})
    public r1 generateDefaultLayoutParams() {
        return new r1(-2, -2);
    }

    @Deprecated
    public int getExtraLayoutSpace(f2 f2Var) {
        if (f2Var.f3700a != -1) {
            return this.mOrientationHelper.l();
        }
        return 0;
    }

    public int getInitialPrefetchItemCount() {
        return this.mInitialPrefetchItemCount;
    }

    public int getOrientation() {
        return this.mOrientation;
    }

    public boolean getRecycleChildrenOnDetach() {
        return this.mRecycleChildrenOnDetach;
    }

    public boolean getReverseLayout() {
        return this.mReverseLayout;
    }

    public boolean getStackFromEnd() {
        return this.mStackFromEnd;
    }

    @Override // androidx.recyclerview.widget.q1
    public boolean isAutoMeasureEnabled() {
        return true;
    }

    public boolean isLayoutRTL() {
        return getLayoutDirection() == 1;
    }

    public boolean isSmoothScrollbarEnabled() {
        return this.mSmoothScrollbarEnabled;
    }

    public void layoutChunk(y1 y1Var, f2 f2Var, r0 r0Var, q0 q0Var) {
        int i10;
        int i11;
        int i12;
        int paddingLeft;
        int iF;
        View viewB = r0Var.b(y1Var);
        if (viewB == null) {
            q0Var.f3863b = true;
            return;
        }
        r1 r1Var = (r1) viewB.getLayoutParams();
        if (r0Var.f3881k == null) {
            if (this.mShouldReverseLayout == (r0Var.f3876f == -1)) {
                addView(viewB);
            } else {
                addView(viewB, 0);
            }
        } else {
            if (this.mShouldReverseLayout == (r0Var.f3876f == -1)) {
                addDisappearingView(viewB);
            } else {
                addDisappearingView(viewB, 0);
            }
        }
        measureChildWithMargins(viewB, 0, 0);
        q0Var.f3862a = this.mOrientationHelper.e(viewB);
        if (this.mOrientation == 1) {
            if (isLayoutRTL()) {
                iF = getWidth() - getPaddingRight();
                paddingLeft = iF - this.mOrientationHelper.f(viewB);
            } else {
                paddingLeft = getPaddingLeft();
                iF = this.mOrientationHelper.f(viewB) + paddingLeft;
            }
            if (r0Var.f3876f == -1) {
                int i13 = r0Var.f3872b;
                i12 = i13;
                i11 = iF;
                i10 = i13 - q0Var.f3862a;
            } else {
                int i14 = r0Var.f3872b;
                i10 = i14;
                i11 = iF;
                i12 = q0Var.f3862a + i14;
            }
        } else {
            int paddingTop = getPaddingTop();
            int iF2 = this.mOrientationHelper.f(viewB) + paddingTop;
            if (r0Var.f3876f == -1) {
                int i15 = r0Var.f3872b;
                i11 = i15;
                i10 = paddingTop;
                i12 = iF2;
                paddingLeft = i15 - q0Var.f3862a;
            } else {
                int i16 = r0Var.f3872b;
                i10 = paddingTop;
                i11 = q0Var.f3862a + i16;
                i12 = iF2;
                paddingLeft = i16;
            }
        }
        layoutDecoratedWithMargins(viewB, paddingLeft, i10, i11, i12);
        if (r1Var.isItemRemoved() || r1Var.isItemChanged()) {
            q0Var.f3864c = true;
        }
        q0Var.f3865d = viewB.hasFocusable();
    }

    public final int n(f2 f2Var) {
        if (getChildCount() == 0) {
            return 0;
        }
        ensureLayoutState();
        return nb.g.k(f2Var, this.mOrientationHelper, findFirstVisibleChildClosestToStart(!this.mSmoothScrollbarEnabled, true), findFirstVisibleChildClosestToEnd(!this.mSmoothScrollbarEnabled, true), this, this.mSmoothScrollbarEnabled);
    }

    public final int o(f2 f2Var) {
        if (getChildCount() == 0) {
            return 0;
        }
        ensureLayoutState();
        return nb.g.l(f2Var, this.mOrientationHelper, findFirstVisibleChildClosestToStart(!this.mSmoothScrollbarEnabled, true), findFirstVisibleChildClosestToEnd(!this.mSmoothScrollbarEnabled, true), this, this.mSmoothScrollbarEnabled, this.mShouldReverseLayout);
    }

    public void onAnchorReady(y1 y1Var, f2 f2Var, p0 p0Var, int i10) {
    }

    @Override // androidx.recyclerview.widget.q1
    @SuppressLint({"UnknownNullness"})
    public void onDetachedFromWindow(RecyclerView recyclerView, y1 y1Var) {
        onDetachedFromWindow(recyclerView);
        if (this.mRecycleChildrenOnDetach) {
            removeAndRecycleAllViews(y1Var);
            y1Var.f3968a.clear();
            y1Var.h();
        }
    }

    @Override // androidx.recyclerview.widget.q1
    @SuppressLint({"UnknownNullness"})
    public View onFocusSearchFailed(View view, int i10, y1 y1Var, f2 f2Var) {
        int iConvertFocusDirectionToLayoutDirection;
        x();
        if (getChildCount() == 0 || (iConvertFocusDirectionToLayoutDirection = convertFocusDirectionToLayoutDirection(i10)) == Integer.MIN_VALUE) {
            return null;
        }
        ensureLayoutState();
        y(iConvertFocusDirectionToLayoutDirection, (int) (this.mOrientationHelper.l() * MAX_SCROLL_FACTOR), false, f2Var);
        r0 r0Var = this.mLayoutState;
        r0Var.f3877g = Integer.MIN_VALUE;
        r0Var.f3871a = false;
        fill(y1Var, r0Var, f2Var, true);
        View viewFindOnePartiallyOrCompletelyInvisibleChild = iConvertFocusDirectionToLayoutDirection == -1 ? this.mShouldReverseLayout ? findOnePartiallyOrCompletelyInvisibleChild(getChildCount() - 1, -1) : findOnePartiallyOrCompletelyInvisibleChild(0, getChildCount()) : this.mShouldReverseLayout ? findOnePartiallyOrCompletelyInvisibleChild(0, getChildCount()) : findOnePartiallyOrCompletelyInvisibleChild(getChildCount() - 1, -1);
        View viewT = iConvertFocusDirectionToLayoutDirection == -1 ? t() : s();
        if (!viewT.hasFocusable()) {
            return viewFindOnePartiallyOrCompletelyInvisibleChild;
        }
        if (viewFindOnePartiallyOrCompletelyInvisibleChild == null) {
            return null;
        }
        return viewT;
    }

    @Override // androidx.recyclerview.widget.q1
    @SuppressLint({"UnknownNullness"})
    public void onInitializeAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
        super.onInitializeAccessibilityEvent(accessibilityEvent);
        if (getChildCount() > 0) {
            accessibilityEvent.setFromIndex(findFirstVisibleItemPosition());
            accessibilityEvent.setToIndex(findLastVisibleItemPosition());
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:116:0x01f2  */
    /* JADX WARN: Removed duplicated region for block: B:83:0x0175  */
    /* JADX WARN: Removed duplicated region for block: B:92:0x01a0  */
    @Override // androidx.recyclerview.widget.q1
    @SuppressLint({"UnknownNullness"})
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public void onLayoutChildren(y1 y1Var, f2 f2Var) {
        View viewFindReferenceChild;
        int i10;
        int paddingRight;
        int i11;
        int i12;
        int i13;
        int i14;
        int iQ;
        int i15;
        View viewFindViewByPosition;
        int iG;
        int i16;
        int i17;
        int i18 = -1;
        if (!(this.mPendingSavedState == null && this.mPendingScrollPosition == -1) && f2Var.b() == 0) {
            removeAndRecycleAllViews(y1Var);
            return;
        }
        s0 s0Var = this.mPendingSavedState;
        if (s0Var != null && (i17 = s0Var.f3889a) >= 0) {
            this.mPendingScrollPosition = i17;
        }
        ensureLayoutState();
        this.mLayoutState.f3871a = false;
        x();
        View focusedChild = getFocusedChild();
        p0 p0Var = this.mAnchorInfo;
        if (!p0Var.f3850e || this.mPendingScrollPosition != -1 || this.mPendingSavedState != null) {
            p0Var.d();
            p0 p0Var2 = this.mAnchorInfo;
            p0Var2.f3849d = this.mShouldReverseLayout ^ this.mStackFromEnd;
            if (f2Var.f3706g || (i10 = this.mPendingScrollPosition) == -1) {
                if (getChildCount() != 0) {
                    View focusedChild2 = getFocusedChild();
                    if (focusedChild2 != null) {
                        r1 r1Var = (r1) focusedChild2.getLayoutParams();
                        if (r1Var.isItemRemoved() || r1Var.getViewLayoutPosition() < 0 || r1Var.getViewLayoutPosition() >= f2Var.b()) {
                            boolean z10 = this.mLastStackFromEnd;
                            boolean z11 = this.mStackFromEnd;
                            if (z10 == z11 && (viewFindReferenceChild = findReferenceChild(y1Var, f2Var, p0Var2.f3849d, z11)) != null) {
                                p0Var2.b(getPosition(viewFindReferenceChild), viewFindReferenceChild);
                                if (!f2Var.f3706g && supportsPredictiveItemAnimations()) {
                                    int iG2 = this.mOrientationHelper.g(viewFindReferenceChild);
                                    int iD = this.mOrientationHelper.d(viewFindReferenceChild);
                                    int iK = this.mOrientationHelper.k();
                                    int i19 = this.mOrientationHelper.i();
                                    boolean z12 = iD <= iK && iG2 < iK;
                                    boolean z13 = iG2 >= i19 && iD > i19;
                                    if (z12 || z13) {
                                        if (p0Var2.f3849d) {
                                            iK = i19;
                                        }
                                        p0Var2.f3848c = iK;
                                    }
                                }
                            } else {
                                p0Var2.a();
                                p0Var2.f3847b = this.mStackFromEnd ? f2Var.b() - 1 : 0;
                            }
                        } else {
                            p0Var2.c(getPosition(focusedChild2), focusedChild2);
                        }
                        this.mAnchorInfo.f3850e = true;
                    }
                }
            } else if (i10 < 0 || i10 >= f2Var.b()) {
                this.mPendingScrollPosition = -1;
                this.mPendingScrollPositionOffset = Integer.MIN_VALUE;
                if (getChildCount() != 0) {
                }
            } else {
                int i20 = this.mPendingScrollPosition;
                p0Var2.f3847b = i20;
                s0 s0Var2 = this.mPendingSavedState;
                if (s0Var2 != null && s0Var2.f3889a >= 0) {
                    boolean z14 = s0Var2.f3891c;
                    p0Var2.f3849d = z14;
                    if (z14) {
                        p0Var2.f3848c = this.mOrientationHelper.i() - this.mPendingSavedState.f3890b;
                    } else {
                        p0Var2.f3848c = this.mOrientationHelper.k() + this.mPendingSavedState.f3890b;
                    }
                } else if (this.mPendingScrollPositionOffset == Integer.MIN_VALUE) {
                    View viewFindViewByPosition2 = findViewByPosition(i20);
                    if (viewFindViewByPosition2 == null) {
                        if (getChildCount() > 0) {
                            p0Var2.f3849d = (this.mPendingScrollPosition < getPosition(getChildAt(0))) == this.mShouldReverseLayout;
                        }
                        p0Var2.a();
                    } else if (this.mOrientationHelper.e(viewFindViewByPosition2) > this.mOrientationHelper.l()) {
                        p0Var2.a();
                    } else if (this.mOrientationHelper.g(viewFindViewByPosition2) - this.mOrientationHelper.k() < 0) {
                        p0Var2.f3848c = this.mOrientationHelper.k();
                        p0Var2.f3849d = false;
                    } else if (this.mOrientationHelper.i() - this.mOrientationHelper.d(viewFindViewByPosition2) < 0) {
                        p0Var2.f3848c = this.mOrientationHelper.i();
                        p0Var2.f3849d = true;
                    } else {
                        p0Var2.f3848c = p0Var2.f3849d ? this.mOrientationHelper.m() + this.mOrientationHelper.d(viewFindViewByPosition2) : this.mOrientationHelper.g(viewFindViewByPosition2);
                    }
                } else {
                    boolean z15 = this.mShouldReverseLayout;
                    p0Var2.f3849d = z15;
                    if (z15) {
                        p0Var2.f3848c = this.mOrientationHelper.i() - this.mPendingScrollPositionOffset;
                    } else {
                        p0Var2.f3848c = this.mOrientationHelper.k() + this.mPendingScrollPositionOffset;
                    }
                }
                this.mAnchorInfo.f3850e = true;
            }
        } else if (focusedChild != null && (this.mOrientationHelper.g(focusedChild) >= this.mOrientationHelper.i() || this.mOrientationHelper.d(focusedChild) <= this.mOrientationHelper.k())) {
            this.mAnchorInfo.c(getPosition(focusedChild), focusedChild);
        }
        r0 r0Var = this.mLayoutState;
        r0Var.f3876f = r0Var.f3880j >= 0 ? 1 : -1;
        int[] iArr = this.mReusableIntPair;
        iArr[0] = 0;
        iArr[1] = 0;
        calculateExtraLayoutSpace(f2Var, iArr);
        int iK2 = this.mOrientationHelper.k() + Math.max(0, this.mReusableIntPair[0]);
        int iMax = Math.max(0, this.mReusableIntPair[1]);
        w0 w0Var = (w0) this.mOrientationHelper;
        int i21 = w0Var.f3942d;
        q1 q1Var = w0Var.f3953a;
        switch (i21) {
            case 0:
                paddingRight = q1Var.getPaddingRight();
                break;
            default:
                paddingRight = q1Var.getPaddingBottom();
                break;
        }
        int i22 = paddingRight + iMax;
        if (f2Var.f3706g && (i15 = this.mPendingScrollPosition) != -1 && this.mPendingScrollPositionOffset != Integer.MIN_VALUE && (viewFindViewByPosition = findViewByPosition(i15)) != null) {
            if (this.mShouldReverseLayout) {
                i16 = this.mOrientationHelper.i() - this.mOrientationHelper.d(viewFindViewByPosition);
                iG = this.mPendingScrollPositionOffset;
            } else {
                iG = this.mOrientationHelper.g(viewFindViewByPosition) - this.mOrientationHelper.k();
                i16 = this.mPendingScrollPositionOffset;
            }
            int i23 = i16 - iG;
            if (i23 > 0) {
                iK2 += i23;
            } else {
                i22 -= i23;
            }
        }
        p0 p0Var3 = this.mAnchorInfo;
        if (!p0Var3.f3849d ? !this.mShouldReverseLayout : this.mShouldReverseLayout) {
            i18 = 1;
        }
        onAnchorReady(y1Var, f2Var, p0Var3, i18);
        detachAndScrapAttachedViews(y1Var);
        this.mLayoutState.f3882l = resolveIsInfinite();
        this.mLayoutState.getClass();
        this.mLayoutState.f3879i = 0;
        p0 p0Var4 = this.mAnchorInfo;
        if (p0Var4.f3849d) {
            A(p0Var4.f3847b, p0Var4.f3848c);
            r0 r0Var2 = this.mLayoutState;
            r0Var2.f3878h = iK2;
            fill(y1Var, r0Var2, f2Var, false);
            r0 r0Var3 = this.mLayoutState;
            i12 = r0Var3.f3872b;
            int i24 = r0Var3.f3874d;
            int i25 = r0Var3.f3873c;
            if (i25 > 0) {
                i22 += i25;
            }
            p0 p0Var5 = this.mAnchorInfo;
            z(p0Var5.f3847b, p0Var5.f3848c);
            r0 r0Var4 = this.mLayoutState;
            r0Var4.f3878h = i22;
            r0Var4.f3874d += r0Var4.f3875e;
            fill(y1Var, r0Var4, f2Var, false);
            r0 r0Var5 = this.mLayoutState;
            i11 = r0Var5.f3872b;
            int i26 = r0Var5.f3873c;
            if (i26 > 0) {
                A(i24, i12);
                r0 r0Var6 = this.mLayoutState;
                r0Var6.f3878h = i26;
                fill(y1Var, r0Var6, f2Var, false);
                i12 = this.mLayoutState.f3872b;
            }
        } else {
            z(p0Var4.f3847b, p0Var4.f3848c);
            r0 r0Var7 = this.mLayoutState;
            r0Var7.f3878h = i22;
            fill(y1Var, r0Var7, f2Var, false);
            r0 r0Var8 = this.mLayoutState;
            i11 = r0Var8.f3872b;
            int i27 = r0Var8.f3874d;
            int i28 = r0Var8.f3873c;
            if (i28 > 0) {
                iK2 += i28;
            }
            p0 p0Var6 = this.mAnchorInfo;
            A(p0Var6.f3847b, p0Var6.f3848c);
            r0 r0Var9 = this.mLayoutState;
            r0Var9.f3878h = iK2;
            r0Var9.f3874d += r0Var9.f3875e;
            fill(y1Var, r0Var9, f2Var, false);
            r0 r0Var10 = this.mLayoutState;
            int i29 = r0Var10.f3872b;
            int i30 = r0Var10.f3873c;
            if (i30 > 0) {
                z(i27, i11);
                r0 r0Var11 = this.mLayoutState;
                r0Var11.f3878h = i30;
                fill(y1Var, r0Var11, f2Var, false);
                i11 = this.mLayoutState.f3872b;
            }
            i12 = i29;
        }
        if (getChildCount() > 0) {
            if (this.mShouldReverseLayout ^ this.mStackFromEnd) {
                int iQ2 = q(i11, y1Var, f2Var, true);
                i13 = i12 + iQ2;
                i14 = i11 + iQ2;
                iQ = r(i13, y1Var, f2Var, false);
            } else {
                int iR = r(i12, y1Var, f2Var, true);
                i13 = i12 + iR;
                i14 = i11 + iR;
                iQ = q(i14, y1Var, f2Var, false);
            }
            i12 = i13 + iQ;
            i11 = i14 + iQ;
        }
        if (f2Var.f3710k && getChildCount() != 0 && !f2Var.f3706g && supportsPredictiveItemAnimations()) {
            List list = y1Var.f3971d;
            int size = list.size();
            int position = getPosition(getChildAt(0));
            int iE = 0;
            int iE2 = 0;
            for (int i31 = 0; i31 < size; i31++) {
                j2 j2Var = (j2) list.get(i31);
                if (!j2Var.isRemoved()) {
                    if ((j2Var.getLayoutPosition() < position) != this.mShouldReverseLayout) {
                        iE += this.mOrientationHelper.e(j2Var.itemView);
                    } else {
                        iE2 += this.mOrientationHelper.e(j2Var.itemView);
                    }
                }
            }
            this.mLayoutState.f3881k = list;
            if (iE > 0) {
                A(getPosition(t()), i12);
                r0 r0Var12 = this.mLayoutState;
                r0Var12.f3878h = iE;
                r0Var12.f3873c = 0;
                r0Var12.a(null);
                fill(y1Var, this.mLayoutState, f2Var, false);
            }
            if (iE2 > 0) {
                z(getPosition(s()), i11);
                r0 r0Var13 = this.mLayoutState;
                r0Var13.f3878h = iE2;
                r0Var13.f3873c = 0;
                r0Var13.a(null);
                fill(y1Var, this.mLayoutState, f2Var, false);
            }
            this.mLayoutState.f3881k = null;
        }
        if (f2Var.f3706g) {
            this.mAnchorInfo.d();
        } else {
            x0 x0Var = this.mOrientationHelper;
            x0Var.f3954b = x0Var.l();
        }
        this.mLastStackFromEnd = this.mStackFromEnd;
    }

    @Override // androidx.recyclerview.widget.q1
    @SuppressLint({"UnknownNullness"})
    public void onLayoutCompleted(f2 f2Var) {
        super.onLayoutCompleted(f2Var);
        this.mPendingSavedState = null;
        this.mPendingScrollPosition = -1;
        this.mPendingScrollPositionOffset = Integer.MIN_VALUE;
        this.mAnchorInfo.d();
    }

    @Override // androidx.recyclerview.widget.q1
    @SuppressLint({"UnknownNullness"})
    public void onRestoreInstanceState(Parcelable parcelable) {
        if (parcelable instanceof s0) {
            s0 s0Var = (s0) parcelable;
            this.mPendingSavedState = s0Var;
            if (this.mPendingScrollPosition != -1) {
                s0Var.f3889a = -1;
            }
            requestLayout();
        }
    }

    @Override // androidx.recyclerview.widget.q1
    @SuppressLint({"UnknownNullness"})
    public Parcelable onSaveInstanceState() {
        s0 s0Var = this.mPendingSavedState;
        if (s0Var != null) {
            s0 s0Var2 = new s0();
            s0Var2.f3889a = s0Var.f3889a;
            s0Var2.f3890b = s0Var.f3890b;
            s0Var2.f3891c = s0Var.f3891c;
            return s0Var2;
        }
        s0 s0Var3 = new s0();
        if (getChildCount() > 0) {
            ensureLayoutState();
            boolean z10 = this.mLastStackFromEnd ^ this.mShouldReverseLayout;
            s0Var3.f3891c = z10;
            if (z10) {
                View viewS = s();
                s0Var3.f3890b = this.mOrientationHelper.i() - this.mOrientationHelper.d(viewS);
                s0Var3.f3889a = getPosition(viewS);
            } else {
                View viewT = t();
                s0Var3.f3889a = getPosition(viewT);
                s0Var3.f3890b = this.mOrientationHelper.g(viewT) - this.mOrientationHelper.k();
            }
        } else {
            s0Var3.f3889a = -1;
        }
        return s0Var3;
    }

    public final int p(f2 f2Var) {
        if (getChildCount() == 0) {
            return 0;
        }
        ensureLayoutState();
        return nb.g.m(f2Var, this.mOrientationHelper, findFirstVisibleChildClosestToStart(!this.mSmoothScrollbarEnabled, true), findFirstVisibleChildClosestToEnd(!this.mSmoothScrollbarEnabled, true), this, this.mSmoothScrollbarEnabled);
    }

    @Override // androidx.recyclerview.widget.m0
    public void prepareForDrop(@NonNull View view, @NonNull View view2, int i10, int i11) {
        assertNotInLayoutOrScroll("Cannot drop a view during a scroll or layout calculation");
        ensureLayoutState();
        x();
        int position = getPosition(view);
        int position2 = getPosition(view2);
        byte b10 = position < position2 ? (byte) 1 : (byte) -1;
        if (this.mShouldReverseLayout) {
            if (b10 == 1) {
                scrollToPositionWithOffset(position2, this.mOrientationHelper.i() - (this.mOrientationHelper.e(view) + this.mOrientationHelper.g(view2)));
                return;
            } else {
                scrollToPositionWithOffset(position2, this.mOrientationHelper.i() - this.mOrientationHelper.d(view2));
                return;
            }
        }
        if (b10 == -1) {
            scrollToPositionWithOffset(position2, this.mOrientationHelper.g(view2));
        } else {
            scrollToPositionWithOffset(position2, this.mOrientationHelper.d(view2) - this.mOrientationHelper.e(view));
        }
    }

    public final int q(int i10, y1 y1Var, f2 f2Var, boolean z10) {
        int i11;
        int i12 = this.mOrientationHelper.i() - i10;
        if (i12 <= 0) {
            return 0;
        }
        int i13 = -scrollBy(-i12, y1Var, f2Var);
        int i14 = i10 + i13;
        if (!z10 || (i11 = this.mOrientationHelper.i() - i14) <= 0) {
            return i13;
        }
        this.mOrientationHelper.p(i11);
        return i11 + i13;
    }

    public final int r(int i10, y1 y1Var, f2 f2Var, boolean z10) {
        int iK;
        int iK2 = i10 - this.mOrientationHelper.k();
        if (iK2 <= 0) {
            return 0;
        }
        int i11 = -scrollBy(iK2, y1Var, f2Var);
        int i12 = i10 + i11;
        if (!z10 || (iK = i12 - this.mOrientationHelper.k()) <= 0) {
            return i11;
        }
        this.mOrientationHelper.p(-iK);
        return i11 - iK;
    }

    public boolean resolveIsInfinite() {
        return this.mOrientationHelper.j() == 0 && this.mOrientationHelper.h() == 0;
    }

    public final View s() {
        return getChildAt(this.mShouldReverseLayout ? 0 : getChildCount() - 1);
    }

    public int scrollBy(int i10, y1 y1Var, f2 f2Var) {
        if (getChildCount() == 0 || i10 == 0) {
            return 0;
        }
        ensureLayoutState();
        this.mLayoutState.f3871a = true;
        int i11 = i10 > 0 ? 1 : -1;
        int iAbs = Math.abs(i10);
        y(i11, iAbs, true, f2Var);
        r0 r0Var = this.mLayoutState;
        int iFill = fill(y1Var, r0Var, f2Var, false) + r0Var.f3877g;
        if (iFill < 0) {
            return 0;
        }
        if (iAbs > iFill) {
            i10 = i11 * iFill;
        }
        this.mOrientationHelper.p(-i10);
        this.mLayoutState.f3880j = i10;
        return i10;
    }

    @Override // androidx.recyclerview.widget.q1
    @SuppressLint({"UnknownNullness"})
    public int scrollHorizontallyBy(int i10, y1 y1Var, f2 f2Var) {
        if (this.mOrientation == 1) {
            return 0;
        }
        return scrollBy(i10, y1Var, f2Var);
    }

    @Override // androidx.recyclerview.widget.q1
    public void scrollToPosition(int i10) {
        this.mPendingScrollPosition = i10;
        this.mPendingScrollPositionOffset = Integer.MIN_VALUE;
        s0 s0Var = this.mPendingSavedState;
        if (s0Var != null) {
            s0Var.f3889a = -1;
        }
        requestLayout();
    }

    public void scrollToPositionWithOffset(int i10, int i11) {
        this.mPendingScrollPosition = i10;
        this.mPendingScrollPositionOffset = i11;
        s0 s0Var = this.mPendingSavedState;
        if (s0Var != null) {
            s0Var.f3889a = -1;
        }
        requestLayout();
    }

    @Override // androidx.recyclerview.widget.q1
    @SuppressLint({"UnknownNullness"})
    public int scrollVerticallyBy(int i10, y1 y1Var, f2 f2Var) {
        if (this.mOrientation == 0) {
            return 0;
        }
        return scrollBy(i10, y1Var, f2Var);
    }

    public void setInitialPrefetchItemCount(int i10) {
        this.mInitialPrefetchItemCount = i10;
    }

    public void setOrientation(int i10) {
        if (i10 != 0 && i10 != 1) {
            throw new IllegalArgumentException(com.google.android.gms.measurement.internal.u1.g("invalid orientation:", i10));
        }
        assertNotInLayoutOrScroll(null);
        if (i10 != this.mOrientation || this.mOrientationHelper == null) {
            w0 w0VarB = x0.b(this, i10);
            this.mOrientationHelper = w0VarB;
            this.mAnchorInfo.f3846a = w0VarB;
            this.mOrientation = i10;
            requestLayout();
        }
    }

    public void setRecycleChildrenOnDetach(boolean z10) {
        this.mRecycleChildrenOnDetach = z10;
    }

    public void setReverseLayout(boolean z10) {
        assertNotInLayoutOrScroll(null);
        if (z10 == this.mReverseLayout) {
            return;
        }
        this.mReverseLayout = z10;
        requestLayout();
    }

    public void setSmoothScrollbarEnabled(boolean z10) {
        this.mSmoothScrollbarEnabled = z10;
    }

    public void setStackFromEnd(boolean z10) {
        assertNotInLayoutOrScroll(null);
        if (this.mStackFromEnd == z10) {
            return;
        }
        this.mStackFromEnd = z10;
        requestLayout();
    }

    @Override // androidx.recyclerview.widget.q1
    public boolean shouldMeasureTwice() {
        return (getHeightMode() == 1073741824 || getWidthMode() == 1073741824 || !hasFlexibleChildInBothOrientations()) ? false : true;
    }

    @Override // androidx.recyclerview.widget.q1
    @SuppressLint({"UnknownNullness"})
    public void smoothScrollToPosition(RecyclerView recyclerView, f2 f2Var, int i10) {
        t0 t0Var = new t0(recyclerView.getContext());
        t0Var.setTargetPosition(i10);
        startSmoothScroll(t0Var);
    }

    @Override // androidx.recyclerview.widget.q1
    public boolean supportsPredictiveItemAnimations() {
        return this.mPendingSavedState == null && this.mLastStackFromEnd == this.mStackFromEnd;
    }

    public final View t() {
        return getChildAt(this.mShouldReverseLayout ? getChildCount() - 1 : 0);
    }

    public final void u() {
        for (int i10 = 0; i10 < getChildCount(); i10++) {
            View childAt = getChildAt(i10);
            getPosition(childAt);
            this.mOrientationHelper.g(childAt);
        }
    }

    public final void v(y1 y1Var, r0 r0Var) {
        if (!r0Var.f3871a || r0Var.f3882l) {
            return;
        }
        int i10 = r0Var.f3877g;
        int i11 = r0Var.f3879i;
        if (r0Var.f3876f == -1) {
            int childCount = getChildCount();
            if (i10 < 0) {
                return;
            }
            int iH = (this.mOrientationHelper.h() - i10) + i11;
            if (this.mShouldReverseLayout) {
                for (int i12 = 0; i12 < childCount; i12++) {
                    View childAt = getChildAt(i12);
                    if (this.mOrientationHelper.g(childAt) < iH || this.mOrientationHelper.o(childAt) < iH) {
                        w(0, y1Var, i12);
                        return;
                    }
                }
                return;
            }
            int i13 = childCount - 1;
            for (int i14 = i13; i14 >= 0; i14--) {
                View childAt2 = getChildAt(i14);
                if (this.mOrientationHelper.g(childAt2) < iH || this.mOrientationHelper.o(childAt2) < iH) {
                    w(i13, y1Var, i14);
                    return;
                }
            }
            return;
        }
        if (i10 < 0) {
            return;
        }
        int i15 = i10 - i11;
        int childCount2 = getChildCount();
        if (!this.mShouldReverseLayout) {
            for (int i16 = 0; i16 < childCount2; i16++) {
                View childAt3 = getChildAt(i16);
                if (this.mOrientationHelper.d(childAt3) > i15 || this.mOrientationHelper.n(childAt3) > i15) {
                    w(0, y1Var, i16);
                    return;
                }
            }
            return;
        }
        int i17 = childCount2 - 1;
        for (int i18 = i17; i18 >= 0; i18--) {
            View childAt4 = getChildAt(i18);
            if (this.mOrientationHelper.d(childAt4) > i15 || this.mOrientationHelper.n(childAt4) > i15) {
                w(i17, y1Var, i18);
                return;
            }
        }
    }

    public void validateChildOrder() {
        getChildCount();
        if (getChildCount() < 1) {
            return;
        }
        int position = getPosition(getChildAt(0));
        int iG = this.mOrientationHelper.g(getChildAt(0));
        if (this.mShouldReverseLayout) {
            for (int i10 = 1; i10 < getChildCount(); i10++) {
                View childAt = getChildAt(i10);
                int position2 = getPosition(childAt);
                int iG2 = this.mOrientationHelper.g(childAt);
                if (position2 < position) {
                    u();
                    StringBuilder sb = new StringBuilder("detected invalid position. loc invalid? ");
                    sb.append(iG2 < iG);
                    throw new RuntimeException(sb.toString());
                }
                if (iG2 > iG) {
                    u();
                    throw new RuntimeException("detected invalid location");
                }
            }
            return;
        }
        for (int i11 = 1; i11 < getChildCount(); i11++) {
            View childAt2 = getChildAt(i11);
            int position3 = getPosition(childAt2);
            int iG3 = this.mOrientationHelper.g(childAt2);
            if (position3 < position) {
                u();
                StringBuilder sb2 = new StringBuilder("detected invalid position. loc invalid? ");
                sb2.append(iG3 < iG);
                throw new RuntimeException(sb2.toString());
            }
            if (iG3 < iG) {
                u();
                throw new RuntimeException("detected invalid location");
            }
        }
    }

    public final void w(int i10, y1 y1Var, int i11) {
        if (i10 == i11) {
            return;
        }
        if (i11 <= i10) {
            while (i10 > i11) {
                removeAndRecycleViewAt(i10, y1Var);
                i10--;
            }
        } else {
            for (int i12 = i11 - 1; i12 >= i10; i12--) {
                removeAndRecycleViewAt(i12, y1Var);
            }
        }
    }

    public final void x() {
        if (this.mOrientation == 1 || !isLayoutRTL()) {
            this.mShouldReverseLayout = this.mReverseLayout;
        } else {
            this.mShouldReverseLayout = !this.mReverseLayout;
        }
    }

    public final void y(int i10, int i11, boolean z10, f2 f2Var) {
        int iK;
        int paddingRight;
        this.mLayoutState.f3882l = resolveIsInfinite();
        this.mLayoutState.f3876f = i10;
        int[] iArr = this.mReusableIntPair;
        iArr[0] = 0;
        iArr[1] = 0;
        calculateExtraLayoutSpace(f2Var, iArr);
        int iMax = Math.max(0, this.mReusableIntPair[0]);
        int iMax2 = Math.max(0, this.mReusableIntPair[1]);
        boolean z11 = i10 == 1;
        r0 r0Var = this.mLayoutState;
        int i12 = z11 ? iMax2 : iMax;
        r0Var.f3878h = i12;
        if (!z11) {
            iMax = iMax2;
        }
        r0Var.f3879i = iMax;
        if (z11) {
            w0 w0Var = (w0) this.mOrientationHelper;
            int i13 = w0Var.f3942d;
            q1 q1Var = w0Var.f3953a;
            switch (i13) {
                case 0:
                    paddingRight = q1Var.getPaddingRight();
                    break;
                default:
                    paddingRight = q1Var.getPaddingBottom();
                    break;
            }
            r0Var.f3878h = paddingRight + i12;
            View viewS = s();
            r0 r0Var2 = this.mLayoutState;
            r0Var2.f3875e = this.mShouldReverseLayout ? -1 : 1;
            int position = getPosition(viewS);
            r0 r0Var3 = this.mLayoutState;
            r0Var2.f3874d = position + r0Var3.f3875e;
            r0Var3.f3872b = this.mOrientationHelper.d(viewS);
            iK = this.mOrientationHelper.d(viewS) - this.mOrientationHelper.i();
        } else {
            View viewT = t();
            r0 r0Var4 = this.mLayoutState;
            r0Var4.f3878h = this.mOrientationHelper.k() + r0Var4.f3878h;
            r0 r0Var5 = this.mLayoutState;
            r0Var5.f3875e = this.mShouldReverseLayout ? 1 : -1;
            int position2 = getPosition(viewT);
            r0 r0Var6 = this.mLayoutState;
            r0Var5.f3874d = position2 + r0Var6.f3875e;
            r0Var6.f3872b = this.mOrientationHelper.g(viewT);
            iK = (-this.mOrientationHelper.g(viewT)) + this.mOrientationHelper.k();
        }
        r0 r0Var7 = this.mLayoutState;
        r0Var7.f3873c = i11;
        if (z10) {
            r0Var7.f3873c = i11 - iK;
        }
        r0Var7.f3877g = iK;
    }

    public final void z(int i10, int i11) {
        this.mLayoutState.f3873c = this.mOrientationHelper.i() - i11;
        r0 r0Var = this.mLayoutState;
        r0Var.f3875e = this.mShouldReverseLayout ? -1 : 1;
        r0Var.f3874d = i10;
        r0Var.f3876f = 1;
        r0Var.f3872b = i11;
        r0Var.f3877g = Integer.MIN_VALUE;
    }

    public LinearLayoutManager(int i10, boolean z10) {
        this.mOrientation = 1;
        this.mReverseLayout = false;
        this.mShouldReverseLayout = false;
        this.mStackFromEnd = false;
        this.mSmoothScrollbarEnabled = true;
        this.mPendingScrollPosition = -1;
        this.mPendingScrollPositionOffset = Integer.MIN_VALUE;
        this.mPendingSavedState = null;
        this.mAnchorInfo = new p0();
        this.mLayoutChunkResult = new q0();
        this.mInitialPrefetchItemCount = 2;
        this.mReusableIntPair = new int[2];
        setOrientation(i10);
        setReverseLayout(z10);
    }

    @SuppressLint({"UnknownNullness"})
    public LinearLayoutManager(Context context, AttributeSet attributeSet, int i10, int i11) {
        this.mOrientation = 1;
        this.mReverseLayout = false;
        this.mShouldReverseLayout = false;
        this.mStackFromEnd = false;
        this.mSmoothScrollbarEnabled = true;
        this.mPendingScrollPosition = -1;
        this.mPendingScrollPositionOffset = Integer.MIN_VALUE;
        this.mPendingSavedState = null;
        this.mAnchorInfo = new p0();
        this.mLayoutChunkResult = new q0();
        this.mInitialPrefetchItemCount = 2;
        this.mReusableIntPair = new int[2];
        p1 properties = q1.getProperties(context, attributeSet, i10, i11);
        setOrientation(properties.f3851a);
        setReverseLayout(properties.f3853c);
        setStackFromEnd(properties.f3854d);
    }
}
