package androidx.recyclerview.widget;

import android.R;
import android.animation.LayoutTransition;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.os.Build;
import android.os.Parcelable;
import android.os.SystemClock;
import android.os.Trace;
import android.util.AttributeSet;
import android.util.SparseArray;
import android.view.Display;
import android.view.FocusFinder;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.animation.Interpolator;
import android.widget.EdgeEffect;
import android.widget.OverScroller;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.Px;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.ref.WeakReference;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.WeakHashMap;

/* JADX INFO: loaded from: classes.dex */
public class RecyclerView extends ViewGroup implements androidx.core.view.q0, androidx.core.view.d0, androidx.core.view.e0 {
    static final int DEFAULT_ORIENTATION = 1;
    static final boolean DISPATCH_TEMP_DETACH = false;
    private static final float FLING_DESTRETCH_FACTOR = 4.0f;
    static final long FOREVER_NS = Long.MAX_VALUE;
    public static final int HORIZONTAL = 0;
    private static final float INFLEXION = 0.35f;
    private static final int INVALID_POINTER = -1;
    public static final int INVALID_TYPE = -1;
    private static final Class<?>[] LAYOUT_MANAGER_CONSTRUCTOR_SIGNATURE;
    static final int MAX_SCROLL_DURATION = 2000;
    public static final long NO_ID = -1;
    public static final int NO_POSITION = -1;
    private static final float SCROLL_FRICTION = 0.015f;
    public static final int SCROLL_STATE_DRAGGING = 1;
    public static final int SCROLL_STATE_IDLE = 0;
    public static final int SCROLL_STATE_SETTLING = 2;
    static final String TAG = "RecyclerView";
    public static final int TOUCH_SLOP_DEFAULT = 0;
    public static final int TOUCH_SLOP_PAGING = 1;
    static final String TRACE_BIND_VIEW_TAG = "RV OnBindView";
    static final String TRACE_CREATE_VIEW_TAG = "RV CreateView";
    private static final String TRACE_HANDLE_ADAPTER_UPDATES_TAG = "RV PartialInvalidate";
    static final String TRACE_NESTED_PREFETCH_TAG = "RV Nested Prefetch";
    private static final String TRACE_ON_DATA_SET_CHANGE_LAYOUT_TAG = "RV FullInvalidate";
    private static final String TRACE_ON_LAYOUT_TAG = "RV OnLayout";
    static final String TRACE_PREFETCH_TAG = "RV Prefetch";
    static final String TRACE_SCROLL_TAG = "RV Scroll";
    public static final int UNDEFINED_DURATION = Integer.MIN_VALUE;
    static final boolean VERBOSE_TRACING = false;
    public static final int VERTICAL = 1;
    static boolean sDebugAssertionsEnabled = false;
    static final g2 sDefaultEdgeEffectFactory;
    static final Interpolator sQuinticInterpolator;
    static boolean sVerboseLoggingEnabled = false;
    l2 mAccessibilityDelegate;
    private final AccessibilityManager mAccessibilityManager;
    d1 mAdapter;
    c mAdapterHelper;
    boolean mAdapterUpdateDuringMeasure;
    private EdgeEffect mBottomGlow;
    private g1 mChildDrawingOrderCallback;
    f mChildHelper;
    boolean mClipToPadding;
    boolean mDataSetHasChangedAfterLayout;
    boolean mDispatchItemsChangedEvent;
    private int mDispatchScrollCounter;
    private int mEatenAccessibilityChangeFlags;

    @NonNull
    private h1 mEdgeEffectFactory;
    boolean mEnableFastScroller;

    @VisibleForTesting
    boolean mFirstLayoutComplete;
    z mGapWorker;
    boolean mHasFixedSize;
    private boolean mIgnoreMotionEventTillDown;
    private int mInitialTouchX;
    private int mInitialTouchY;
    private int mInterceptRequestLayoutDepth;
    private u1 mInterceptingOnItemTouchListener;
    boolean mIsAttached;
    l1 mItemAnimator;
    private j1 mItemAnimatorListener;
    private Runnable mItemAnimatorRunner;
    final ArrayList<m1> mItemDecorations;
    boolean mItemsAddedOrRemoved;
    boolean mItemsChanged;
    private int mLastAutoMeasureNonExactMeasuredHeight;
    private int mLastAutoMeasureNonExactMeasuredWidth;
    private boolean mLastAutoMeasureSkippedDueToExact;
    private int mLastTouchX;
    private int mLastTouchY;

    @VisibleForTesting
    q1 mLayout;
    private int mLayoutOrScrollCounter;
    boolean mLayoutSuppressed;
    boolean mLayoutWasDefered;
    private EdgeEffect mLeftGlow;
    private final int mMaxFlingVelocity;
    private final int mMinFlingVelocity;
    private final int[] mMinMaxLayoutPositions;
    private final int[] mNestedOffsets;
    private final a2 mObserver;
    private List<s1> mOnChildAttachStateListeners;
    private t1 mOnFlingListener;
    private final ArrayList<u1> mOnItemTouchListeners;

    @VisibleForTesting
    final List<j2> mPendingAccessibilityImportanceChange;
    b2 mPendingSavedState;
    private final float mPhysicalCoef;
    boolean mPostedAnimatorRunner;
    x mPrefetchRegistry;
    private boolean mPreserveFocusAfterLayout;
    final y1 mRecycler;
    z1 mRecyclerListener;
    final List<z1> mRecyclerListeners;
    final int[] mReusableIntPair;
    private EdgeEffect mRightGlow;
    private float mScaledHorizontalScrollFactor;
    private float mScaledVerticalScrollFactor;
    private v1 mScrollListener;
    private List<v1> mScrollListeners;
    private final int[] mScrollOffset;
    private int mScrollPointerId;
    private int mScrollState;
    private androidx.core.view.g0 mScrollingChildHelper;
    final f2 mState;
    final Rect mTempRect;
    private final Rect mTempRect2;
    final RectF mTempRectF;
    private EdgeEffect mTopGlow;
    private int mTouchSlop;
    final Runnable mUpdateChildViewsRunnable;
    private VelocityTracker mVelocityTracker;
    final i2 mViewFlinger;
    private final y2 mViewInfoProcessCallback;
    final z2 mViewInfoStore;
    private static final int[] NESTED_SCROLLING_ATTRS = {R.attr.nestedScrollingEnabled};
    private static final float DECELERATION_RATE = (float) (Math.log(0.78d) / Math.log(0.9d));
    static final boolean FORCE_INVALIDATE_DISPLAY_LIST = false;
    static final boolean ALLOW_SIZE_IN_UNSPECIFIED_SPEC = true;
    static final boolean POST_UPDATES_ON_ANIMATION = true;
    static final boolean ALLOW_THREAD_GAP_WORK = true;
    private static final boolean FORCE_ABS_FOCUS_SEARCH_DIRECTION = false;
    private static final boolean IGNORE_DETACHED_FOCUSED_CHILD = false;

    @Retention(RetentionPolicy.SOURCE)
    @RestrictTo({RestrictTo.Scope.f557c})
    public @interface Orientation {
    }

    static {
        Class<?> cls = Integer.TYPE;
        LAYOUT_MANAGER_CONSTRUCTOR_SIGNATURE = new Class[]{Context.class, AttributeSet.class, cls, cls};
        sQuinticInterpolator = new y0.g(3);
        sDefaultEdgeEffectFactory = new g2();
    }

    public RecyclerView(@NonNull Context context) {
        this(context, null);
    }

    public static int b(int i10, EdgeEffect edgeEffect, EdgeEffect edgeEffect2, int i11) {
        if (i10 > 0 && edgeEffect != null && u0.h.a(edgeEffect) != 0.0f) {
            int iRound = Math.round(u0.h.b(edgeEffect, ((-i10) * FLING_DESTRETCH_FACTOR) / i11, 0.5f) * ((-i11) / FLING_DESTRETCH_FACTOR));
            if (iRound != i10) {
                edgeEffect.finish();
            }
            return i10 - iRound;
        }
        if (i10 >= 0 || edgeEffect2 == null || u0.h.a(edgeEffect2) == 0.0f) {
            return i10;
        }
        float f10 = i11;
        int iRound2 = Math.round(u0.h.b(edgeEffect2, (i10 * FLING_DESTRETCH_FACTOR) / f10, 0.5f) * (f10 / FLING_DESTRETCH_FACTOR));
        if (iRound2 != i10) {
            edgeEffect2.finish();
        }
        return i10 - iRound2;
    }

    public static void clearNestedRecyclerViewIfNotNested(@NonNull j2 j2Var) {
        WeakReference<RecyclerView> weakReference = j2Var.mNestedRecyclerView;
        if (weakReference != null) {
            RecyclerView recyclerView = weakReference.get();
            while (recyclerView != null) {
                if (recyclerView == j2Var.itemView) {
                    return;
                }
                Object parent = recyclerView.getParent();
                recyclerView = parent instanceof View ? (View) parent : null;
            }
            j2Var.mNestedRecyclerView = null;
        }
    }

    @Nullable
    public static RecyclerView findNestedRecyclerView(@NonNull View view) {
        if (!(view instanceof ViewGroup)) {
            return null;
        }
        if (view instanceof RecyclerView) {
            return (RecyclerView) view;
        }
        ViewGroup viewGroup = (ViewGroup) view;
        int childCount = viewGroup.getChildCount();
        for (int i10 = 0; i10 < childCount; i10++) {
            RecyclerView recyclerViewFindNestedRecyclerView = findNestedRecyclerView(viewGroup.getChildAt(i10));
            if (recyclerViewFindNestedRecyclerView != null) {
                return recyclerViewFindNestedRecyclerView;
            }
        }
        return null;
    }

    @Nullable
    private View findNextViewToFocus() {
        j2 j2VarFindViewHolderForAdapterPosition;
        f2 f2Var = this.mState;
        int i10 = f2Var.f3711l;
        if (i10 == -1) {
            i10 = 0;
        }
        int iB = f2Var.b();
        for (int i11 = i10; i11 < iB; i11++) {
            j2 j2VarFindViewHolderForAdapterPosition2 = findViewHolderForAdapterPosition(i11);
            if (j2VarFindViewHolderForAdapterPosition2 == null) {
                break;
            }
            if (j2VarFindViewHolderForAdapterPosition2.itemView.hasFocusable()) {
                return j2VarFindViewHolderForAdapterPosition2.itemView;
            }
        }
        int iMin = Math.min(iB, i10);
        do {
            iMin--;
            if (iMin < 0 || (j2VarFindViewHolderForAdapterPosition = findViewHolderForAdapterPosition(iMin)) == null) {
                return null;
            }
        } while (!j2VarFindViewHolderForAdapterPosition.itemView.hasFocusable());
        return j2VarFindViewHolderForAdapterPosition.itemView;
    }

    public static j2 getChildViewHolderInt(View view) {
        if (view == null) {
            return null;
        }
        return ((r1) view.getLayoutParams()).mViewHolder;
    }

    public static void getDecoratedBoundsWithMarginsInt(View view, Rect rect) {
        r1 r1Var = (r1) view.getLayoutParams();
        Rect rect2 = r1Var.mDecorInsets;
        rect.set((view.getLeft() - rect2.left) - ((ViewGroup.MarginLayoutParams) r1Var).leftMargin, (view.getTop() - rect2.top) - ((ViewGroup.MarginLayoutParams) r1Var).topMargin, view.getRight() + rect2.right + ((ViewGroup.MarginLayoutParams) r1Var).rightMargin, view.getBottom() + rect2.bottom + ((ViewGroup.MarginLayoutParams) r1Var).bottomMargin);
    }

    private androidx.core.view.g0 getScrollingChildHelper() {
        if (this.mScrollingChildHelper == null) {
            this.mScrollingChildHelper = new androidx.core.view.g0(this);
        }
        return this.mScrollingChildHelper;
    }

    private void nestedScrollByInternal(int i10, int i11, @Nullable MotionEvent motionEvent, int i12) {
        q1 q1Var = this.mLayout;
        if (q1Var == null || this.mLayoutSuppressed) {
            return;
        }
        int[] iArr = this.mReusableIntPair;
        iArr[0] = 0;
        iArr[1] = 0;
        boolean zCanScrollHorizontally = q1Var.canScrollHorizontally();
        boolean zCanScrollVertically = this.mLayout.canScrollVertically();
        int i13 = zCanScrollVertically ? (zCanScrollHorizontally ? 1 : 0) | 2 : zCanScrollHorizontally ? 1 : 0;
        float height = motionEvent == null ? getHeight() / 2.0f : motionEvent.getY();
        float width = motionEvent == null ? getWidth() / 2.0f : motionEvent.getX();
        int iJ = i10 - j(height, i10);
        int iK = i11 - k(width, i11);
        startNestedScroll(i13, i12);
        if (dispatchNestedPreScroll(zCanScrollHorizontally ? iJ : 0, zCanScrollVertically ? iK : 0, this.mReusableIntPair, this.mScrollOffset, i12)) {
            int[] iArr2 = this.mReusableIntPair;
            iJ -= iArr2[0];
            iK -= iArr2[1];
        }
        scrollByInternal(zCanScrollHorizontally ? iJ : 0, zCanScrollVertically ? iK : 0, motionEvent, i12);
        z zVar = this.mGapWorker;
        if (zVar != null && (iJ != 0 || iK != 0)) {
            zVar.a(this, iJ, iK);
        }
        stopNestedScroll(i12);
    }

    private void requestChildOnScreen(@NonNull View view, @Nullable View view2) {
        View view3 = view2 != null ? view2 : view;
        this.mTempRect.set(0, 0, view3.getWidth(), view3.getHeight());
        ViewGroup.LayoutParams layoutParams = view3.getLayoutParams();
        if (layoutParams instanceof r1) {
            r1 r1Var = (r1) layoutParams;
            if (!r1Var.mInsetsDirty) {
                Rect rect = r1Var.mDecorInsets;
                Rect rect2 = this.mTempRect;
                rect2.left -= rect.left;
                rect2.right += rect.right;
                rect2.top -= rect.top;
                rect2.bottom += rect.bottom;
            }
        }
        if (view2 != null) {
            offsetDescendantRectToMyCoords(view2, this.mTempRect);
            offsetRectIntoDescendantCoords(view, this.mTempRect);
        }
        this.mLayout.requestChildRectangleOnScreen(this, view, this.mTempRect, !this.mFirstLayoutComplete, view2 == null);
    }

    private void setAdapterInternal(@Nullable d1 d1Var, boolean z10, boolean z11) {
        d1 d1Var2 = this.mAdapter;
        if (d1Var2 != null) {
            d1Var2.unregisterAdapterDataObserver(this.mObserver);
            this.mAdapter.onDetachedFromRecyclerView(this);
        }
        if (!z10 || z11) {
            removeAndRecycleViews();
        }
        c cVar = this.mAdapterHelper;
        cVar.l(cVar.f3673b);
        cVar.l(cVar.f3674c);
        int i10 = 0;
        cVar.f3677f = 0;
        d1 d1Var3 = this.mAdapter;
        this.mAdapter = d1Var;
        if (d1Var != null) {
            d1Var.registerAdapterDataObserver(this.mObserver);
            d1Var.onAttachedToRecyclerView(this);
        }
        q1 q1Var = this.mLayout;
        if (q1Var != null) {
            q1Var.onAdapterChanged(d1Var3, this.mAdapter);
        }
        y1 y1Var = this.mRecycler;
        d1 d1Var4 = this.mAdapter;
        y1Var.f3968a.clear();
        y1Var.h();
        y1Var.g(d1Var3, true);
        x1 x1VarC = y1Var.c();
        if (d1Var3 != null) {
            x1VarC.f3957b--;
        }
        if (!z10 && x1VarC.f3957b == 0) {
            while (true) {
                SparseArray sparseArray = x1VarC.f3956a;
                if (i10 >= sparseArray.size()) {
                    break;
                }
                w1 w1Var = (w1) sparseArray.valueAt(i10);
                Iterator it = w1Var.f3943a.iterator();
                while (it.hasNext()) {
                    w0.a.a(((j2) it.next()).itemView);
                }
                w1Var.f3943a.clear();
                i10++;
            }
        }
        if (d1Var4 != null) {
            x1VarC.f3957b++;
        } else {
            x1VarC.getClass();
        }
        y1Var.f();
        this.mState.f3705f = true;
    }

    public static void setDebugAssertionsEnabled(boolean z10) {
        sDebugAssertionsEnabled = z10;
    }

    public static void setVerboseLoggingEnabled(boolean z10) {
        sVerboseLoggingEnabled = z10;
    }

    public final void a(j2 j2Var) {
        View view = j2Var.itemView;
        boolean z10 = view.getParent() == this;
        this.mRecycler.m(getChildViewHolder(view));
        if (j2Var.isTmpDetached()) {
            this.mChildHelper.b(view, -1, view.getLayoutParams(), true);
            return;
        }
        if (!z10) {
            this.mChildHelper.a(view, -1, true);
            return;
        }
        f fVar = this.mChildHelper;
        int iIndexOfChild = ((c1) fVar.f3692a).f3680a.indexOfChild(view);
        if (iIndexOfChild >= 0) {
            fVar.f3693b.h(iIndexOfChild);
            fVar.i(view);
        } else {
            throw new IllegalArgumentException("view is not a child, cannot hide " + view);
        }
    }

    public void absorbGlows(int i10, int i11) {
        if (i10 < 0) {
            ensureLeftGlow();
            if (this.mLeftGlow.isFinished()) {
                this.mLeftGlow.onAbsorb(-i10);
            }
        } else if (i10 > 0) {
            ensureRightGlow();
            if (this.mRightGlow.isFinished()) {
                this.mRightGlow.onAbsorb(i10);
            }
        }
        if (i11 < 0) {
            ensureTopGlow();
            if (this.mTopGlow.isFinished()) {
                this.mTopGlow.onAbsorb(-i11);
            }
        } else if (i11 > 0) {
            ensureBottomGlow();
            if (this.mBottomGlow.isFinished()) {
                this.mBottomGlow.onAbsorb(i11);
            }
        }
        if (i10 == 0 && i11 == 0) {
            return;
        }
        WeakHashMap weakHashMap = androidx.core.view.s1.f1815a;
        postInvalidateOnAnimation();
    }

    @Override // android.view.ViewGroup, android.view.View
    public void addFocusables(ArrayList arrayList, int i10, int i11) {
        q1 q1Var = this.mLayout;
        if (q1Var == null || !q1Var.onAddFocusables(this, arrayList, i10, i11)) {
            super.addFocusables(arrayList, i10, i11);
        }
    }

    public void addItemDecoration(@NonNull m1 m1Var, int i10) {
        q1 q1Var = this.mLayout;
        if (q1Var != null) {
            q1Var.assertNotInLayoutOrScroll("Cannot add item decoration during a scroll  or layout");
        }
        if (this.mItemDecorations.isEmpty()) {
            setWillNotDraw(false);
        }
        if (i10 < 0) {
            this.mItemDecorations.add(m1Var);
        } else {
            this.mItemDecorations.add(i10, m1Var);
        }
        markItemDecorInsetsDirty();
        requestLayout();
    }

    public void addOnChildAttachStateChangeListener(@NonNull s1 s1Var) {
        if (this.mOnChildAttachStateListeners == null) {
            this.mOnChildAttachStateListeners = new ArrayList();
        }
        this.mOnChildAttachStateListeners.add(s1Var);
    }

    public void addOnItemTouchListener(@NonNull u1 u1Var) {
        this.mOnItemTouchListeners.add(u1Var);
    }

    public void addOnScrollListener(@NonNull v1 v1Var) {
        if (this.mScrollListeners == null) {
            this.mScrollListeners = new ArrayList();
        }
        this.mScrollListeners.add(v1Var);
    }

    public void addRecyclerListener(@NonNull z1 z1Var) {
        p0.g.a(z1Var != null, "'listener' arg cannot be null.");
        this.mRecyclerListeners.add(z1Var);
    }

    public void animateAppearance(@NonNull j2 j2Var, @Nullable k1 k1Var, @NonNull k1 k1Var2) {
        j2Var.setIsRecyclable(false);
        if (this.mItemAnimator.animateAppearance(j2Var, k1Var, k1Var2)) {
            postAnimationRunner();
        }
    }

    public void animateDisappearance(@NonNull j2 j2Var, @NonNull k1 k1Var, @Nullable k1 k1Var2) {
        a(j2Var);
        j2Var.setIsRecyclable(false);
        if (this.mItemAnimator.animateDisappearance(j2Var, k1Var, k1Var2)) {
            postAnimationRunner();
        }
    }

    public void assertInLayoutOrScroll(String str) {
        if (isComputingLayout()) {
            return;
        }
        if (str != null) {
            throw new IllegalStateException(defpackage.e.d(this, u.a.c(str)));
        }
        throw new IllegalStateException(defpackage.e.d(this, new StringBuilder("Cannot call this method unless RecyclerView is computing a layout or scrolling")));
    }

    public void assertNotInLayoutOrScroll(String str) {
        if (isComputingLayout()) {
            if (str != null) {
                throw new IllegalStateException(str);
            }
            throw new IllegalStateException(defpackage.e.d(this, new StringBuilder("Cannot call this method while RecyclerView is computing a layout or scrolling")));
        }
        if (this.mDispatchScrollCounter > 0) {
            new IllegalStateException(defpackage.e.d(this, new StringBuilder("")));
        }
    }

    public final void c() {
        x2 x2Var;
        this.mState.a(1);
        fillRemainingScrollValues(this.mState);
        this.mState.f3708i = false;
        startInterceptRequestLayout();
        z2 z2Var = this.mViewInfoStore;
        z2Var.f3982a.clear();
        z2Var.f3983b.a();
        onEnterLayoutOrScroll();
        i();
        View focusedChild = (this.mPreserveFocusAfterLayout && hasFocus() && this.mAdapter != null) ? getFocusedChild() : null;
        j2 j2VarFindContainingViewHolder = focusedChild != null ? findContainingViewHolder(focusedChild) : null;
        if (j2VarFindContainingViewHolder == null) {
            f2 f2Var = this.mState;
            f2Var.f3712m = -1L;
            f2Var.f3711l = -1;
            f2Var.f3713n = -1;
        } else {
            this.mState.f3712m = this.mAdapter.hasStableIds() ? j2VarFindContainingViewHolder.getItemId() : -1L;
            this.mState.f3711l = this.mDataSetHasChangedAfterLayout ? -1 : j2VarFindContainingViewHolder.isRemoved() ? j2VarFindContainingViewHolder.mOldPosition : j2VarFindContainingViewHolder.getAbsoluteAdapterPosition();
            f2 f2Var2 = this.mState;
            View focusedChild2 = j2VarFindContainingViewHolder.itemView;
            int id2 = focusedChild2.getId();
            while (!focusedChild2.isFocused() && (focusedChild2 instanceof ViewGroup) && focusedChild2.hasFocus()) {
                focusedChild2 = ((ViewGroup) focusedChild2).getFocusedChild();
                if (focusedChild2.getId() != -1) {
                    id2 = focusedChild2.getId();
                }
            }
            f2Var2.f3713n = id2;
        }
        f2 f2Var3 = this.mState;
        f2Var3.f3707h = f2Var3.f3709j && this.mItemsChanged;
        this.mItemsChanged = false;
        this.mItemsAddedOrRemoved = false;
        f2Var3.f3706g = f2Var3.f3710k;
        f2Var3.f3704e = this.mAdapter.getItemCount();
        g(this.mMinMaxLayoutPositions);
        if (this.mState.f3709j) {
            int iE = this.mChildHelper.e();
            for (int i10 = 0; i10 < iE; i10++) {
                j2 childViewHolderInt = getChildViewHolderInt(this.mChildHelper.d(i10));
                if (!childViewHolderInt.shouldIgnore() && (!childViewHolderInt.isInvalid() || this.mAdapter.hasStableIds())) {
                    l1 l1Var = this.mItemAnimator;
                    l1.b(childViewHolderInt);
                    childViewHolderInt.getUnmodifiedPayloads();
                    l1Var.getClass();
                    k1 k1Var = new k1();
                    k1Var.a(childViewHolderInt);
                    androidx.collection.s sVar = this.mViewInfoStore.f3982a;
                    x2 x2VarA = (x2) sVar.get(childViewHolderInt);
                    if (x2VarA == null) {
                        x2VarA = x2.a();
                        sVar.put(childViewHolderInt, x2VarA);
                    }
                    x2VarA.preInfo = k1Var;
                    x2VarA.f3960a |= 4;
                    if (this.mState.f3707h && childViewHolderInt.isUpdated() && !childViewHolderInt.isRemoved() && !childViewHolderInt.shouldIgnore() && !childViewHolderInt.isInvalid()) {
                        this.mViewInfoStore.f3983b.e(getChangedHolderKey(childViewHolderInt), childViewHolderInt);
                    }
                }
            }
        }
        if (this.mState.f3710k) {
            saveOldPositions();
            f2 f2Var4 = this.mState;
            boolean z10 = f2Var4.f3705f;
            f2Var4.f3705f = false;
            this.mLayout.onLayoutChildren(this.mRecycler, f2Var4);
            this.mState.f3705f = z10;
            for (int i11 = 0; i11 < this.mChildHelper.e(); i11++) {
                j2 childViewHolderInt2 = getChildViewHolderInt(this.mChildHelper.d(i11));
                if (!childViewHolderInt2.shouldIgnore() && ((x2Var = (x2) this.mViewInfoStore.f3982a.get(childViewHolderInt2)) == null || (x2Var.f3960a & 4) == 0)) {
                    l1.b(childViewHolderInt2);
                    boolean zHasAnyOfTheFlags = childViewHolderInt2.hasAnyOfTheFlags(8192);
                    l1 l1Var2 = this.mItemAnimator;
                    childViewHolderInt2.getUnmodifiedPayloads();
                    l1Var2.getClass();
                    k1 k1Var2 = new k1();
                    k1Var2.a(childViewHolderInt2);
                    if (zHasAnyOfTheFlags) {
                        recordAnimationInfoIfBouncedHiddenView(childViewHolderInt2, k1Var2);
                    } else {
                        androidx.collection.s sVar2 = this.mViewInfoStore.f3982a;
                        x2 x2VarA2 = (x2) sVar2.get(childViewHolderInt2);
                        if (x2VarA2 == null) {
                            x2VarA2 = x2.a();
                            sVar2.put(childViewHolderInt2, x2VarA2);
                        }
                        x2VarA2.f3960a |= 2;
                        x2VarA2.preInfo = k1Var2;
                    }
                }
            }
            clearOldPositions();
        } else {
            clearOldPositions();
        }
        onExitLayoutOrScroll();
        stopInterceptRequestLayout(false);
        this.mState.f3703d = 2;
    }

    public boolean canReuseUpdatedViewHolder(j2 j2Var) {
        l1 l1Var = this.mItemAnimator;
        if (l1Var != null) {
            List<Object> unmodifiedPayloads = j2Var.getUnmodifiedPayloads();
            p pVar = (p) l1Var;
            pVar.getClass();
            if (unmodifiedPayloads.isEmpty() && pVar.f3783g && !j2Var.isInvalid()) {
                return false;
            }
        }
        return true;
    }

    @Override // android.view.ViewGroup
    public boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
        return (layoutParams instanceof r1) && this.mLayout.checkLayoutParams((r1) layoutParams);
    }

    public void clearOldPositions() {
        int iH = this.mChildHelper.h();
        for (int i10 = 0; i10 < iH; i10++) {
            j2 childViewHolderInt = getChildViewHolderInt(this.mChildHelper.g(i10));
            if (!childViewHolderInt.shouldIgnore()) {
                childViewHolderInt.clearOldPosition();
            }
        }
        y1 y1Var = this.mRecycler;
        ArrayList arrayList = y1Var.f3970c;
        int size = arrayList.size();
        for (int i11 = 0; i11 < size; i11++) {
            ((j2) arrayList.get(i11)).clearOldPosition();
        }
        ArrayList arrayList2 = y1Var.f3968a;
        int size2 = arrayList2.size();
        for (int i12 = 0; i12 < size2; i12++) {
            ((j2) arrayList2.get(i12)).clearOldPosition();
        }
        ArrayList arrayList3 = y1Var.f3969b;
        if (arrayList3 != null) {
            int size3 = arrayList3.size();
            for (int i13 = 0; i13 < size3; i13++) {
                ((j2) y1Var.f3969b.get(i13)).clearOldPosition();
            }
        }
    }

    public void clearOnChildAttachStateChangeListeners() {
        List<s1> list = this.mOnChildAttachStateListeners;
        if (list != null) {
            list.clear();
        }
    }

    public void clearOnScrollListeners() {
        List<v1> list = this.mScrollListeners;
        if (list != null) {
            list.clear();
        }
    }

    @Override // android.view.View
    public int computeHorizontalScrollExtent() {
        q1 q1Var = this.mLayout;
        if (q1Var != null && q1Var.canScrollHorizontally()) {
            return this.mLayout.computeHorizontalScrollExtent(this.mState);
        }
        return 0;
    }

    @Override // android.view.View
    public int computeHorizontalScrollOffset() {
        q1 q1Var = this.mLayout;
        if (q1Var != null && q1Var.canScrollHorizontally()) {
            return this.mLayout.computeHorizontalScrollOffset(this.mState);
        }
        return 0;
    }

    @Override // android.view.View
    public int computeHorizontalScrollRange() {
        q1 q1Var = this.mLayout;
        if (q1Var != null && q1Var.canScrollHorizontally()) {
            return this.mLayout.computeHorizontalScrollRange(this.mState);
        }
        return 0;
    }

    @Override // android.view.View
    public int computeVerticalScrollExtent() {
        q1 q1Var = this.mLayout;
        if (q1Var != null && q1Var.canScrollVertically()) {
            return this.mLayout.computeVerticalScrollExtent(this.mState);
        }
        return 0;
    }

    @Override // android.view.View
    public int computeVerticalScrollOffset() {
        q1 q1Var = this.mLayout;
        if (q1Var != null && q1Var.canScrollVertically()) {
            return this.mLayout.computeVerticalScrollOffset(this.mState);
        }
        return 0;
    }

    @Override // android.view.View
    public int computeVerticalScrollRange() {
        q1 q1Var = this.mLayout;
        if (q1Var != null && q1Var.canScrollVertically()) {
            return this.mLayout.computeVerticalScrollRange(this.mState);
        }
        return 0;
    }

    public void considerReleasingGlowsOnScroll(int i10, int i11) {
        boolean zIsFinished;
        EdgeEffect edgeEffect = this.mLeftGlow;
        if (edgeEffect == null || edgeEffect.isFinished() || i10 <= 0) {
            zIsFinished = false;
        } else {
            this.mLeftGlow.onRelease();
            zIsFinished = this.mLeftGlow.isFinished();
        }
        EdgeEffect edgeEffect2 = this.mRightGlow;
        if (edgeEffect2 != null && !edgeEffect2.isFinished() && i10 < 0) {
            this.mRightGlow.onRelease();
            zIsFinished |= this.mRightGlow.isFinished();
        }
        EdgeEffect edgeEffect3 = this.mTopGlow;
        if (edgeEffect3 != null && !edgeEffect3.isFinished() && i11 > 0) {
            this.mTopGlow.onRelease();
            zIsFinished |= this.mTopGlow.isFinished();
        }
        EdgeEffect edgeEffect4 = this.mBottomGlow;
        if (edgeEffect4 != null && !edgeEffect4.isFinished() && i11 < 0) {
            this.mBottomGlow.onRelease();
            zIsFinished |= this.mBottomGlow.isFinished();
        }
        if (zIsFinished) {
            WeakHashMap weakHashMap = androidx.core.view.s1.f1815a;
            postInvalidateOnAnimation();
        }
    }

    public int consumeFlingInHorizontalStretch(int i10) {
        return b(i10, this.mLeftGlow, this.mRightGlow, getWidth());
    }

    public int consumeFlingInVerticalStretch(int i10) {
        return b(i10, this.mTopGlow, this.mBottomGlow, getHeight());
    }

    public void consumePendingUpdateOperations() {
        if (!this.mFirstLayoutComplete || this.mDataSetHasChangedAfterLayout) {
            int i10 = m0.k.f30289a;
            Trace.beginSection(TRACE_ON_DATA_SET_CHANGE_LAYOUT_TAG);
            dispatchLayout();
            Trace.endSection();
            return;
        }
        if (this.mAdapterHelper.g()) {
            c cVar = this.mAdapterHelper;
            int i11 = cVar.f3677f;
            if ((i11 & 4) == 0 || (i11 & 11) != 0) {
                if (cVar.g()) {
                    int i12 = m0.k.f30289a;
                    Trace.beginSection(TRACE_ON_DATA_SET_CHANGE_LAYOUT_TAG);
                    dispatchLayout();
                    Trace.endSection();
                    return;
                }
                return;
            }
            int i13 = m0.k.f30289a;
            Trace.beginSection(TRACE_HANDLE_ADAPTER_UPDATES_TAG);
            startInterceptRequestLayout();
            onEnterLayoutOrScroll();
            this.mAdapterHelper.j();
            if (!this.mLayoutWasDefered) {
                int iE = this.mChildHelper.e();
                int i14 = 0;
                while (true) {
                    if (i14 < iE) {
                        j2 childViewHolderInt = getChildViewHolderInt(this.mChildHelper.d(i14));
                        if (childViewHolderInt != null && !childViewHolderInt.shouldIgnore() && childViewHolderInt.isUpdated()) {
                            dispatchLayout();
                            break;
                        }
                        i14++;
                    } else {
                        this.mAdapterHelper.b();
                        break;
                    }
                }
            }
            stopInterceptRequestLayout(true);
            onExitLayoutOrScroll();
            Trace.endSection();
        }
    }

    public void defaultOnMeasure(int i10, int i11) {
        int paddingRight = getPaddingRight() + getPaddingLeft();
        WeakHashMap weakHashMap = androidx.core.view.s1.f1815a;
        setMeasuredDimension(q1.chooseSize(i10, paddingRight, getMinimumWidth()), q1.chooseSize(i11, getPaddingBottom() + getPaddingTop(), getMinimumHeight()));
    }

    public void dispatchChildAttached(View view) {
        j2 childViewHolderInt = getChildViewHolderInt(view);
        onChildAttachedToWindow(view);
        d1 d1Var = this.mAdapter;
        if (d1Var != null && childViewHolderInt != null) {
            d1Var.onViewAttachedToWindow(childViewHolderInt);
        }
        List<s1> list = this.mOnChildAttachStateListeners;
        if (list != null) {
            for (int size = list.size() - 1; size >= 0; size--) {
                this.mOnChildAttachStateListeners.get(size).c(view);
            }
        }
    }

    public void dispatchChildDetached(View view) {
        j2 childViewHolderInt = getChildViewHolderInt(view);
        onChildDetachedFromWindow(view);
        d1 d1Var = this.mAdapter;
        if (d1Var != null && childViewHolderInt != null) {
            d1Var.onViewDetachedFromWindow(childViewHolderInt);
        }
        List<s1> list = this.mOnChildAttachStateListeners;
        if (list != null) {
            for (int size = list.size() - 1; size >= 0; size--) {
                this.mOnChildAttachStateListeners.get(size).b(view);
            }
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:164:0x034d  */
    /* JADX WARN: Removed duplicated region for block: B:177:0x0381  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public void dispatchLayout() {
        View viewFindViewById;
        if (this.mAdapter == null || this.mLayout == null) {
            return;
        }
        this.mState.f3708i = false;
        boolean z10 = this.mLastAutoMeasureSkippedDueToExact && !(this.mLastAutoMeasureNonExactMeasuredWidth == getWidth() && this.mLastAutoMeasureNonExactMeasuredHeight == getHeight());
        this.mLastAutoMeasureNonExactMeasuredWidth = 0;
        this.mLastAutoMeasureNonExactMeasuredHeight = 0;
        this.mLastAutoMeasureSkippedDueToExact = false;
        if (this.mState.f3703d == 1) {
            c();
            this.mLayout.setExactMeasureSpecsFrom(this);
            e();
        } else {
            c cVar = this.mAdapterHelper;
            if ((cVar.f3674c.isEmpty() || cVar.f3673b.isEmpty()) && !z10 && this.mLayout.getWidth() == getWidth() && this.mLayout.getHeight() == getHeight()) {
                this.mLayout.setExactMeasureSpecsFrom(this);
            } else {
                this.mLayout.setExactMeasureSpecsFrom(this);
                e();
            }
        }
        this.mState.a(4);
        startInterceptRequestLayout();
        onEnterLayoutOrScroll();
        f2 f2Var = this.mState;
        f2Var.f3703d = 1;
        View viewFindNextViewToFocus = null;
        if (f2Var.f3709j) {
            for (int iE = this.mChildHelper.e() - 1; iE >= 0; iE--) {
                j2 childViewHolderInt = getChildViewHolderInt(this.mChildHelper.d(iE));
                if (!childViewHolderInt.shouldIgnore()) {
                    long changedHolderKey = getChangedHolderKey(childViewHolderInt);
                    this.mItemAnimator.getClass();
                    k1 k1Var = new k1();
                    k1Var.a(childViewHolderInt);
                    j2 j2Var = (j2) this.mViewInfoStore.f3983b.c(changedHolderKey);
                    if (j2Var == null || j2Var.shouldIgnore()) {
                        this.mViewInfoStore.a(childViewHolderInt, k1Var);
                    } else {
                        x2 x2Var = (x2) this.mViewInfoStore.f3982a.get(j2Var);
                        boolean z11 = (x2Var == null || (x2Var.f3960a & 1) == 0) ? false : true;
                        x2 x2Var2 = (x2) this.mViewInfoStore.f3982a.get(childViewHolderInt);
                        boolean z12 = (x2Var2 == null || (x2Var2.f3960a & 1) == 0) ? false : true;
                        if (z11 && j2Var == childViewHolderInt) {
                            this.mViewInfoStore.a(childViewHolderInt, k1Var);
                        } else {
                            k1 k1VarPopFromPreLayout = this.mViewInfoStore.popFromPreLayout(j2Var);
                            this.mViewInfoStore.a(childViewHolderInt, k1Var);
                            k1 k1VarPopFromPostLayout = this.mViewInfoStore.popFromPostLayout(childViewHolderInt);
                            if (k1VarPopFromPreLayout == null) {
                                int iE2 = this.mChildHelper.e();
                                for (int i10 = 0; i10 < iE2; i10++) {
                                    j2 childViewHolderInt2 = getChildViewHolderInt(this.mChildHelper.d(i10));
                                    if (childViewHolderInt2 != childViewHolderInt && getChangedHolderKey(childViewHolderInt2) == changedHolderKey) {
                                        d1 d1Var = this.mAdapter;
                                        if (d1Var == null || !d1Var.hasStableIds()) {
                                            StringBuilder sb = new StringBuilder("Two different ViewHolders have the same change ID. This might happen due to inconsistent Adapter update events or if the LayoutManager lays out the same View multiple times.\n ViewHolder 1:");
                                            sb.append(childViewHolderInt2);
                                            sb.append(" \n View Holder 2:");
                                            sb.append(childViewHolderInt);
                                            throw new IllegalStateException(defpackage.e.d(this, sb));
                                        }
                                        StringBuilder sb2 = new StringBuilder("Two different ViewHolders have the same stable ID. Stable IDs in your adapter MUST BE unique and SHOULD NOT change.\n ViewHolder 1:");
                                        sb2.append(childViewHolderInt2);
                                        sb2.append(" \n View Holder 2:");
                                        sb2.append(childViewHolderInt);
                                        throw new IllegalStateException(defpackage.e.d(this, sb2));
                                    }
                                }
                                Objects.toString(j2Var);
                                Objects.toString(childViewHolderInt);
                                exceptionLabel();
                            } else {
                                j2Var.setIsRecyclable(false);
                                if (z11) {
                                    a(j2Var);
                                }
                                if (j2Var != childViewHolderInt) {
                                    if (z12) {
                                        a(childViewHolderInt);
                                    }
                                    j2Var.mShadowedHolder = childViewHolderInt;
                                    a(j2Var);
                                    this.mRecycler.m(j2Var);
                                    childViewHolderInt.setIsRecyclable(false);
                                    childViewHolderInt.mShadowingHolder = j2Var;
                                }
                                if (this.mItemAnimator.a(j2Var, childViewHolderInt, k1VarPopFromPreLayout, k1VarPopFromPostLayout)) {
                                    postAnimationRunner();
                                }
                            }
                        }
                    }
                }
            }
            z2 z2Var = this.mViewInfoStore;
            y2 y2Var = this.mViewInfoProcessCallback;
            androidx.collection.s sVar = z2Var.f3982a;
            for (int i11 = sVar.f968c - 1; i11 >= 0; i11--) {
                j2 j2Var2 = (j2) sVar.i(i11);
                x2 x2Var3 = (x2) sVar.k(i11);
                int i12 = x2Var3.f3960a;
                if ((i12 & 3) == 3) {
                    RecyclerView recyclerView = ((b1) y2Var).f3670a;
                    recyclerView.mLayout.removeAndRecycleView(j2Var2.itemView, recyclerView.mRecycler);
                } else if ((i12 & 1) != 0) {
                    k1 k1Var2 = x2Var3.preInfo;
                    if (k1Var2 == null) {
                        RecyclerView recyclerView2 = ((b1) y2Var).f3670a;
                        recyclerView2.mLayout.removeAndRecycleView(j2Var2.itemView, recyclerView2.mRecycler);
                    } else {
                        ((b1) y2Var).processDisappeared(j2Var2, k1Var2, x2Var3.postInfo);
                    }
                } else if ((i12 & 14) == 14) {
                    ((b1) y2Var).processAppeared(j2Var2, x2Var3.preInfo, x2Var3.postInfo);
                } else if ((i12 & 12) == 12) {
                    k1 k1Var3 = x2Var3.preInfo;
                    k1 k1Var4 = x2Var3.postInfo;
                    b1 b1Var = (b1) y2Var;
                    b1Var.getClass();
                    j2Var2.setIsRecyclable(false);
                    RecyclerView recyclerView3 = b1Var.f3670a;
                    if (!recyclerView3.mDataSetHasChangedAfterLayout) {
                        m2 m2Var = (m2) recyclerView3.mItemAnimator;
                        m2Var.getClass();
                        int i13 = k1Var3.f3761a;
                        int i14 = k1Var4.f3761a;
                        if (i13 == i14 && k1Var3.f3762b == k1Var4.f3762b) {
                            m2Var.c(j2Var2);
                        } else if (m2Var.g(j2Var2, i13, k1Var3.f3762b, i14, k1Var4.f3762b)) {
                            recyclerView3.postAnimationRunner();
                        }
                    } else if (recyclerView3.mItemAnimator.a(j2Var2, j2Var2, k1Var3, k1Var4)) {
                        recyclerView3.postAnimationRunner();
                    }
                } else if ((i12 & 4) != 0) {
                    ((b1) y2Var).processDisappeared(j2Var2, x2Var3.preInfo, null);
                } else if ((i12 & 8) != 0) {
                    ((b1) y2Var).processAppeared(j2Var2, x2Var3.preInfo, x2Var3.postInfo);
                }
                x2Var3.f3960a = 0;
                x2Var3.preInfo = null;
                x2Var3.postInfo = null;
                x2.f3959b.a(x2Var3);
            }
        }
        this.mLayout.removeAndRecycleScrapInt(this.mRecycler);
        f2 f2Var2 = this.mState;
        f2Var2.f3701b = f2Var2.f3704e;
        this.mDataSetHasChangedAfterLayout = false;
        this.mDispatchItemsChangedEvent = false;
        f2Var2.f3709j = false;
        f2Var2.f3710k = false;
        this.mLayout.mRequestedSimpleAnimations = false;
        ArrayList arrayList = this.mRecycler.f3969b;
        if (arrayList != null) {
            arrayList.clear();
        }
        q1 q1Var = this.mLayout;
        if (q1Var.mPrefetchMaxObservedInInitialPrefetch) {
            q1Var.mPrefetchMaxCountObserved = 0;
            q1Var.mPrefetchMaxObservedInInitialPrefetch = false;
            this.mRecycler.n();
        }
        this.mLayout.onLayoutCompleted(this.mState);
        onExitLayoutOrScroll();
        stopInterceptRequestLayout(false);
        z2 z2Var2 = this.mViewInfoStore;
        z2Var2.f3982a.clear();
        z2Var2.f3983b.a();
        int[] iArr = this.mMinMaxLayoutPositions;
        int i15 = iArr[0];
        int i16 = iArr[1];
        g(iArr);
        int[] iArr2 = this.mMinMaxLayoutPositions;
        if (iArr2[0] != i15 || iArr2[1] != i16) {
            dispatchOnScrolled(0, 0);
        }
        if (this.mPreserveFocusAfterLayout && this.mAdapter != null && hasFocus() && getDescendantFocusability() != 393216 && (getDescendantFocusability() != 131072 || !isFocused())) {
            if (!isFocused()) {
                View focusedChild = getFocusedChild();
                if (!IGNORE_DETACHED_FOCUSED_CHILD || (focusedChild.getParent() != null && focusedChild.hasFocus())) {
                    if (this.mChildHelper.f3694c.contains(focusedChild)) {
                        j2 j2VarFindViewHolderForItemId = (this.mState.f3712m == -1 || !this.mAdapter.hasStableIds()) ? null : findViewHolderForItemId(this.mState.f3712m);
                        if (j2VarFindViewHolderForItemId != null) {
                            if (!this.mChildHelper.f3694c.contains(j2VarFindViewHolderForItemId.itemView) && j2VarFindViewHolderForItemId.itemView.hasFocusable()) {
                                viewFindNextViewToFocus = j2VarFindViewHolderForItemId.itemView;
                            } else if (this.mChildHelper.e() > 0) {
                                viewFindNextViewToFocus = findNextViewToFocus();
                            }
                            if (viewFindNextViewToFocus != null) {
                                int i17 = this.mState.f3713n;
                                if (i17 != -1 && (viewFindViewById = viewFindNextViewToFocus.findViewById(i17)) != null && viewFindViewById.isFocusable()) {
                                    viewFindNextViewToFocus = viewFindViewById;
                                }
                                viewFindNextViewToFocus.requestFocus();
                            }
                        }
                    }
                } else if (this.mChildHelper.e() == 0) {
                    requestFocus();
                }
            }
        }
        f2 f2Var3 = this.mState;
        f2Var3.f3712m = -1L;
        f2Var3.f3711l = -1;
        f2Var3.f3713n = -1;
    }

    @Override // android.view.View
    public boolean dispatchNestedFling(float f10, float f11, boolean z10) {
        return getScrollingChildHelper().a(f10, f11, z10);
    }

    @Override // android.view.View
    public boolean dispatchNestedPreFling(float f10, float f11) {
        return getScrollingChildHelper().b(f10, f11);
    }

    @Override // android.view.View, androidx.core.view.d0, androidx.core.view.f0
    public boolean dispatchNestedPreScroll(int i10, int i11, int[] iArr, int[] iArr2) {
        return getScrollingChildHelper().dispatchNestedPreScroll(i10, i11, iArr, iArr2);
    }

    @Override // android.view.View, androidx.core.view.d0, androidx.core.view.f0
    public boolean dispatchNestedScroll(int i10, int i11, int i12, int i13, int[] iArr) {
        return getScrollingChildHelper().dispatchNestedScroll(i10, i11, i12, i13, iArr);
    }

    public void dispatchOnScrollStateChanged(int i10) {
        q1 q1Var = this.mLayout;
        if (q1Var != null) {
            q1Var.onScrollStateChanged(i10);
        }
        onScrollStateChanged(i10);
        v1 v1Var = this.mScrollListener;
        if (v1Var != null) {
            v1Var.onScrollStateChanged(this, i10);
        }
        List<v1> list = this.mScrollListeners;
        if (list != null) {
            for (int size = list.size() - 1; size >= 0; size--) {
                this.mScrollListeners.get(size).onScrollStateChanged(this, i10);
            }
        }
    }

    public void dispatchOnScrolled(int i10, int i11) {
        this.mDispatchScrollCounter++;
        int scrollX = getScrollX();
        int scrollY = getScrollY();
        onScrollChanged(scrollX, scrollY, scrollX - i10, scrollY - i11);
        onScrolled(i10, i11);
        v1 v1Var = this.mScrollListener;
        if (v1Var != null) {
            v1Var.onScrolled(this, i10, i11);
        }
        List<v1> list = this.mScrollListeners;
        if (list != null) {
            for (int size = list.size() - 1; size >= 0; size--) {
                this.mScrollListeners.get(size).onScrolled(this, i10, i11);
            }
        }
        this.mDispatchScrollCounter--;
    }

    public void dispatchPendingImportantForAccessibilityChanges() {
        int i10;
        for (int size = this.mPendingAccessibilityImportanceChange.size() - 1; size >= 0; size--) {
            j2 j2Var = this.mPendingAccessibilityImportanceChange.get(size);
            if (j2Var.itemView.getParent() == this && !j2Var.shouldIgnore() && (i10 = j2Var.mPendingAccessibilityState) != -1) {
                View view = j2Var.itemView;
                WeakHashMap weakHashMap = androidx.core.view.s1.f1815a;
                view.setImportantForAccessibility(i10);
                j2Var.mPendingAccessibilityState = -1;
            }
        }
        this.mPendingAccessibilityImportanceChange.clear();
    }

    @Override // android.view.View
    public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
        onPopulateAccessibilityEvent(accessibilityEvent);
        return true;
    }

    @Override // android.view.ViewGroup, android.view.View
    public void dispatchRestoreInstanceState(SparseArray<Parcelable> sparseArray) {
        dispatchThawSelfOnly(sparseArray);
    }

    @Override // android.view.ViewGroup, android.view.View
    public void dispatchSaveInstanceState(SparseArray<Parcelable> sparseArray) {
        dispatchFreezeSelfOnly(sparseArray);
    }

    @Override // android.view.View
    public void draw(Canvas canvas) {
        boolean z10;
        super.draw(canvas);
        int size = this.mItemDecorations.size();
        boolean z11 = false;
        for (int i10 = 0; i10 < size; i10++) {
            this.mItemDecorations.get(i10).onDrawOver(canvas, this, this.mState);
        }
        EdgeEffect edgeEffect = this.mLeftGlow;
        if (edgeEffect == null || edgeEffect.isFinished()) {
            z10 = false;
        } else {
            int iSave = canvas.save();
            int paddingBottom = this.mClipToPadding ? getPaddingBottom() : 0;
            canvas.rotate(270.0f);
            canvas.translate((-getHeight()) + paddingBottom, 0.0f);
            EdgeEffect edgeEffect2 = this.mLeftGlow;
            z10 = edgeEffect2 != null && edgeEffect2.draw(canvas);
            canvas.restoreToCount(iSave);
        }
        EdgeEffect edgeEffect3 = this.mTopGlow;
        if (edgeEffect3 != null && !edgeEffect3.isFinished()) {
            int iSave2 = canvas.save();
            if (this.mClipToPadding) {
                canvas.translate(getPaddingLeft(), getPaddingTop());
            }
            EdgeEffect edgeEffect4 = this.mTopGlow;
            z10 |= edgeEffect4 != null && edgeEffect4.draw(canvas);
            canvas.restoreToCount(iSave2);
        }
        EdgeEffect edgeEffect5 = this.mRightGlow;
        if (edgeEffect5 != null && !edgeEffect5.isFinished()) {
            int iSave3 = canvas.save();
            int width = getWidth();
            int paddingTop = this.mClipToPadding ? getPaddingTop() : 0;
            canvas.rotate(90.0f);
            canvas.translate(paddingTop, -width);
            EdgeEffect edgeEffect6 = this.mRightGlow;
            z10 |= edgeEffect6 != null && edgeEffect6.draw(canvas);
            canvas.restoreToCount(iSave3);
        }
        EdgeEffect edgeEffect7 = this.mBottomGlow;
        if (edgeEffect7 != null && !edgeEffect7.isFinished()) {
            int iSave4 = canvas.save();
            canvas.rotate(180.0f);
            if (this.mClipToPadding) {
                canvas.translate(getPaddingRight() + (-getWidth()), getPaddingBottom() + (-getHeight()));
            } else {
                canvas.translate(-getWidth(), -getHeight());
            }
            EdgeEffect edgeEffect8 = this.mBottomGlow;
            if (edgeEffect8 != null && edgeEffect8.draw(canvas)) {
                z11 = true;
            }
            z10 |= z11;
            canvas.restoreToCount(iSave4);
        }
        if ((z10 || this.mItemAnimator == null || this.mItemDecorations.size() <= 0 || !this.mItemAnimator.f()) && !z10) {
            return;
        }
        WeakHashMap weakHashMap = androidx.core.view.s1.f1815a;
        postInvalidateOnAnimation();
    }

    @Override // android.view.ViewGroup
    public boolean drawChild(Canvas canvas, View view, long j10) {
        return super.drawChild(canvas, view, j10);
    }

    public final void e() {
        startInterceptRequestLayout();
        onEnterLayoutOrScroll();
        this.mState.a(6);
        this.mAdapterHelper.c();
        this.mState.f3704e = this.mAdapter.getItemCount();
        this.mState.f3702c = 0;
        if (this.mPendingSavedState != null && this.mAdapter.canRestoreState()) {
            Parcelable parcelable = this.mPendingSavedState.f3671c;
            if (parcelable != null) {
                this.mLayout.onRestoreInstanceState(parcelable);
            }
            this.mPendingSavedState = null;
        }
        f2 f2Var = this.mState;
        f2Var.f3706g = false;
        this.mLayout.onLayoutChildren(this.mRecycler, f2Var);
        f2 f2Var2 = this.mState;
        f2Var2.f3705f = false;
        f2Var2.f3709j = f2Var2.f3709j && this.mItemAnimator != null;
        f2Var2.f3703d = 4;
        onExitLayoutOrScroll();
        stopInterceptRequestLayout(false);
    }

    public void ensureBottomGlow() {
        if (this.mBottomGlow != null) {
            return;
        }
        ((g2) this.mEdgeEffectFactory).getClass();
        EdgeEffect edgeEffect = new EdgeEffect(getContext());
        this.mBottomGlow = edgeEffect;
        if (this.mClipToPadding) {
            edgeEffect.setSize((getMeasuredWidth() - getPaddingLeft()) - getPaddingRight(), (getMeasuredHeight() - getPaddingTop()) - getPaddingBottom());
        } else {
            edgeEffect.setSize(getMeasuredWidth(), getMeasuredHeight());
        }
    }

    public void ensureLeftGlow() {
        if (this.mLeftGlow != null) {
            return;
        }
        ((g2) this.mEdgeEffectFactory).getClass();
        EdgeEffect edgeEffect = new EdgeEffect(getContext());
        this.mLeftGlow = edgeEffect;
        if (this.mClipToPadding) {
            edgeEffect.setSize((getMeasuredHeight() - getPaddingTop()) - getPaddingBottom(), (getMeasuredWidth() - getPaddingLeft()) - getPaddingRight());
        } else {
            edgeEffect.setSize(getMeasuredHeight(), getMeasuredWidth());
        }
    }

    public void ensureRightGlow() {
        if (this.mRightGlow != null) {
            return;
        }
        ((g2) this.mEdgeEffectFactory).getClass();
        EdgeEffect edgeEffect = new EdgeEffect(getContext());
        this.mRightGlow = edgeEffect;
        if (this.mClipToPadding) {
            edgeEffect.setSize((getMeasuredHeight() - getPaddingTop()) - getPaddingBottom(), (getMeasuredWidth() - getPaddingLeft()) - getPaddingRight());
        } else {
            edgeEffect.setSize(getMeasuredHeight(), getMeasuredWidth());
        }
    }

    public void ensureTopGlow() {
        if (this.mTopGlow != null) {
            return;
        }
        ((g2) this.mEdgeEffectFactory).getClass();
        EdgeEffect edgeEffect = new EdgeEffect(getContext());
        this.mTopGlow = edgeEffect;
        if (this.mClipToPadding) {
            edgeEffect.setSize((getMeasuredWidth() - getPaddingLeft()) - getPaddingRight(), (getMeasuredHeight() - getPaddingTop()) - getPaddingBottom());
        } else {
            edgeEffect.setSize(getMeasuredWidth(), getMeasuredHeight());
        }
    }

    public String exceptionLabel() {
        return " " + super.toString() + ", adapter:" + this.mAdapter + ", layout:" + this.mLayout + ", context:" + getContext();
    }

    public final boolean f(MotionEvent motionEvent) {
        int action = motionEvent.getAction();
        int size = this.mOnItemTouchListeners.size();
        for (int i10 = 0; i10 < size; i10++) {
            u1 u1Var = this.mOnItemTouchListeners.get(i10);
            if (u1Var.d(motionEvent) && action != 3) {
                this.mInterceptingOnItemTouchListener = u1Var;
                return true;
            }
        }
        return false;
    }

    public final void fillRemainingScrollValues(f2 f2Var) {
        if (getScrollState() != 2) {
            f2Var.getClass();
            return;
        }
        OverScroller overScroller = this.mViewFlinger.f3731c;
        overScroller.getFinalX();
        overScroller.getCurrX();
        f2Var.getClass();
        overScroller.getFinalY();
        overScroller.getCurrY();
    }

    @Nullable
    public View findChildViewUnder(float f10, float f11) {
        for (int iE = this.mChildHelper.e() - 1; iE >= 0; iE--) {
            View viewD = this.mChildHelper.d(iE);
            float translationX = viewD.getTranslationX();
            float translationY = viewD.getTranslationY();
            if (f10 >= viewD.getLeft() + translationX && f10 <= viewD.getRight() + translationX && f11 >= viewD.getTop() + translationY && f11 <= viewD.getBottom() + translationY) {
                return viewD;
            }
        }
        return null;
    }

    @Nullable
    public View findContainingItemView(@NonNull View view) {
        ViewParent parent = view.getParent();
        while (parent != null && parent != this && (parent instanceof View)) {
            view = parent;
            parent = view.getParent();
        }
        if (parent == this) {
            return view;
        }
        return null;
    }

    @Nullable
    public j2 findContainingViewHolder(@NonNull View view) {
        View viewFindContainingItemView = findContainingItemView(view);
        if (viewFindContainingItemView == null) {
            return null;
        }
        return getChildViewHolder(viewFindContainingItemView);
    }

    @Nullable
    public j2 findViewHolderForAdapterPosition(int i10) {
        j2 j2Var = null;
        if (this.mDataSetHasChangedAfterLayout) {
            return null;
        }
        int iH = this.mChildHelper.h();
        for (int i11 = 0; i11 < iH; i11++) {
            j2 childViewHolderInt = getChildViewHolderInt(this.mChildHelper.g(i11));
            if (childViewHolderInt != null && !childViewHolderInt.isRemoved() && getAdapterPositionInRecyclerView(childViewHolderInt) == i10) {
                if (!this.mChildHelper.k(childViewHolderInt.itemView)) {
                    return childViewHolderInt;
                }
                j2Var = childViewHolderInt;
            }
        }
        return j2Var;
    }

    public j2 findViewHolderForItemId(long j10) {
        d1 d1Var = this.mAdapter;
        j2 j2Var = null;
        if (d1Var != null && d1Var.hasStableIds()) {
            int iH = this.mChildHelper.h();
            for (int i10 = 0; i10 < iH; i10++) {
                j2 childViewHolderInt = getChildViewHolderInt(this.mChildHelper.g(i10));
                if (childViewHolderInt != null && !childViewHolderInt.isRemoved() && childViewHolderInt.getItemId() == j10) {
                    if (!this.mChildHelper.k(childViewHolderInt.itemView)) {
                        return childViewHolderInt;
                    }
                    j2Var = childViewHolderInt;
                }
            }
        }
        return j2Var;
    }

    @Nullable
    public j2 findViewHolderForLayoutPosition(int i10) {
        return findViewHolderForPosition(i10, false);
    }

    @Nullable
    @Deprecated
    public j2 findViewHolderForPosition(int i10) {
        return findViewHolderForPosition(i10, false);
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r0v1, types: [boolean] */
    /* JADX WARN: Type inference failed for: r0v6 */
    public boolean fling(int i10, int i11) {
        int iMax;
        int i12;
        q1 q1Var = this.mLayout;
        if (q1Var == null || this.mLayoutSuppressed) {
            return false;
        }
        int iCanScrollHorizontally = q1Var.canScrollHorizontally();
        boolean zCanScrollVertically = this.mLayout.canScrollVertically();
        if (iCanScrollHorizontally == 0 || Math.abs(i10) < this.mMinFlingVelocity) {
            i10 = 0;
        }
        if (!zCanScrollVertically || Math.abs(i11) < this.mMinFlingVelocity) {
            i11 = 0;
        }
        if (i10 == 0 && i11 == 0) {
            return false;
        }
        if (i10 == 0) {
            iMax = 0;
        } else {
            EdgeEffect edgeEffect = this.mLeftGlow;
            if (edgeEffect == null || u0.h.a(edgeEffect) == 0.0f) {
                EdgeEffect edgeEffect2 = this.mRightGlow;
                if (edgeEffect2 != null && u0.h.a(edgeEffect2) != 0.0f) {
                    if (m(this.mRightGlow, i10, getWidth())) {
                        this.mRightGlow.onAbsorb(i10);
                        i10 = 0;
                    }
                    iMax = i10;
                    i10 = 0;
                }
                iMax = 0;
            } else {
                int i13 = -i10;
                if (m(this.mLeftGlow, i13, getWidth())) {
                    this.mLeftGlow.onAbsorb(i13);
                    i10 = 0;
                }
                iMax = i10;
                i10 = 0;
            }
        }
        if (i11 == 0) {
            i12 = i11;
            i11 = 0;
        } else {
            EdgeEffect edgeEffect3 = this.mTopGlow;
            if (edgeEffect3 == null || u0.h.a(edgeEffect3) == 0.0f) {
                EdgeEffect edgeEffect4 = this.mBottomGlow;
                if (edgeEffect4 != null && u0.h.a(edgeEffect4) != 0.0f) {
                    if (m(this.mBottomGlow, i11, getHeight())) {
                        this.mBottomGlow.onAbsorb(i11);
                        i11 = 0;
                    }
                    i12 = 0;
                }
                i12 = i11;
                i11 = 0;
            } else {
                int i14 = -i11;
                if (m(this.mTopGlow, i14, getHeight())) {
                    this.mTopGlow.onAbsorb(i14);
                    i11 = 0;
                }
                i12 = 0;
            }
        }
        if (iMax != 0 || i11 != 0) {
            int i15 = this.mMaxFlingVelocity;
            iMax = Math.max(-i15, Math.min(iMax, i15));
            int i16 = this.mMaxFlingVelocity;
            i11 = Math.max(-i16, Math.min(i11, i16));
            this.mViewFlinger.a(iMax, i11);
        }
        if (i10 == 0 && i12 == 0) {
            return (iMax == 0 && i11 == 0) ? false : true;
        }
        float f10 = i10;
        float f11 = i12;
        if (!dispatchNestedPreFling(f10, f11)) {
            boolean z10 = iCanScrollHorizontally != 0 || zCanScrollVertically;
            dispatchNestedFling(f10, f11, z10);
            t1 t1Var = this.mOnFlingListener;
            if (t1Var != null && t1Var.onFling(i10, i12)) {
                return true;
            }
            if (z10) {
                if (zCanScrollVertically) {
                    iCanScrollHorizontally = (iCanScrollHorizontally == true ? 1 : 0) | 2;
                }
                startNestedScroll(iCanScrollHorizontally, 1);
                int i17 = this.mMaxFlingVelocity;
                int iMax2 = Math.max(-i17, Math.min(i10, i17));
                int i18 = this.mMaxFlingVelocity;
                this.mViewFlinger.a(iMax2, Math.max(-i18, Math.min(i12, i18)));
                return true;
            }
        }
        return false;
    }

    @Override // android.view.ViewGroup, android.view.ViewParent
    public View focusSearch(View view, int i10) {
        View viewOnFocusSearchFailed;
        int i11;
        byte b10;
        boolean z10;
        int i12 = i10;
        View viewOnInterceptFocusSearch = this.mLayout.onInterceptFocusSearch(view, i12);
        if (viewOnInterceptFocusSearch != null) {
            return viewOnInterceptFocusSearch;
        }
        boolean z11 = (this.mAdapter == null || this.mLayout == null || isComputingLayout() || this.mLayoutSuppressed) ? false : true;
        FocusFinder focusFinder = FocusFinder.getInstance();
        if (z11 && (i12 == 2 || i12 == 1)) {
            if (this.mLayout.canScrollVertically()) {
                int i13 = i12 == 2 ? 130 : 33;
                z10 = focusFinder.findNextFocus(this, view, i13) == null;
                if (FORCE_ABS_FOCUS_SEARCH_DIRECTION) {
                    i12 = i13;
                }
            } else {
                z10 = false;
            }
            if (!z10 && this.mLayout.canScrollHorizontally()) {
                int i14 = (this.mLayout.getLayoutDirection() == 1) ^ (i12 == 2) ? 66 : 17;
                z10 = focusFinder.findNextFocus(this, view, i14) == null;
                if (FORCE_ABS_FOCUS_SEARCH_DIRECTION) {
                    i12 = i14;
                }
            }
            if (z10) {
                consumePendingUpdateOperations();
                if (findContainingItemView(view) == null) {
                    return null;
                }
                startInterceptRequestLayout();
                this.mLayout.onFocusSearchFailed(view, i12, this.mRecycler, this.mState);
                stopInterceptRequestLayout(false);
            }
            viewOnFocusSearchFailed = focusFinder.findNextFocus(this, view, i12);
        } else {
            View viewFindNextFocus = focusFinder.findNextFocus(this, view, i12);
            if (viewFindNextFocus == null && z11) {
                consumePendingUpdateOperations();
                if (findContainingItemView(view) == null) {
                    return null;
                }
                startInterceptRequestLayout();
                viewOnFocusSearchFailed = this.mLayout.onFocusSearchFailed(view, i12, this.mRecycler, this.mState);
                stopInterceptRequestLayout(false);
            } else {
                viewOnFocusSearchFailed = viewFindNextFocus;
            }
        }
        if (viewOnFocusSearchFailed != null && !viewOnFocusSearchFailed.hasFocusable()) {
            if (getFocusedChild() == null) {
                return super.focusSearch(view, i12);
            }
            requestChildOnScreen(viewOnFocusSearchFailed, null);
            return view;
        }
        if (viewOnFocusSearchFailed != null && viewOnFocusSearchFailed != this && viewOnFocusSearchFailed != view && findContainingItemView(viewOnFocusSearchFailed) != null) {
            if (view == null || findContainingItemView(view) == null) {
                return viewOnFocusSearchFailed;
            }
            this.mTempRect.set(0, 0, view.getWidth(), view.getHeight());
            this.mTempRect2.set(0, 0, viewOnFocusSearchFailed.getWidth(), viewOnFocusSearchFailed.getHeight());
            offsetDescendantRectToMyCoords(view, this.mTempRect);
            offsetDescendantRectToMyCoords(viewOnFocusSearchFailed, this.mTempRect2);
            int i15 = this.mLayout.getLayoutDirection() == 1 ? -1 : 1;
            Rect rect = this.mTempRect;
            int i16 = rect.left;
            Rect rect2 = this.mTempRect2;
            int i17 = rect2.left;
            if ((i16 < i17 || rect.right <= i17) && rect.right < rect2.right) {
                i11 = 1;
            } else {
                int i18 = rect.right;
                int i19 = rect2.right;
                i11 = ((i18 > i19 || i16 >= i19) && i16 > i17) ? -1 : 0;
            }
            int i20 = rect.top;
            int i21 = rect2.top;
            if ((i20 < i21 || rect.bottom <= i21) && rect.bottom < rect2.bottom) {
                b10 = 1;
            } else {
                int i22 = rect.bottom;
                int i23 = rect2.bottom;
                b10 = ((i22 > i23 || i20 >= i23) && i20 > i21) ? (byte) -1 : (byte) 0;
            }
            if (i12 != 1) {
                if (i12 != 2) {
                    if (i12 != 17) {
                        if (i12 != 33) {
                            if (i12 != 66) {
                                if (i12 != 130) {
                                    StringBuilder sb = new StringBuilder("Invalid direction: ");
                                    sb.append(i12);
                                    throw new IllegalArgumentException(defpackage.e.d(this, sb));
                                }
                                if (b10 > 0) {
                                    return viewOnFocusSearchFailed;
                                }
                            } else if (i11 > 0) {
                                return viewOnFocusSearchFailed;
                            }
                        } else if (b10 < 0) {
                            return viewOnFocusSearchFailed;
                        }
                    } else if (i11 < 0) {
                        return viewOnFocusSearchFailed;
                    }
                } else {
                    if (b10 > 0) {
                        return viewOnFocusSearchFailed;
                    }
                    if (b10 == 0 && i11 * i15 > 0) {
                        return viewOnFocusSearchFailed;
                    }
                }
            } else {
                if (b10 < 0) {
                    return viewOnFocusSearchFailed;
                }
                if (b10 == 0 && i11 * i15 < 0) {
                    return viewOnFocusSearchFailed;
                }
            }
        }
        return super.focusSearch(view, i12);
    }

    public final void g(int[] iArr) {
        int iE = this.mChildHelper.e();
        if (iE == 0) {
            iArr[0] = -1;
            iArr[1] = -1;
            return;
        }
        int i10 = Integer.MAX_VALUE;
        int i11 = Integer.MIN_VALUE;
        for (int i12 = 0; i12 < iE; i12++) {
            j2 childViewHolderInt = getChildViewHolderInt(this.mChildHelper.d(i12));
            if (!childViewHolderInt.shouldIgnore()) {
                int layoutPosition = childViewHolderInt.getLayoutPosition();
                if (layoutPosition < i10) {
                    i10 = layoutPosition;
                }
                if (layoutPosition > i11) {
                    i11 = layoutPosition;
                }
            }
        }
        iArr[0] = i10;
        iArr[1] = i11;
    }

    @Override // android.view.ViewGroup
    public ViewGroup.LayoutParams generateDefaultLayoutParams() {
        q1 q1Var = this.mLayout;
        if (q1Var != null) {
            return q1Var.generateDefaultLayoutParams();
        }
        throw new IllegalStateException(defpackage.e.d(this, new StringBuilder("RecyclerView has no LayoutManager")));
    }

    @Override // android.view.ViewGroup
    public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
        q1 q1Var = this.mLayout;
        if (q1Var != null) {
            return q1Var.generateLayoutParams(getContext(), attributeSet);
        }
        throw new IllegalStateException(defpackage.e.d(this, new StringBuilder("RecyclerView has no LayoutManager")));
    }

    @Override // android.view.ViewGroup, android.view.View
    public CharSequence getAccessibilityClassName() {
        return "androidx.recyclerview.widget.RecyclerView";
    }

    @Nullable
    public d1 getAdapter() {
        return this.mAdapter;
    }

    public int getAdapterPositionInRecyclerView(j2 j2Var) {
        if (j2Var.hasAnyOfTheFlags(524) || !j2Var.isBound()) {
            return -1;
        }
        c cVar = this.mAdapterHelper;
        int i10 = j2Var.mPosition;
        ArrayList arrayList = cVar.f3673b;
        int size = arrayList.size();
        for (int i11 = 0; i11 < size; i11++) {
            b bVar = (b) arrayList.get(i11);
            int i12 = bVar.f3664a;
            if (i12 != 1) {
                if (i12 == 2) {
                    int i13 = bVar.f3665b;
                    if (i13 <= i10) {
                        int i14 = bVar.f3667d;
                        if (i13 + i14 > i10) {
                            return -1;
                        }
                        i10 -= i14;
                    } else {
                        continue;
                    }
                } else if (i12 == 8) {
                    int i15 = bVar.f3665b;
                    if (i15 == i10) {
                        i10 = bVar.f3667d;
                    } else {
                        if (i15 < i10) {
                            i10--;
                        }
                        if (bVar.f3667d <= i10) {
                            i10++;
                        }
                    }
                }
            } else if (bVar.f3665b <= i10) {
                i10 += bVar.f3667d;
            }
        }
        return i10;
    }

    @Override // android.view.View
    public int getBaseline() {
        q1 q1Var = this.mLayout;
        return q1Var != null ? q1Var.getBaseline() : super.getBaseline();
    }

    public long getChangedHolderKey(j2 j2Var) {
        return this.mAdapter.hasStableIds() ? j2Var.getItemId() : j2Var.mPosition;
    }

    public int getChildAdapterPosition(@NonNull View view) {
        j2 childViewHolderInt = getChildViewHolderInt(view);
        if (childViewHolderInt != null) {
            return childViewHolderInt.getAbsoluteAdapterPosition();
        }
        return -1;
    }

    @Override // android.view.ViewGroup
    public int getChildDrawingOrder(int i10, int i11) {
        g1 g1Var = this.mChildDrawingOrderCallback;
        if (g1Var == null) {
            return super.getChildDrawingOrder(i10, i11);
        }
        n0 n0Var = (n0) ((xyz.stream.utils.a0) g1Var).f36098a;
        View view = n0Var.f3812w;
        if (view == null) {
            return i11;
        }
        int iIndexOfChild = n0Var.f3813x;
        if (iIndexOfChild == -1) {
            iIndexOfChild = n0Var.f3807r.indexOfChild(view);
            n0Var.f3813x = iIndexOfChild;
        }
        return i11 == i10 + (-1) ? iIndexOfChild : i11 < iIndexOfChild ? i11 : i11 + 1;
    }

    public long getChildItemId(@NonNull View view) {
        j2 childViewHolderInt;
        d1 d1Var = this.mAdapter;
        if (d1Var == null || !d1Var.hasStableIds() || (childViewHolderInt = getChildViewHolderInt(view)) == null) {
            return -1L;
        }
        return childViewHolderInt.getItemId();
    }

    public int getChildLayoutPosition(@NonNull View view) {
        j2 childViewHolderInt = getChildViewHolderInt(view);
        if (childViewHolderInt != null) {
            return childViewHolderInt.getLayoutPosition();
        }
        return -1;
    }

    @Deprecated
    public int getChildPosition(@NonNull View view) {
        return getChildAdapterPosition(view);
    }

    public j2 getChildViewHolder(@NonNull View view) {
        ViewParent parent = view.getParent();
        if (parent == null || parent == this) {
            return getChildViewHolderInt(view);
        }
        throw new IllegalArgumentException("View " + view + " is not a direct child of " + this);
    }

    @Override // android.view.ViewGroup
    public boolean getClipToPadding() {
        return this.mClipToPadding;
    }

    @Nullable
    public l2 getCompatAccessibilityDelegate() {
        return this.mAccessibilityDelegate;
    }

    public void getDecoratedBoundsWithMargins(@NonNull View view, @NonNull Rect rect) {
        getDecoratedBoundsWithMarginsInt(view, rect);
    }

    @NonNull
    public h1 getEdgeEffectFactory() {
        return this.mEdgeEffectFactory;
    }

    @Nullable
    public l1 getItemAnimator() {
        return this.mItemAnimator;
    }

    public Rect getItemDecorInsetsForChild(View view) {
        r1 r1Var = (r1) view.getLayoutParams();
        if (!r1Var.mInsetsDirty) {
            return r1Var.mDecorInsets;
        }
        if (this.mState.f3706g && (r1Var.isItemChanged() || r1Var.isViewInvalid())) {
            return r1Var.mDecorInsets;
        }
        Rect rect = r1Var.mDecorInsets;
        rect.set(0, 0, 0, 0);
        int size = this.mItemDecorations.size();
        for (int i10 = 0; i10 < size; i10++) {
            this.mTempRect.set(0, 0, 0, 0);
            this.mItemDecorations.get(i10).getItemOffsets(this.mTempRect, view, this, this.mState);
            int i11 = rect.left;
            Rect rect2 = this.mTempRect;
            rect.left = i11 + rect2.left;
            rect.top += rect2.top;
            rect.right += rect2.right;
            rect.bottom += rect2.bottom;
        }
        r1Var.mInsetsDirty = false;
        return rect;
    }

    @NonNull
    public m1 getItemDecorationAt(int i10) {
        int itemDecorationCount = getItemDecorationCount();
        if (i10 >= 0 && i10 < itemDecorationCount) {
            return this.mItemDecorations.get(i10);
        }
        throw new IndexOutOfBoundsException(i10 + " is an invalid index for size " + itemDecorationCount);
    }

    public int getItemDecorationCount() {
        return this.mItemDecorations.size();
    }

    @Nullable
    public q1 getLayoutManager() {
        return this.mLayout;
    }

    public int getMaxFlingVelocity() {
        return this.mMaxFlingVelocity;
    }

    public int getMinFlingVelocity() {
        return this.mMinFlingVelocity;
    }

    public long getNanoTime() {
        if (ALLOW_THREAD_GAP_WORK) {
            return System.nanoTime();
        }
        return 0L;
    }

    @Nullable
    public t1 getOnFlingListener() {
        return this.mOnFlingListener;
    }

    public boolean getPreserveFocusAfterLayout() {
        return this.mPreserveFocusAfterLayout;
    }

    @NonNull
    public x1 getRecycledViewPool() {
        return this.mRecycler.c();
    }

    public int getScrollState() {
        return this.mScrollState;
    }

    public final void h(MotionEvent motionEvent) {
        int actionIndex = motionEvent.getActionIndex();
        if (motionEvent.getPointerId(actionIndex) == this.mScrollPointerId) {
            int i10 = actionIndex == 0 ? 1 : 0;
            this.mScrollPointerId = motionEvent.getPointerId(i10);
            int x10 = (int) (motionEvent.getX(i10) + 0.5f);
            this.mLastTouchX = x10;
            this.mInitialTouchX = x10;
            int y10 = (int) (motionEvent.getY(i10) + 0.5f);
            this.mLastTouchY = y10;
            this.mInitialTouchY = y10;
        }
    }

    public boolean hasFixedSize() {
        return this.mHasFixedSize;
    }

    @Override // android.view.View
    public boolean hasNestedScrollingParent() {
        return getScrollingChildHelper().d(0);
    }

    public boolean hasPendingAdapterUpdates() {
        return !this.mFirstLayoutComplete || this.mDataSetHasChangedAfterLayout || this.mAdapterHelper.g();
    }

    public final void i() {
        boolean z10;
        boolean z11 = false;
        if (this.mDataSetHasChangedAfterLayout) {
            c cVar = this.mAdapterHelper;
            cVar.l(cVar.f3673b);
            cVar.l(cVar.f3674c);
            cVar.f3677f = 0;
            if (this.mDispatchItemsChangedEvent) {
                this.mLayout.onItemsChanged(this);
            }
        }
        if (this.mItemAnimator == null || !this.mLayout.supportsPredictiveItemAnimations()) {
            this.mAdapterHelper.c();
        } else {
            this.mAdapterHelper.j();
        }
        boolean z12 = this.mItemsAddedOrRemoved || this.mItemsChanged;
        this.mState.f3709j = this.mFirstLayoutComplete && this.mItemAnimator != null && ((z10 = this.mDataSetHasChangedAfterLayout) || z12 || this.mLayout.mRequestedSimpleAnimations) && (!z10 || this.mAdapter.hasStableIds());
        f2 f2Var = this.mState;
        if (f2Var.f3709j && z12 && !this.mDataSetHasChangedAfterLayout && this.mItemAnimator != null && this.mLayout.supportsPredictiveItemAnimations()) {
            z11 = true;
        }
        f2Var.f3710k = z11;
    }

    public void initAdapterManager() {
        this.mAdapterHelper = new c(new c1(this));
    }

    @VisibleForTesting
    public void initFastScroller(StateListDrawable stateListDrawable, Drawable drawable, StateListDrawable stateListDrawable2, Drawable drawable2) {
        if (stateListDrawable == null || drawable == null || stateListDrawable2 == null || drawable2 == null) {
            throw new IllegalArgumentException(defpackage.e.d(this, new StringBuilder("Trying to set fast scroller without both required drawables.")));
        }
        Resources resources = getContext().getResources();
        new w(this, stateListDrawable, drawable, stateListDrawable2, drawable2, resources.getDimensionPixelSize(e3.b.fastscroll_default_thickness), resources.getDimensionPixelSize(e3.b.fastscroll_minimum_range), resources.getDimensionPixelOffset(e3.b.fastscroll_margin));
    }

    public void invalidateGlows() {
        this.mBottomGlow = null;
        this.mTopGlow = null;
        this.mRightGlow = null;
        this.mLeftGlow = null;
    }

    public void invalidateItemDecorations() {
        if (this.mItemDecorations.size() == 0) {
            return;
        }
        q1 q1Var = this.mLayout;
        if (q1Var != null) {
            q1Var.assertNotInLayoutOrScroll("Cannot invalidate item decorations during a scroll or layout");
        }
        markItemDecorInsetsDirty();
        requestLayout();
    }

    public boolean isAccessibilityEnabled() {
        AccessibilityManager accessibilityManager = this.mAccessibilityManager;
        return accessibilityManager != null && accessibilityManager.isEnabled();
    }

    public boolean isAnimating() {
        l1 l1Var = this.mItemAnimator;
        return l1Var != null && l1Var.f();
    }

    @Override // android.view.View
    public boolean isAttachedToWindow() {
        return this.mIsAttached;
    }

    public boolean isComputingLayout() {
        return this.mLayoutOrScrollCounter > 0;
    }

    @Deprecated
    public boolean isLayoutFrozen() {
        return isLayoutSuppressed();
    }

    @Override // android.view.ViewGroup
    public final boolean isLayoutSuppressed() {
        return this.mLayoutSuppressed;
    }

    @Override // android.view.View
    public boolean isNestedScrollingEnabled() {
        return getScrollingChildHelper().f1752d;
    }

    public final int j(float f10, int i10) {
        float height = f10 / getHeight();
        float width = i10 / getWidth();
        EdgeEffect edgeEffect = this.mLeftGlow;
        float f11 = 0.0f;
        if (edgeEffect == null || u0.h.a(edgeEffect) == 0.0f) {
            EdgeEffect edgeEffect2 = this.mRightGlow;
            if (edgeEffect2 != null && u0.h.a(edgeEffect2) != 0.0f) {
                if (canScrollHorizontally(1)) {
                    this.mRightGlow.onRelease();
                } else {
                    float fB = u0.h.b(this.mRightGlow, width, height);
                    if (u0.h.a(this.mRightGlow) == 0.0f) {
                        this.mRightGlow.onRelease();
                    }
                    f11 = fB;
                }
                invalidate();
            }
        } else {
            if (canScrollHorizontally(-1)) {
                this.mLeftGlow.onRelease();
            } else {
                float f12 = -u0.h.b(this.mLeftGlow, -width, 1.0f - height);
                if (u0.h.a(this.mLeftGlow) == 0.0f) {
                    this.mLeftGlow.onRelease();
                }
                f11 = f12;
            }
            invalidate();
        }
        return Math.round(f11 * getWidth());
    }

    public void jumpToPositionForSmoothScroller(int i10) {
        if (this.mLayout == null) {
            return;
        }
        setScrollState(2);
        this.mLayout.scrollToPosition(i10);
        awakenScrollBars();
    }

    public final int k(float f10, int i10) {
        float width = f10 / getWidth();
        float height = i10 / getHeight();
        EdgeEffect edgeEffect = this.mTopGlow;
        float f11 = 0.0f;
        if (edgeEffect == null || u0.h.a(edgeEffect) == 0.0f) {
            EdgeEffect edgeEffect2 = this.mBottomGlow;
            if (edgeEffect2 != null && u0.h.a(edgeEffect2) != 0.0f) {
                if (canScrollVertically(1)) {
                    this.mBottomGlow.onRelease();
                } else {
                    float fB = u0.h.b(this.mBottomGlow, height, 1.0f - width);
                    if (u0.h.a(this.mBottomGlow) == 0.0f) {
                        this.mBottomGlow.onRelease();
                    }
                    f11 = fB;
                }
                invalidate();
            }
        } else {
            if (canScrollVertically(-1)) {
                this.mTopGlow.onRelease();
            } else {
                float f12 = -u0.h.b(this.mTopGlow, -height, width);
                if (u0.h.a(this.mTopGlow) == 0.0f) {
                    this.mTopGlow.onRelease();
                }
                f11 = f12;
            }
            invalidate();
        }
        return Math.round(f11 * getHeight());
    }

    public final void l() {
        VelocityTracker velocityTracker = this.mVelocityTracker;
        if (velocityTracker != null) {
            velocityTracker.clear();
        }
        boolean zIsFinished = false;
        stopNestedScroll(0);
        EdgeEffect edgeEffect = this.mLeftGlow;
        if (edgeEffect != null) {
            edgeEffect.onRelease();
            zIsFinished = this.mLeftGlow.isFinished();
        }
        EdgeEffect edgeEffect2 = this.mTopGlow;
        if (edgeEffect2 != null) {
            edgeEffect2.onRelease();
            zIsFinished |= this.mTopGlow.isFinished();
        }
        EdgeEffect edgeEffect3 = this.mRightGlow;
        if (edgeEffect3 != null) {
            edgeEffect3.onRelease();
            zIsFinished |= this.mRightGlow.isFinished();
        }
        EdgeEffect edgeEffect4 = this.mBottomGlow;
        if (edgeEffect4 != null) {
            edgeEffect4.onRelease();
            zIsFinished |= this.mBottomGlow.isFinished();
        }
        if (zIsFinished) {
            WeakHashMap weakHashMap = androidx.core.view.s1.f1815a;
            postInvalidateOnAnimation();
        }
    }

    public final boolean m(EdgeEffect edgeEffect, int i10, int i11) {
        if (i10 > 0) {
            return true;
        }
        float fA = u0.h.a(edgeEffect) * i11;
        double dLog = Math.log((Math.abs(-i10) * INFLEXION) / (this.mPhysicalCoef * SCROLL_FRICTION));
        double d10 = DECELERATION_RATE;
        return ((float) (Math.exp((d10 / (d10 - 1.0d)) * dLog) * ((double) (this.mPhysicalCoef * SCROLL_FRICTION)))) < fA;
    }

    public void markItemDecorInsetsDirty() {
        int iH = this.mChildHelper.h();
        for (int i10 = 0; i10 < iH; i10++) {
            ((r1) this.mChildHelper.g(i10).getLayoutParams()).mInsetsDirty = true;
        }
        ArrayList arrayList = this.mRecycler.f3970c;
        int size = arrayList.size();
        for (int i11 = 0; i11 < size; i11++) {
            r1 r1Var = (r1) ((j2) arrayList.get(i11)).itemView.getLayoutParams();
            if (r1Var != null) {
                r1Var.mInsetsDirty = true;
            }
        }
    }

    public void markKnownViewsInvalid() {
        int iH = this.mChildHelper.h();
        for (int i10 = 0; i10 < iH; i10++) {
            j2 childViewHolderInt = getChildViewHolderInt(this.mChildHelper.g(i10));
            if (childViewHolderInt != null && !childViewHolderInt.shouldIgnore()) {
                childViewHolderInt.addFlags(6);
            }
        }
        markItemDecorInsetsDirty();
        y1 y1Var = this.mRecycler;
        ArrayList arrayList = y1Var.f3970c;
        int size = arrayList.size();
        for (int i11 = 0; i11 < size; i11++) {
            j2 j2Var = (j2) arrayList.get(i11);
            if (j2Var != null) {
                j2Var.addFlags(6);
                j2Var.addChangePayload(null);
            }
        }
        d1 d1Var = y1Var.f3975h.mAdapter;
        if (d1Var == null || !d1Var.hasStableIds()) {
            y1Var.h();
        }
    }

    public void nestedScrollBy(int i10, int i11) {
        nestedScrollByInternal(i10, i11, null, 1);
    }

    public void offsetChildrenHorizontal(@Px int i10) {
        int iE = this.mChildHelper.e();
        for (int i11 = 0; i11 < iE; i11++) {
            this.mChildHelper.d(i11).offsetLeftAndRight(i10);
        }
    }

    public void offsetChildrenVertical(@Px int i10) {
        int iE = this.mChildHelper.e();
        for (int i11 = 0; i11 < iE; i11++) {
            this.mChildHelper.d(i11).offsetTopAndBottom(i10);
        }
    }

    public void offsetPositionRecordsForInsert(int i10, int i11) {
        int iH = this.mChildHelper.h();
        for (int i12 = 0; i12 < iH; i12++) {
            j2 childViewHolderInt = getChildViewHolderInt(this.mChildHelper.g(i12));
            if (childViewHolderInt != null && !childViewHolderInt.shouldIgnore() && childViewHolderInt.mPosition >= i10) {
                if (sVerboseLoggingEnabled) {
                    childViewHolderInt.toString();
                }
                childViewHolderInt.offsetPosition(i11, false);
                this.mState.f3705f = true;
            }
        }
        ArrayList arrayList = this.mRecycler.f3970c;
        int size = arrayList.size();
        for (int i13 = 0; i13 < size; i13++) {
            j2 j2Var = (j2) arrayList.get(i13);
            if (j2Var != null && j2Var.mPosition >= i10) {
                if (sVerboseLoggingEnabled) {
                    j2Var.toString();
                }
                j2Var.offsetPosition(i11, false);
            }
        }
        requestLayout();
    }

    public void offsetPositionRecordsForMove(int i10, int i11) {
        int i12;
        int i13;
        int i14;
        int i15;
        int i16;
        int i17;
        int i18;
        int iH = this.mChildHelper.h();
        int i19 = -1;
        if (i10 < i11) {
            i13 = i10;
            i12 = i11;
            i14 = -1;
        } else {
            i12 = i10;
            i13 = i11;
            i14 = 1;
        }
        for (int i20 = 0; i20 < iH; i20++) {
            j2 childViewHolderInt = getChildViewHolderInt(this.mChildHelper.g(i20));
            if (childViewHolderInt != null && (i18 = childViewHolderInt.mPosition) >= i13 && i18 <= i12) {
                if (sVerboseLoggingEnabled) {
                    childViewHolderInt.toString();
                }
                if (childViewHolderInt.mPosition == i10) {
                    childViewHolderInt.offsetPosition(i11 - i10, false);
                } else {
                    childViewHolderInt.offsetPosition(i14, false);
                }
                this.mState.f3705f = true;
            }
        }
        y1 y1Var = this.mRecycler;
        y1Var.getClass();
        if (i10 < i11) {
            i16 = i10;
            i15 = i11;
        } else {
            i15 = i10;
            i19 = 1;
            i16 = i11;
        }
        ArrayList arrayList = y1Var.f3970c;
        int size = arrayList.size();
        for (int i21 = 0; i21 < size; i21++) {
            j2 j2Var = (j2) arrayList.get(i21);
            if (j2Var != null && (i17 = j2Var.mPosition) >= i16 && i17 <= i15) {
                if (i17 == i10) {
                    j2Var.offsetPosition(i11 - i10, false);
                } else {
                    j2Var.offsetPosition(i19, false);
                }
                if (sVerboseLoggingEnabled) {
                    j2Var.toString();
                }
            }
        }
        requestLayout();
    }

    public void offsetPositionRecordsForRemove(int i10, int i11, boolean z10) {
        int i12 = i10 + i11;
        int iH = this.mChildHelper.h();
        for (int i13 = 0; i13 < iH; i13++) {
            j2 childViewHolderInt = getChildViewHolderInt(this.mChildHelper.g(i13));
            if (childViewHolderInt != null && !childViewHolderInt.shouldIgnore()) {
                int i14 = childViewHolderInt.mPosition;
                if (i14 >= i12) {
                    if (sVerboseLoggingEnabled) {
                        childViewHolderInt.toString();
                    }
                    childViewHolderInt.offsetPosition(-i11, z10);
                    this.mState.f3705f = true;
                } else if (i14 >= i10) {
                    if (sVerboseLoggingEnabled) {
                        childViewHolderInt.toString();
                    }
                    childViewHolderInt.flagRemovedAndOffsetPosition(i10 - 1, -i11, z10);
                    this.mState.f3705f = true;
                }
            }
        }
        y1 y1Var = this.mRecycler;
        ArrayList arrayList = y1Var.f3970c;
        for (int size = arrayList.size() - 1; size >= 0; size--) {
            j2 j2Var = (j2) arrayList.get(size);
            if (j2Var != null) {
                int i15 = j2Var.mPosition;
                if (i15 >= i12) {
                    if (sVerboseLoggingEnabled) {
                        j2Var.toString();
                    }
                    j2Var.offsetPosition(-i11, z10);
                } else if (i15 >= i10) {
                    j2Var.addFlags(8);
                    y1Var.i(size);
                }
            }
        }
        requestLayout();
    }

    /* JADX WARN: Removed duplicated region for block: B:21:0x0061  */
    @Override // android.view.ViewGroup, android.view.View
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public void onAttachedToWindow() {
        float refreshRate;
        super.onAttachedToWindow();
        this.mLayoutOrScrollCounter = 0;
        this.mIsAttached = true;
        this.mFirstLayoutComplete = this.mFirstLayoutComplete && !isLayoutRequested();
        this.mRecycler.f();
        q1 q1Var = this.mLayout;
        if (q1Var != null) {
            q1Var.dispatchAttachedToWindow(this);
        }
        this.mPostedAnimatorRunner = false;
        if (ALLOW_THREAD_GAP_WORK) {
            ThreadLocal threadLocal = z.f3976e;
            z zVar = (z) threadLocal.get();
            this.mGapWorker = zVar;
            if (zVar == null) {
                z zVar2 = new z();
                zVar2.f3978a = new ArrayList();
                zVar2.f3981d = new ArrayList();
                this.mGapWorker = zVar2;
                Display display = androidx.core.view.s1.getDisplay(this);
                if (isInEditMode() || display == null) {
                    refreshRate = 60.0f;
                    z zVar3 = this.mGapWorker;
                    zVar3.f3980c = (long) (1.0E9f / refreshRate);
                    threadLocal.set(zVar3);
                } else {
                    refreshRate = display.getRefreshRate();
                    if (refreshRate < 30.0f) {
                    }
                    z zVar32 = this.mGapWorker;
                    zVar32.f3980c = (long) (1.0E9f / refreshRate);
                    threadLocal.set(zVar32);
                }
            }
            z zVar4 = this.mGapWorker;
            zVar4.getClass();
            boolean z10 = sDebugAssertionsEnabled;
            ArrayList arrayList = zVar4.f3978a;
            if (z10 && arrayList.contains(this)) {
                throw new IllegalStateException("RecyclerView already present in worker list!");
            }
            arrayList.add(this);
        }
    }

    public void onChildAttachedToWindow(View view) {
    }

    public void onChildDetachedFromWindow(@NonNull View view) {
    }

    @Override // android.view.ViewGroup, android.view.View
    public void onDetachedFromWindow() {
        z zVar;
        super.onDetachedFromWindow();
        l1 l1Var = this.mItemAnimator;
        if (l1Var != null) {
            l1Var.e();
        }
        stopScroll();
        this.mIsAttached = false;
        q1 q1Var = this.mLayout;
        if (q1Var != null) {
            q1Var.dispatchDetachedFromWindow(this, this.mRecycler);
        }
        this.mPendingAccessibilityImportanceChange.clear();
        removeCallbacks(this.mItemAnimatorRunner);
        this.mViewInfoStore.getClass();
        while (x2.f3959b.acquire() != null) {
        }
        y1 y1Var = this.mRecycler;
        int i10 = 0;
        while (true) {
            ArrayList arrayList = y1Var.f3970c;
            if (i10 >= arrayList.size()) {
                break;
            }
            w0.a.a(((j2) arrayList.get(i10)).itemView);
            i10++;
        }
        y1Var.g(y1Var.f3975h.mAdapter, false);
        int i11 = w0.a.f34112a;
        for (View view : new androidx.core.view.v1(this, 1)) {
            int i12 = w0.a.f34112a;
            w0.b bVar = (w0.b) view.getTag(i12);
            if (bVar == null) {
                bVar = new w0.b();
                view.setTag(i12, bVar);
            }
            ArrayList arrayList2 = bVar.f34114a;
            int iB0 = hb.a.b0(arrayList2);
            if (-1 < iB0) {
                com.google.android.gms.measurement.internal.u1.x(arrayList2.get(iB0));
                throw null;
            }
        }
        if (!ALLOW_THREAD_GAP_WORK || (zVar = this.mGapWorker) == null) {
            return;
        }
        boolean zRemove = zVar.f3978a.remove(this);
        if (sDebugAssertionsEnabled && !zRemove) {
            throw new IllegalStateException("RecyclerView removal failed!");
        }
        this.mGapWorker = null;
    }

    @Override // android.view.View
    public void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        int size = this.mItemDecorations.size();
        for (int i10 = 0; i10 < size; i10++) {
            this.mItemDecorations.get(i10).onDraw(canvas, this, this.mState);
        }
    }

    public void onEnterLayoutOrScroll() {
        this.mLayoutOrScrollCounter++;
    }

    public void onExitLayoutOrScroll() {
        onExitLayoutOrScroll(true);
    }

    /* JADX WARN: Removed duplicated region for block: B:28:0x0062  */
    /* JADX WARN: Removed duplicated region for block: B:31:0x0068  */
    /* JADX WARN: Removed duplicated region for block: B:33:0x006c  */
    @Override // android.view.View
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public boolean onGenericMotionEvent(MotionEvent motionEvent) {
        float f10;
        float axisValue;
        if (this.mLayout != null && !this.mLayoutSuppressed && motionEvent.getAction() == 8) {
            if ((motionEvent.getSource() & 2) != 0) {
                f10 = this.mLayout.canScrollVertically() ? -motionEvent.getAxisValue(9) : 0.0f;
                axisValue = this.mLayout.canScrollHorizontally() ? motionEvent.getAxisValue(10) : 0.0f;
                if (f10 != 0.0f || axisValue != 0.0f) {
                    nestedScrollByInternal((int) (axisValue * this.mScaledHorizontalScrollFactor), (int) (f10 * this.mScaledVerticalScrollFactor), motionEvent, 1);
                }
            } else if ((motionEvent.getSource() & 4194304) != 0) {
                float axisValue2 = motionEvent.getAxisValue(26);
                if (this.mLayout.canScrollVertically()) {
                    f10 = -axisValue2;
                    if (f10 != 0.0f) {
                        nestedScrollByInternal((int) (axisValue * this.mScaledHorizontalScrollFactor), (int) (f10 * this.mScaledVerticalScrollFactor), motionEvent, 1);
                    }
                } else {
                    if (this.mLayout.canScrollHorizontally()) {
                        axisValue = axisValue2;
                        f10 = 0.0f;
                    } else {
                        f10 = 0.0f;
                        axisValue = 0.0f;
                    }
                    if (f10 != 0.0f) {
                    }
                }
            }
        }
        return false;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:85:0x0194  */
    @Override // android.view.ViewGroup
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
        boolean z10;
        boolean z11;
        if (this.mLayoutSuppressed) {
            return false;
        }
        this.mInterceptingOnItemTouchListener = null;
        if (f(motionEvent)) {
            l();
            setScrollState(0);
            return true;
        }
        q1 q1Var = this.mLayout;
        if (q1Var == null) {
            return false;
        }
        boolean zCanScrollHorizontally = q1Var.canScrollHorizontally();
        boolean zCanScrollVertically = this.mLayout.canScrollVertically();
        if (this.mVelocityTracker == null) {
            this.mVelocityTracker = VelocityTracker.obtain();
        }
        this.mVelocityTracker.addMovement(motionEvent);
        int actionMasked = motionEvent.getActionMasked();
        int actionIndex = motionEvent.getActionIndex();
        if (actionMasked == 0) {
            if (this.mIgnoreMotionEventTillDown) {
                this.mIgnoreMotionEventTillDown = false;
            }
            this.mScrollPointerId = motionEvent.getPointerId(0);
            int x10 = (int) (motionEvent.getX() + 0.5f);
            this.mLastTouchX = x10;
            this.mInitialTouchX = x10;
            int y10 = (int) (motionEvent.getY() + 0.5f);
            this.mLastTouchY = y10;
            this.mInitialTouchY = y10;
            EdgeEffect edgeEffect = this.mLeftGlow;
            if (edgeEffect == null || u0.h.a(edgeEffect) == 0.0f || canScrollHorizontally(-1)) {
                z10 = false;
            } else {
                u0.h.b(this.mLeftGlow, 0.0f, 1.0f - (motionEvent.getY() / getHeight()));
                z10 = true;
            }
            EdgeEffect edgeEffect2 = this.mRightGlow;
            boolean z12 = z10;
            if (edgeEffect2 != null) {
                z12 = z10;
                if (u0.h.a(edgeEffect2) != 0.0f) {
                    z12 = z10;
                    if (!canScrollHorizontally(1)) {
                        u0.h.b(this.mRightGlow, 0.0f, motionEvent.getY() / getHeight());
                        z12 = true;
                    }
                }
            }
            EdgeEffect edgeEffect3 = this.mTopGlow;
            boolean z13 = z12;
            if (edgeEffect3 != null) {
                z13 = z12;
                if (u0.h.a(edgeEffect3) != 0.0f) {
                    z13 = z12;
                    if (!canScrollVertically(-1)) {
                        u0.h.b(this.mTopGlow, 0.0f, motionEvent.getX() / getWidth());
                        z13 = true;
                    }
                }
            }
            EdgeEffect edgeEffect4 = this.mBottomGlow;
            if (edgeEffect4 == null || u0.h.a(edgeEffect4) == 0.0f || canScrollVertically(1)) {
                if (z13 || this.mScrollState == 2) {
                }
                int[] iArr = this.mNestedOffsets;
                iArr[1] = 0;
                iArr[0] = 0;
                int i10 = zCanScrollHorizontally;
                if (zCanScrollVertically) {
                    i10 = (zCanScrollHorizontally ? 1 : 0) | 2;
                }
                startNestedScroll(i10, 0);
            } else {
                u0.h.b(this.mBottomGlow, 0.0f, 1.0f - (motionEvent.getX() / getWidth()));
            }
            getParent().requestDisallowInterceptTouchEvent(true);
            setScrollState(1);
            stopNestedScroll(1);
            int[] iArr2 = this.mNestedOffsets;
            iArr2[1] = 0;
            iArr2[0] = 0;
            int i102 = zCanScrollHorizontally;
            if (zCanScrollVertically) {
            }
            startNestedScroll(i102, 0);
        } else if (actionMasked == 1) {
            this.mVelocityTracker.clear();
            stopNestedScroll(0);
        } else if (actionMasked == 2) {
            int iFindPointerIndex = motionEvent.findPointerIndex(this.mScrollPointerId);
            if (iFindPointerIndex < 0) {
                return false;
            }
            int x11 = (int) (motionEvent.getX(iFindPointerIndex) + 0.5f);
            int y11 = (int) (motionEvent.getY(iFindPointerIndex) + 0.5f);
            if (this.mScrollState != 1) {
                int i11 = x11 - this.mInitialTouchX;
                int i12 = y11 - this.mInitialTouchY;
                if (!zCanScrollHorizontally || Math.abs(i11) <= this.mTouchSlop) {
                    z11 = false;
                } else {
                    this.mLastTouchX = x11;
                    z11 = true;
                }
                if (zCanScrollVertically && Math.abs(i12) > this.mTouchSlop) {
                    this.mLastTouchY = y11;
                } else if (z11) {
                }
                setScrollState(1);
            }
        } else if (actionMasked == 3) {
            l();
            setScrollState(0);
        } else if (actionMasked == 5) {
            this.mScrollPointerId = motionEvent.getPointerId(actionIndex);
            int x12 = (int) (motionEvent.getX(actionIndex) + 0.5f);
            this.mLastTouchX = x12;
            this.mInitialTouchX = x12;
            int y12 = (int) (motionEvent.getY(actionIndex) + 0.5f);
            this.mLastTouchY = y12;
            this.mInitialTouchY = y12;
        } else if (actionMasked == 6) {
            h(motionEvent);
        }
        return this.mScrollState == 1;
    }

    @Override // android.view.ViewGroup, android.view.View
    public void onLayout(boolean z10, int i10, int i11, int i12, int i13) {
        int i14 = m0.k.f30289a;
        Trace.beginSection(TRACE_ON_LAYOUT_TAG);
        dispatchLayout();
        Trace.endSection();
        this.mFirstLayoutComplete = true;
    }

    @Override // android.view.View
    public void onMeasure(int i10, int i11) {
        q1 q1Var = this.mLayout;
        if (q1Var == null) {
            defaultOnMeasure(i10, i11);
            return;
        }
        boolean z10 = false;
        if (q1Var.isAutoMeasureEnabled()) {
            int mode = View.MeasureSpec.getMode(i10);
            int mode2 = View.MeasureSpec.getMode(i11);
            this.mLayout.onMeasure(this.mRecycler, this.mState, i10, i11);
            if (mode == 1073741824 && mode2 == 1073741824) {
                z10 = true;
            }
            this.mLastAutoMeasureSkippedDueToExact = z10;
            if (z10 || this.mAdapter == null) {
                return;
            }
            if (this.mState.f3703d == 1) {
                c();
            }
            this.mLayout.setMeasureSpecs(i10, i11);
            this.mState.f3708i = true;
            e();
            this.mLayout.setMeasuredDimensionFromChildren(i10, i11);
            if (this.mLayout.shouldMeasureTwice()) {
                this.mLayout.setMeasureSpecs(View.MeasureSpec.makeMeasureSpec(getMeasuredWidth(), 1073741824), View.MeasureSpec.makeMeasureSpec(getMeasuredHeight(), 1073741824));
                this.mState.f3708i = true;
                e();
                this.mLayout.setMeasuredDimensionFromChildren(i10, i11);
            }
            this.mLastAutoMeasureNonExactMeasuredWidth = getMeasuredWidth();
            this.mLastAutoMeasureNonExactMeasuredHeight = getMeasuredHeight();
            return;
        }
        if (this.mHasFixedSize) {
            this.mLayout.onMeasure(this.mRecycler, this.mState, i10, i11);
            return;
        }
        if (this.mAdapterUpdateDuringMeasure) {
            startInterceptRequestLayout();
            onEnterLayoutOrScroll();
            i();
            onExitLayoutOrScroll();
            f2 f2Var = this.mState;
            if (f2Var.f3710k) {
                f2Var.f3706g = true;
            } else {
                this.mAdapterHelper.c();
                this.mState.f3706g = false;
            }
            this.mAdapterUpdateDuringMeasure = false;
            stopInterceptRequestLayout(false);
        } else if (this.mState.f3710k) {
            setMeasuredDimension(getMeasuredWidth(), getMeasuredHeight());
            return;
        }
        d1 d1Var = this.mAdapter;
        if (d1Var != null) {
            this.mState.f3704e = d1Var.getItemCount();
        } else {
            this.mState.f3704e = 0;
        }
        startInterceptRequestLayout();
        this.mLayout.onMeasure(this.mRecycler, this.mState, i10, i11);
        stopInterceptRequestLayout(false);
        this.mState.f3706g = false;
    }

    @Override // android.view.ViewGroup
    public boolean onRequestFocusInDescendants(int i10, Rect rect) {
        if (isComputingLayout()) {
            return false;
        }
        return super.onRequestFocusInDescendants(i10, rect);
    }

    @Override // android.view.View
    public void onRestoreInstanceState(Parcelable parcelable) {
        if (!(parcelable instanceof b2)) {
            super.onRestoreInstanceState(parcelable);
            return;
        }
        b2 b2Var = (b2) parcelable;
        this.mPendingSavedState = b2Var;
        super.onRestoreInstanceState(b2Var.getSuperState());
        requestLayout();
    }

    @Override // android.view.View
    public Parcelable onSaveInstanceState() {
        b2 b2Var = new b2(super.onSaveInstanceState());
        b2 b2Var2 = this.mPendingSavedState;
        if (b2Var2 != null) {
            b2Var.f3671c = b2Var2.f3671c;
        } else {
            q1 q1Var = this.mLayout;
            if (q1Var != null) {
                b2Var.f3671c = q1Var.onSaveInstanceState();
            } else {
                b2Var.f3671c = null;
            }
        }
        return b2Var;
    }

    public void onScrollStateChanged(int i10) {
    }

    public void onScrolled(@Px int i10, @Px int i11) {
    }

    @Override // android.view.View
    public void onSizeChanged(int i10, int i11, int i12, int i13) {
        super.onSizeChanged(i10, i11, i12, i13);
        if (i10 == i12 && i11 == i13) {
            return;
        }
        invalidateGlows();
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:49:0x00ce A[PHI: r0
      0x00ce: PHI (r0v40 int) = (r0v29 int), (r0v44 int) binds: [B:43:0x00b7, B:47:0x00ca] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:51:0x00d1  */
    /* JADX WARN: Removed duplicated region for block: B:57:0x00e7  */
    @Override // android.view.View
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public boolean onTouchEvent(MotionEvent motionEvent) {
        boolean z10;
        if (this.mLayoutSuppressed || this.mIgnoreMotionEventTillDown) {
            return false;
        }
        u1 u1Var = this.mInterceptingOnItemTouchListener;
        if (u1Var != null) {
            u1Var.a(motionEvent);
            int action = motionEvent.getAction();
            if (action == 3 || action == 1) {
                this.mInterceptingOnItemTouchListener = null;
            }
        } else if (motionEvent.getAction() == 0 || !f(motionEvent)) {
            q1 q1Var = this.mLayout;
            if (q1Var == null) {
                return false;
            }
            boolean zCanScrollHorizontally = q1Var.canScrollHorizontally();
            boolean zCanScrollVertically = this.mLayout.canScrollVertically();
            if (this.mVelocityTracker == null) {
                this.mVelocityTracker = VelocityTracker.obtain();
            }
            int actionMasked = motionEvent.getActionMasked();
            int actionIndex = motionEvent.getActionIndex();
            if (actionMasked == 0) {
                int[] iArr = this.mNestedOffsets;
                iArr[1] = 0;
                iArr[0] = 0;
            }
            MotionEvent motionEventObtain = MotionEvent.obtain(motionEvent);
            int[] iArr2 = this.mNestedOffsets;
            motionEventObtain.offsetLocation(iArr2[0], iArr2[1]);
            if (actionMasked == 0) {
                this.mScrollPointerId = motionEvent.getPointerId(0);
                int x10 = (int) (motionEvent.getX() + 0.5f);
                this.mLastTouchX = x10;
                this.mInitialTouchX = x10;
                int y10 = (int) (motionEvent.getY() + 0.5f);
                this.mLastTouchY = y10;
                this.mInitialTouchY = y10;
                int i10 = zCanScrollHorizontally;
                if (zCanScrollVertically) {
                    i10 = (zCanScrollHorizontally ? 1 : 0) | 2;
                }
                startNestedScroll(i10, 0);
            } else {
                if (actionMasked == 1) {
                    this.mVelocityTracker.addMovement(motionEventObtain);
                    this.mVelocityTracker.computeCurrentVelocity(1000, this.mMaxFlingVelocity);
                    float f10 = zCanScrollHorizontally ? -this.mVelocityTracker.getXVelocity(this.mScrollPointerId) : 0.0f;
                    float f11 = zCanScrollVertically ? -this.mVelocityTracker.getYVelocity(this.mScrollPointerId) : 0.0f;
                    if ((f10 == 0.0f && f11 == 0.0f) || !fling((int) f10, (int) f11)) {
                        setScrollState(0);
                    }
                    l();
                    motionEventObtain.recycle();
                    return true;
                }
                if (actionMasked == 2) {
                    int iFindPointerIndex = motionEvent.findPointerIndex(this.mScrollPointerId);
                    if (iFindPointerIndex < 0) {
                        return false;
                    }
                    int x11 = (int) (motionEvent.getX(iFindPointerIndex) + 0.5f);
                    int y11 = (int) (motionEvent.getY(iFindPointerIndex) + 0.5f);
                    int iMax = this.mLastTouchX - x11;
                    int iMax2 = this.mLastTouchY - y11;
                    if (this.mScrollState != 1) {
                        if (zCanScrollHorizontally) {
                            iMax = iMax > 0 ? Math.max(0, iMax - this.mTouchSlop) : Math.min(0, iMax + this.mTouchSlop);
                            if (iMax != 0) {
                                z10 = true;
                            }
                            if (zCanScrollVertically) {
                            }
                            if (z10) {
                            }
                        } else {
                            z10 = false;
                            if (zCanScrollVertically) {
                                iMax2 = iMax2 > 0 ? Math.max(0, iMax2 - this.mTouchSlop) : Math.min(0, iMax2 + this.mTouchSlop);
                                if (iMax2 != 0) {
                                    z10 = true;
                                }
                            }
                            if (z10) {
                                setScrollState(1);
                            }
                        }
                        motionEventObtain.recycle();
                        return true;
                    }
                    if (this.mScrollState == 1) {
                        int[] iArr3 = this.mReusableIntPair;
                        iArr3[0] = 0;
                        iArr3[1] = 0;
                        int iJ = iMax - j(motionEvent.getY(), iMax);
                        int iK = iMax2 - k(motionEvent.getX(), iMax2);
                        if (dispatchNestedPreScroll(zCanScrollHorizontally ? iJ : 0, zCanScrollVertically ? iK : 0, this.mReusableIntPair, this.mScrollOffset, 0)) {
                            int[] iArr4 = this.mReusableIntPair;
                            iJ -= iArr4[0];
                            iK -= iArr4[1];
                            int[] iArr5 = this.mNestedOffsets;
                            int i11 = iArr5[0];
                            int[] iArr6 = this.mScrollOffset;
                            iArr5[0] = i11 + iArr6[0];
                            iArr5[1] = iArr5[1] + iArr6[1];
                            getParent().requestDisallowInterceptTouchEvent(true);
                        }
                        int i12 = iK;
                        int[] iArr7 = this.mScrollOffset;
                        this.mLastTouchX = x11 - iArr7[0];
                        this.mLastTouchY = y11 - iArr7[1];
                        if (scrollByInternal(zCanScrollHorizontally ? iJ : 0, zCanScrollVertically ? i12 : 0, motionEvent, 0)) {
                            getParent().requestDisallowInterceptTouchEvent(true);
                        }
                        z zVar = this.mGapWorker;
                        if (zVar != null && (iJ != 0 || i12 != 0)) {
                            zVar.a(this, iJ, i12);
                        }
                    }
                } else if (actionMasked == 3) {
                    l();
                    setScrollState(0);
                } else if (actionMasked == 5) {
                    this.mScrollPointerId = motionEvent.getPointerId(actionIndex);
                    int x12 = (int) (motionEvent.getX(actionIndex) + 0.5f);
                    this.mLastTouchX = x12;
                    this.mInitialTouchX = x12;
                    int y12 = (int) (motionEvent.getY(actionIndex) + 0.5f);
                    this.mLastTouchY = y12;
                    this.mInitialTouchY = y12;
                } else if (actionMasked == 6) {
                    h(motionEvent);
                }
            }
            this.mVelocityTracker.addMovement(motionEventObtain);
            motionEventObtain.recycle();
            return true;
        }
        l();
        setScrollState(0);
        return true;
    }

    public void postAnimationRunner() {
        if (this.mPostedAnimatorRunner || !this.mIsAttached) {
            return;
        }
        Runnable runnable = this.mItemAnimatorRunner;
        WeakHashMap weakHashMap = androidx.core.view.s1.f1815a;
        postOnAnimation(runnable);
        this.mPostedAnimatorRunner = true;
    }

    public void processDataSetCompletelyChanged(boolean z10) {
        this.mDispatchItemsChangedEvent = z10 | this.mDispatchItemsChangedEvent;
        this.mDataSetHasChangedAfterLayout = true;
        markKnownViewsInvalid();
    }

    public void recordAnimationInfoIfBouncedHiddenView(j2 j2Var, k1 k1Var) {
        j2Var.setFlags(0, 8192);
        if (this.mState.f3707h && j2Var.isUpdated() && !j2Var.isRemoved() && !j2Var.shouldIgnore()) {
            this.mViewInfoStore.f3983b.e(getChangedHolderKey(j2Var), j2Var);
        }
        androidx.collection.s sVar = this.mViewInfoStore.f3982a;
        x2 x2VarA = (x2) sVar.get(j2Var);
        if (x2VarA == null) {
            x2VarA = x2.a();
            sVar.put(j2Var, x2VarA);
        }
        x2VarA.preInfo = k1Var;
        x2VarA.f3960a |= 4;
    }

    public void removeAndRecycleViews() {
        l1 l1Var = this.mItemAnimator;
        if (l1Var != null) {
            l1Var.e();
        }
        q1 q1Var = this.mLayout;
        if (q1Var != null) {
            q1Var.removeAndRecycleAllViews(this.mRecycler);
            this.mLayout.removeAndRecycleScrapInt(this.mRecycler);
        }
        y1 y1Var = this.mRecycler;
        y1Var.f3968a.clear();
        y1Var.h();
    }

    /* JADX WARN: Removed duplicated region for block: B:23:0x004d  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public boolean removeAnimatingView(View view) {
        startInterceptRequestLayout();
        f fVar = this.mChildHelper;
        d dVar = fVar.f3693b;
        e eVar = fVar.f3692a;
        int i10 = fVar.f3695d;
        boolean z10 = true;
        if (i10 != 1) {
            if (i10 == 2) {
                throw new IllegalStateException("Cannot call removeViewIfHidden within removeViewIfHidden");
            }
            try {
                fVar.f3695d = 2;
                int iIndexOfChild = ((c1) eVar).f3680a.indexOfChild(view);
                if (iIndexOfChild == -1) {
                    fVar.m(view);
                } else if (dVar.d(iIndexOfChild)) {
                    dVar.f(iIndexOfChild);
                    fVar.m(view);
                    ((c1) eVar).b(iIndexOfChild);
                } else {
                    fVar.f3695d = 0;
                }
                if (z10) {
                    j2 childViewHolderInt = getChildViewHolderInt(view);
                    this.mRecycler.m(childViewHolderInt);
                    this.mRecycler.k(childViewHolderInt);
                    if (sVerboseLoggingEnabled) {
                        Objects.toString(view);
                        toString();
                    }
                }
                stopInterceptRequestLayout(!z10);
                return z10;
            } finally {
                fVar.f3695d = 0;
            }
        }
        if (fVar.f3696e != view) {
            throw new IllegalStateException("Cannot call removeViewIfHidden within removeView(At) for a different view");
        }
        z10 = false;
        if (z10) {
        }
        stopInterceptRequestLayout(!z10);
        return z10;
    }

    @Override // android.view.ViewGroup
    public void removeDetachedView(View view, boolean z10) {
        j2 childViewHolderInt = getChildViewHolderInt(view);
        if (childViewHolderInt != null) {
            if (childViewHolderInt.isTmpDetached()) {
                childViewHolderInt.clearTmpDetachFlag();
            } else if (!childViewHolderInt.shouldIgnore()) {
                StringBuilder sb = new StringBuilder("Called removeDetachedView with a view which is not flagged as tmp detached.");
                sb.append(childViewHolderInt);
                throw new IllegalArgumentException(defpackage.e.d(this, sb));
            }
        } else if (sDebugAssertionsEnabled) {
            StringBuilder sb2 = new StringBuilder("No ViewHolder found for child: ");
            sb2.append(view);
            throw new IllegalArgumentException(defpackage.e.d(this, sb2));
        }
        view.clearAnimation();
        dispatchChildDetached(view);
        super.removeDetachedView(view, z10);
    }

    public void removeItemDecoration(@NonNull m1 m1Var) {
        q1 q1Var = this.mLayout;
        if (q1Var != null) {
            q1Var.assertNotInLayoutOrScroll("Cannot remove item decoration during a scroll  or layout");
        }
        this.mItemDecorations.remove(m1Var);
        if (this.mItemDecorations.isEmpty()) {
            setWillNotDraw(getOverScrollMode() == 2);
        }
        markItemDecorInsetsDirty();
        requestLayout();
    }

    public void removeItemDecorationAt(int i10) {
        int itemDecorationCount = getItemDecorationCount();
        if (i10 >= 0 && i10 < itemDecorationCount) {
            removeItemDecoration(getItemDecorationAt(i10));
            return;
        }
        throw new IndexOutOfBoundsException(i10 + " is an invalid index for size " + itemDecorationCount);
    }

    public void removeOnChildAttachStateChangeListener(@NonNull s1 s1Var) {
        List<s1> list = this.mOnChildAttachStateListeners;
        if (list == null) {
            return;
        }
        list.remove(s1Var);
    }

    public void removeOnItemTouchListener(@NonNull u1 u1Var) {
        this.mOnItemTouchListeners.remove(u1Var);
        if (this.mInterceptingOnItemTouchListener == u1Var) {
            this.mInterceptingOnItemTouchListener = null;
        }
    }

    public void removeOnScrollListener(@NonNull v1 v1Var) {
        List<v1> list = this.mScrollListeners;
        if (list != null) {
            list.remove(v1Var);
        }
    }

    public void removeRecyclerListener(@NonNull z1 z1Var) {
        this.mRecyclerListeners.remove(z1Var);
    }

    public void repositionShadowingViews() {
        j2 j2Var;
        int iE = this.mChildHelper.e();
        for (int i10 = 0; i10 < iE; i10++) {
            View viewD = this.mChildHelper.d(i10);
            j2 childViewHolder = getChildViewHolder(viewD);
            if (childViewHolder != null && (j2Var = childViewHolder.mShadowingHolder) != null) {
                View view = j2Var.itemView;
                int left = viewD.getLeft();
                int top = viewD.getTop();
                if (left != view.getLeft() || top != view.getTop()) {
                    view.layout(left, top, view.getWidth() + left, view.getHeight() + top);
                }
            }
        }
    }

    @Override // android.view.ViewGroup, android.view.ViewParent
    public void requestChildFocus(View view, View view2) {
        if (!this.mLayout.onRequestChildFocus(this, this.mState, view, view2) && view2 != null) {
            requestChildOnScreen(view, view2);
        }
        super.requestChildFocus(view, view2);
    }

    @Override // android.view.ViewGroup, android.view.ViewParent
    public boolean requestChildRectangleOnScreen(View view, Rect rect, boolean z10) {
        return this.mLayout.requestChildRectangleOnScreen(this, view, rect, z10);
    }

    @Override // android.view.ViewGroup, android.view.ViewParent
    public void requestDisallowInterceptTouchEvent(boolean z10) {
        int size = this.mOnItemTouchListeners.size();
        for (int i10 = 0; i10 < size; i10++) {
            this.mOnItemTouchListeners.get(i10).e(z10);
        }
        super.requestDisallowInterceptTouchEvent(z10);
    }

    @Override // android.view.View, android.view.ViewParent
    public void requestLayout() {
        if (this.mInterceptRequestLayoutDepth != 0 || this.mLayoutSuppressed) {
            this.mLayoutWasDefered = true;
        } else {
            super.requestLayout();
        }
    }

    public void saveOldPositions() {
        int iH = this.mChildHelper.h();
        for (int i10 = 0; i10 < iH; i10++) {
            j2 childViewHolderInt = getChildViewHolderInt(this.mChildHelper.g(i10));
            if (sDebugAssertionsEnabled && childViewHolderInt.mPosition == -1 && !childViewHolderInt.isRemoved()) {
                throw new IllegalStateException(defpackage.e.d(this, new StringBuilder("view holder cannot have position -1 unless it is removed")));
            }
            if (!childViewHolderInt.shouldIgnore()) {
                childViewHolderInt.saveOldPosition();
            }
        }
    }

    @Override // android.view.View
    public void scrollBy(int i10, int i11) {
        q1 q1Var = this.mLayout;
        if (q1Var == null || this.mLayoutSuppressed) {
            return;
        }
        boolean zCanScrollHorizontally = q1Var.canScrollHorizontally();
        boolean zCanScrollVertically = this.mLayout.canScrollVertically();
        if (zCanScrollHorizontally || zCanScrollVertically) {
            if (!zCanScrollHorizontally) {
                i10 = 0;
            }
            if (!zCanScrollVertically) {
                i11 = 0;
            }
            scrollByInternal(i10, i11, null, 0);
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:31:0x00d6  */
    /* JADX WARN: Removed duplicated region for block: B:32:0x00ec  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public boolean scrollByInternal(int i10, int i11, MotionEvent motionEvent, int i12) {
        int i13;
        int i14;
        int i15;
        int i16;
        boolean z10;
        consumePendingUpdateOperations();
        if (this.mAdapter != null) {
            int[] iArr = this.mReusableIntPair;
            iArr[0] = 0;
            iArr[1] = 0;
            scrollStep(i10, i11, iArr);
            int[] iArr2 = this.mReusableIntPair;
            int i17 = iArr2[0];
            int i18 = iArr2[1];
            i13 = i18;
            i14 = i17;
            i15 = i10 - i17;
            i16 = i11 - i18;
        } else {
            i13 = 0;
            i14 = 0;
            i15 = 0;
            i16 = 0;
        }
        if (!this.mItemDecorations.isEmpty()) {
            invalidate();
        }
        int[] iArr3 = this.mReusableIntPair;
        iArr3[0] = 0;
        iArr3[1] = 0;
        dispatchNestedScroll(i14, i13, i15, i16, this.mScrollOffset, i12, iArr3);
        int[] iArr4 = this.mReusableIntPair;
        int i19 = iArr4[0];
        int i20 = i15 - i19;
        int i21 = iArr4[1];
        int i22 = i16 - i21;
        boolean z11 = (i19 == 0 && i21 == 0) ? false : true;
        int i23 = this.mLastTouchX;
        int[] iArr5 = this.mScrollOffset;
        int i24 = iArr5[0];
        this.mLastTouchX = i23 - i24;
        int i25 = this.mLastTouchY;
        int i26 = iArr5[1];
        this.mLastTouchY = i25 - i26;
        int[] iArr6 = this.mNestedOffsets;
        iArr6[0] = iArr6[0] + i24;
        iArr6[1] = iArr6[1] + i26;
        if (getOverScrollMode() != 2) {
            if (motionEvent != null && (motionEvent.getSource() & 8194) != 8194) {
                float x10 = motionEvent.getX();
                float f10 = i20;
                float y10 = motionEvent.getY();
                float f11 = i22;
                if (f10 < 0.0f) {
                    ensureLeftGlow();
                    u0.h.b(this.mLeftGlow, (-f10) / getWidth(), 1.0f - (y10 / getHeight()));
                } else if (f10 > 0.0f) {
                    ensureRightGlow();
                    u0.h.b(this.mRightGlow, f10 / getWidth(), y10 / getHeight());
                } else {
                    z10 = false;
                    if (f11 >= 0.0f) {
                        ensureTopGlow();
                        u0.h.b(this.mTopGlow, (-f11) / getHeight(), x10 / getWidth());
                    } else if (f11 > 0.0f) {
                        ensureBottomGlow();
                        u0.h.b(this.mBottomGlow, f11 / getHeight(), 1.0f - (x10 / getWidth()));
                    } else if (z10 || f10 != 0.0f || f11 != 0.0f) {
                    }
                    WeakHashMap weakHashMap = androidx.core.view.s1.f1815a;
                    postInvalidateOnAnimation();
                }
                z10 = true;
                if (f11 >= 0.0f) {
                }
                WeakHashMap weakHashMap2 = androidx.core.view.s1.f1815a;
                postInvalidateOnAnimation();
            }
            considerReleasingGlowsOnScroll(i10, i11);
        }
        if (i14 != 0 || i13 != 0) {
            dispatchOnScrolled(i14, i13);
        }
        if (!awakenScrollBars()) {
            invalidate();
        }
        return (!z11 && i14 == 0 && i13 == 0) ? false : true;
    }

    public void scrollStep(int i10, int i11, @Nullable int[] iArr) {
        startInterceptRequestLayout();
        onEnterLayoutOrScroll();
        int i12 = m0.k.f30289a;
        Trace.beginSection(TRACE_SCROLL_TAG);
        fillRemainingScrollValues(this.mState);
        int iScrollHorizontallyBy = i10 != 0 ? this.mLayout.scrollHorizontallyBy(i10, this.mRecycler, this.mState) : 0;
        int iScrollVerticallyBy = i11 != 0 ? this.mLayout.scrollVerticallyBy(i11, this.mRecycler, this.mState) : 0;
        Trace.endSection();
        repositionShadowingViews();
        onExitLayoutOrScroll();
        stopInterceptRequestLayout(false);
        if (iArr != null) {
            iArr[0] = iScrollHorizontallyBy;
            iArr[1] = iScrollVerticallyBy;
        }
    }

    @Override // android.view.View
    public void scrollTo(int i10, int i11) {
    }

    public void scrollToPosition(int i10) {
        if (this.mLayoutSuppressed) {
            return;
        }
        stopScroll();
        q1 q1Var = this.mLayout;
        if (q1Var == null) {
            return;
        }
        q1Var.scrollToPosition(i10);
        awakenScrollBars();
    }

    @Override // android.view.View, android.view.accessibility.AccessibilityEventSource
    public void sendAccessibilityEventUnchecked(AccessibilityEvent accessibilityEvent) {
        if (shouldDeferAccessibilityEvent(accessibilityEvent)) {
            return;
        }
        super.sendAccessibilityEventUnchecked(accessibilityEvent);
    }

    public void setAccessibilityDelegateCompat(@Nullable l2 l2Var) {
        this.mAccessibilityDelegate = l2Var;
        androidx.core.view.s1.setAccessibilityDelegate(this, l2Var);
    }

    public void setAdapter(@Nullable d1 d1Var) {
        setLayoutFrozen(false);
        setAdapterInternal(d1Var, false, true);
        processDataSetCompletelyChanged(false);
        requestLayout();
    }

    public void setChildDrawingOrderCallback(@Nullable g1 g1Var) {
        if (g1Var == this.mChildDrawingOrderCallback) {
            return;
        }
        this.mChildDrawingOrderCallback = g1Var;
        setChildrenDrawingOrderEnabled(g1Var != null);
    }

    @VisibleForTesting
    public boolean setChildImportantForAccessibilityInternal(j2 j2Var, int i10) {
        if (isComputingLayout()) {
            j2Var.mPendingAccessibilityState = i10;
            this.mPendingAccessibilityImportanceChange.add(j2Var);
            return false;
        }
        View view = j2Var.itemView;
        WeakHashMap weakHashMap = androidx.core.view.s1.f1815a;
        view.setImportantForAccessibility(i10);
        return true;
    }

    @Override // android.view.ViewGroup
    public void setClipToPadding(boolean z10) {
        if (z10 != this.mClipToPadding) {
            invalidateGlows();
        }
        this.mClipToPadding = z10;
        super.setClipToPadding(z10);
        if (this.mFirstLayoutComplete) {
            requestLayout();
        }
    }

    public void setEdgeEffectFactory(@NonNull h1 h1Var) {
        p0.g.checkNotNull(h1Var);
        this.mEdgeEffectFactory = h1Var;
        invalidateGlows();
    }

    public void setHasFixedSize(boolean z10) {
        this.mHasFixedSize = z10;
    }

    public void setItemAnimator(@Nullable l1 l1Var) {
        l1 l1Var2 = this.mItemAnimator;
        if (l1Var2 != null) {
            l1Var2.e();
            this.mItemAnimator.f3771a = null;
        }
        this.mItemAnimator = l1Var;
        if (l1Var != null) {
            l1Var.f3771a = this.mItemAnimatorListener;
        }
    }

    public void setItemViewCacheSize(int i10) {
        y1 y1Var = this.mRecycler;
        y1Var.f3972e = i10;
        y1Var.n();
    }

    @Deprecated
    public void setLayoutFrozen(boolean z10) {
        suppressLayout(z10);
    }

    public void setLayoutManager(@Nullable q1 q1Var) {
        e eVar;
        if (q1Var == this.mLayout) {
            return;
        }
        stopScroll();
        if (this.mLayout != null) {
            l1 l1Var = this.mItemAnimator;
            if (l1Var != null) {
                l1Var.e();
            }
            this.mLayout.removeAndRecycleAllViews(this.mRecycler);
            this.mLayout.removeAndRecycleScrapInt(this.mRecycler);
            y1 y1Var = this.mRecycler;
            y1Var.f3968a.clear();
            y1Var.h();
            if (this.mIsAttached) {
                this.mLayout.dispatchDetachedFromWindow(this, this.mRecycler);
            }
            this.mLayout.setRecyclerView(null);
            this.mLayout = null;
        } else {
            y1 y1Var2 = this.mRecycler;
            y1Var2.f3968a.clear();
            y1Var2.h();
        }
        f fVar = this.mChildHelper;
        fVar.f3693b.g();
        ArrayList arrayList = fVar.f3694c;
        int size = arrayList.size();
        while (true) {
            size--;
            eVar = fVar.f3692a;
            if (size < 0) {
                break;
            }
            View view = (View) arrayList.get(size);
            c1 c1Var = (c1) eVar;
            c1Var.getClass();
            j2 childViewHolderInt = getChildViewHolderInt(view);
            if (childViewHolderInt != null) {
                childViewHolderInt.onLeftHiddenState(c1Var.f3680a);
            }
            arrayList.remove(size);
        }
        RecyclerView recyclerView = ((c1) eVar).f3680a;
        int childCount = recyclerView.getChildCount();
        for (int i10 = 0; i10 < childCount; i10++) {
            View childAt = recyclerView.getChildAt(i10);
            recyclerView.dispatchChildDetached(childAt);
            childAt.clearAnimation();
        }
        recyclerView.removeAllViews();
        this.mLayout = q1Var;
        if (q1Var != null) {
            if (q1Var.mRecyclerView != null) {
                StringBuilder sb = new StringBuilder("LayoutManager ");
                sb.append(q1Var);
                sb.append(" is already attached to a RecyclerView:");
                throw new IllegalArgumentException(defpackage.e.d(q1Var.mRecyclerView, sb));
            }
            q1Var.setRecyclerView(this);
            if (this.mIsAttached) {
                this.mLayout.dispatchAttachedToWindow(this);
            }
        }
        this.mRecycler.n();
        requestLayout();
    }

    @Override // android.view.ViewGroup
    @Deprecated
    public void setLayoutTransition(LayoutTransition layoutTransition) {
        if (layoutTransition != null) {
            throw new IllegalArgumentException("Providing a LayoutTransition into RecyclerView is not supported. Please use setItemAnimator() instead for animating changes to the items in this RecyclerView");
        }
        super.setLayoutTransition(null);
    }

    @Override // android.view.View
    public void setNestedScrollingEnabled(boolean z10) {
        getScrollingChildHelper().e(z10);
    }

    public void setOnFlingListener(@Nullable t1 t1Var) {
        this.mOnFlingListener = t1Var;
    }

    @Deprecated
    public void setOnScrollListener(@Nullable v1 v1Var) {
        this.mScrollListener = v1Var;
    }

    public void setPreserveFocusAfterLayout(boolean z10) {
        this.mPreserveFocusAfterLayout = z10;
    }

    public void setRecycledViewPool(@Nullable x1 x1Var) {
        y1 y1Var = this.mRecycler;
        RecyclerView recyclerView = y1Var.f3975h;
        y1Var.g(recyclerView.mAdapter, false);
        if (y1Var.f3974g != null) {
            r2.f3957b--;
        }
        y1Var.f3974g = x1Var;
        if (x1Var != null && recyclerView.getAdapter() != null) {
            y1Var.f3974g.f3957b++;
        }
        y1Var.f();
    }

    @Deprecated
    public void setRecyclerListener(@Nullable z1 z1Var) {
    }

    public void setScrollState(int i10) {
        if (i10 == this.mScrollState) {
            return;
        }
        if (sVerboseLoggingEnabled) {
            new Exception();
        }
        this.mScrollState = i10;
        if (i10 != 2) {
            i2 i2Var = this.mViewFlinger;
            i2Var.f3735g.removeCallbacks(i2Var);
            i2Var.f3731c.abortAnimation();
            q1 q1Var = this.mLayout;
            if (q1Var != null) {
                q1Var.stopSmoothScroller();
            }
        }
        dispatchOnScrollStateChanged(i10);
    }

    public void setScrollingTouchSlop(int i10) {
        ViewConfiguration viewConfiguration = ViewConfiguration.get(getContext());
        if (i10 != 1) {
            this.mTouchSlop = viewConfiguration.getScaledTouchSlop();
        } else {
            this.mTouchSlop = viewConfiguration.getScaledPagingTouchSlop();
        }
    }

    public void setViewCacheExtension(@Nullable h2 h2Var) {
        this.mRecycler.getClass();
    }

    public boolean shouldDeferAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
        if (!isComputingLayout()) {
            return false;
        }
        int contentChangeTypes = accessibilityEvent != null ? accessibilityEvent.getContentChangeTypes() : 0;
        this.mEatenAccessibilityChangeFlags |= contentChangeTypes != 0 ? contentChangeTypes : 0;
        return true;
    }

    public void smoothScrollBy(@Px int i10, @Px int i11) {
        smoothScrollBy(i10, i11, null);
    }

    public void smoothScrollToPosition(int i10) {
        q1 q1Var;
        if (this.mLayoutSuppressed || (q1Var = this.mLayout) == null) {
            return;
        }
        q1Var.smoothScrollToPosition(this, this.mState, i10);
    }

    public void startInterceptRequestLayout() {
        int i10 = this.mInterceptRequestLayoutDepth + 1;
        this.mInterceptRequestLayoutDepth = i10;
        if (i10 != 1 || this.mLayoutSuppressed) {
            return;
        }
        this.mLayoutWasDefered = false;
    }

    @Override // android.view.View
    public boolean startNestedScroll(int i10) {
        return getScrollingChildHelper().f(i10, 0);
    }

    public void stopInterceptRequestLayout(boolean z10) {
        if (this.mInterceptRequestLayoutDepth < 1) {
            if (sDebugAssertionsEnabled) {
                throw new IllegalStateException(defpackage.e.d(this, new StringBuilder("stopInterceptRequestLayout was called more times than startInterceptRequestLayout.")));
            }
            this.mInterceptRequestLayoutDepth = 1;
        }
        if (!z10 && !this.mLayoutSuppressed) {
            this.mLayoutWasDefered = false;
        }
        if (this.mInterceptRequestLayoutDepth == 1) {
            if (z10 && this.mLayoutWasDefered && !this.mLayoutSuppressed && this.mLayout != null && this.mAdapter != null) {
                dispatchLayout();
            }
            if (!this.mLayoutSuppressed) {
                this.mLayoutWasDefered = false;
            }
        }
        this.mInterceptRequestLayoutDepth--;
    }

    @Override // android.view.View
    public void stopNestedScroll() {
        getScrollingChildHelper().g(0);
    }

    public void stopScroll() {
        setScrollState(0);
        i2 i2Var = this.mViewFlinger;
        i2Var.f3735g.removeCallbacks(i2Var);
        i2Var.f3731c.abortAnimation();
        q1 q1Var = this.mLayout;
        if (q1Var != null) {
            q1Var.stopSmoothScroller();
        }
    }

    @Override // android.view.ViewGroup
    public final void suppressLayout(boolean z10) {
        if (z10 != this.mLayoutSuppressed) {
            assertNotInLayoutOrScroll("Do not suppressLayout in layout or scroll");
            if (z10) {
                long jUptimeMillis = SystemClock.uptimeMillis();
                onTouchEvent(MotionEvent.obtain(jUptimeMillis, jUptimeMillis, 3, 0.0f, 0.0f, 0));
                this.mLayoutSuppressed = true;
                this.mIgnoreMotionEventTillDown = true;
                stopScroll();
                return;
            }
            this.mLayoutSuppressed = false;
            if (this.mLayoutWasDefered && this.mLayout != null && this.mAdapter != null) {
                requestLayout();
            }
            this.mLayoutWasDefered = false;
        }
    }

    public void swapAdapter(@Nullable d1 d1Var, boolean z10) {
        setLayoutFrozen(false);
        setAdapterInternal(d1Var, true, z10);
        processDataSetCompletelyChanged(true);
        requestLayout();
    }

    public void viewRangeUpdate(int i10, int i11, Object obj) {
        int i12;
        int i13;
        int iH = this.mChildHelper.h();
        int i14 = i11 + i10;
        for (int i15 = 0; i15 < iH; i15++) {
            View viewG = this.mChildHelper.g(i15);
            j2 childViewHolderInt = getChildViewHolderInt(viewG);
            if (childViewHolderInt != null && !childViewHolderInt.shouldIgnore() && (i13 = childViewHolderInt.mPosition) >= i10 && i13 < i14) {
                childViewHolderInt.addFlags(2);
                childViewHolderInt.addChangePayload(obj);
                ((r1) viewG.getLayoutParams()).mInsetsDirty = true;
            }
        }
        y1 y1Var = this.mRecycler;
        ArrayList arrayList = y1Var.f3970c;
        for (int size = arrayList.size() - 1; size >= 0; size--) {
            j2 j2Var = (j2) arrayList.get(size);
            if (j2Var != null && (i12 = j2Var.mPosition) >= i10 && i12 < i14) {
                j2Var.addFlags(2);
                y1Var.i(size);
            }
        }
    }

    public RecyclerView(@NonNull Context context, @Nullable AttributeSet attributeSet) {
        this(context, attributeSet, e3.a.recyclerViewStyle);
    }

    @Override // androidx.core.view.d0
    public boolean dispatchNestedPreScroll(int i10, int i11, int[] iArr, int[] iArr2, int i12) {
        return getScrollingChildHelper().dispatchNestedPreScroll(i10, i11, iArr, iArr2, i12);
    }

    @Override // androidx.core.view.d0
    public boolean dispatchNestedScroll(int i10, int i11, int i12, int i13, int[] iArr, int i14) {
        return getScrollingChildHelper().dispatchNestedScroll(i10, i11, i12, i13, iArr, i14);
    }

    /* JADX WARN: Removed duplicated region for block: B:15:0x002a  */
    @Nullable
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public j2 findViewHolderForPosition(int i10, boolean z10) {
        int iH = this.mChildHelper.h();
        j2 j2Var = null;
        for (int i11 = 0; i11 < iH; i11++) {
            j2 childViewHolderInt = getChildViewHolderInt(this.mChildHelper.g(i11));
            if (childViewHolderInt != null && !childViewHolderInt.isRemoved()) {
                if (z10) {
                    if (childViewHolderInt.mPosition != i10) {
                        continue;
                    } else {
                        if (!this.mChildHelper.k(childViewHolderInt.itemView)) {
                            return childViewHolderInt;
                        }
                        j2Var = childViewHolderInt;
                    }
                } else if (childViewHolderInt.getLayoutPosition() != i10) {
                    continue;
                }
            }
        }
        return j2Var;
    }

    public void onExitLayoutOrScroll(boolean z10) {
        int i10 = this.mLayoutOrScrollCounter - 1;
        this.mLayoutOrScrollCounter = i10;
        if (i10 < 1) {
            if (sDebugAssertionsEnabled && i10 < 0) {
                throw new IllegalStateException(defpackage.e.d(this, new StringBuilder("layout or scroll counter cannot go below zero.Some calls are not matching")));
            }
            this.mLayoutOrScrollCounter = 0;
            if (z10) {
                int i11 = this.mEatenAccessibilityChangeFlags;
                this.mEatenAccessibilityChangeFlags = 0;
                if (i11 != 0 && isAccessibilityEnabled()) {
                    AccessibilityEvent accessibilityEventObtain = AccessibilityEvent.obtain();
                    accessibilityEventObtain.setEventType(2048);
                    accessibilityEventObtain.setContentChangeTypes(i11);
                    sendAccessibilityEventUnchecked(accessibilityEventObtain);
                }
                dispatchPendingImportantForAccessibilityChanges();
            }
        }
    }

    public void smoothScrollBy(@Px int i10, @Px int i11, @Nullable Interpolator interpolator) {
        smoothScrollBy(i10, i11, interpolator, Integer.MIN_VALUE);
    }

    public RecyclerView(@NonNull Context context, @Nullable AttributeSet attributeSet, int i10) {
        float fA;
        float fA2;
        ClassLoader classLoader;
        Constructor constructor;
        Object[] objArr;
        super(context, attributeSet, i10);
        this.mObserver = new a2(this);
        this.mRecycler = new y1(this);
        this.mViewInfoStore = new z2();
        this.mUpdateChildViewsRunnable = new a1(this, 0);
        this.mTempRect = new Rect();
        this.mTempRect2 = new Rect();
        this.mTempRectF = new RectF();
        this.mRecyclerListeners = new ArrayList();
        this.mItemDecorations = new ArrayList<>();
        this.mOnItemTouchListeners = new ArrayList<>();
        this.mInterceptRequestLayoutDepth = 0;
        this.mDataSetHasChangedAfterLayout = false;
        this.mDispatchItemsChangedEvent = false;
        this.mLayoutOrScrollCounter = 0;
        this.mDispatchScrollCounter = 0;
        this.mEdgeEffectFactory = sDefaultEdgeEffectFactory;
        p pVar = new p();
        pVar.f3771a = null;
        pVar.f3772b = new ArrayList();
        pVar.f3773c = 120L;
        pVar.f3774d = 120L;
        pVar.f3775e = 250L;
        pVar.f3776f = 250L;
        int i11 = 1;
        pVar.f3783g = true;
        pVar.f3835h = new ArrayList();
        pVar.f3836i = new ArrayList();
        pVar.f3837j = new ArrayList();
        pVar.f3838k = new ArrayList();
        pVar.f3839l = new ArrayList();
        pVar.f3840m = new ArrayList();
        pVar.f3841n = new ArrayList();
        pVar.f3842o = new ArrayList();
        pVar.f3843p = new ArrayList();
        pVar.f3844q = new ArrayList();
        pVar.f3845r = new ArrayList();
        this.mItemAnimator = pVar;
        this.mScrollState = 0;
        this.mScrollPointerId = -1;
        this.mScaledHorizontalScrollFactor = Float.MIN_VALUE;
        this.mScaledVerticalScrollFactor = Float.MIN_VALUE;
        this.mPreserveFocusAfterLayout = true;
        this.mViewFlinger = new i2(this);
        this.mPrefetchRegistry = ALLOW_THREAD_GAP_WORK ? new x() : null;
        f2 f2Var = new f2();
        f2Var.f3700a = -1;
        f2Var.f3701b = 0;
        f2Var.f3702c = 0;
        f2Var.f3703d = 1;
        f2Var.f3704e = 0;
        f2Var.f3705f = false;
        f2Var.f3706g = false;
        f2Var.f3707h = false;
        f2Var.f3708i = false;
        f2Var.f3709j = false;
        f2Var.f3710k = false;
        this.mState = f2Var;
        this.mItemsAddedOrRemoved = false;
        this.mItemsChanged = false;
        this.mItemAnimatorListener = new c1(this);
        this.mPostedAnimatorRunner = false;
        this.mMinMaxLayoutPositions = new int[2];
        this.mScrollOffset = new int[2];
        this.mNestedOffsets = new int[2];
        this.mReusableIntPair = new int[2];
        this.mPendingAccessibilityImportanceChange = new ArrayList();
        this.mItemAnimatorRunner = new a1(this, i11);
        this.mLastAutoMeasureNonExactMeasuredWidth = 0;
        this.mLastAutoMeasureNonExactMeasuredHeight = 0;
        this.mViewInfoProcessCallback = new b1(this);
        setScrollContainer(true);
        setFocusableInTouchMode(true);
        ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
        this.mTouchSlop = viewConfiguration.getScaledTouchSlop();
        int i12 = Build.VERSION.SDK_INT;
        if (i12 >= 26) {
            Method method = androidx.core.view.t1.f1828a;
            fA = androidx.core.app.a0.z(viewConfiguration);
        } else {
            fA = androidx.core.view.t1.a(viewConfiguration, context);
        }
        this.mScaledHorizontalScrollFactor = fA;
        if (i12 >= 26) {
            fA2 = androidx.core.app.a0.A(viewConfiguration);
        } else {
            fA2 = androidx.core.view.t1.a(viewConfiguration, context);
        }
        this.mScaledVerticalScrollFactor = fA2;
        this.mMinFlingVelocity = viewConfiguration.getScaledMinimumFlingVelocity();
        this.mMaxFlingVelocity = viewConfiguration.getScaledMaximumFlingVelocity();
        this.mPhysicalCoef = context.getResources().getDisplayMetrics().density * 160.0f * 386.0878f * 0.84f;
        setWillNotDraw(getOverScrollMode() == 2);
        this.mItemAnimator.f3771a = this.mItemAnimatorListener;
        initAdapterManager();
        this.mChildHelper = new f(new c1(this));
        WeakHashMap weakHashMap = androidx.core.view.s1.f1815a;
        if ((i12 < 26 || androidx.core.view.l1.b(this) == 0) && i12 >= 26) {
            androidx.core.view.l1.e(this, 8);
        }
        if (getImportantForAccessibility() == 0) {
            setImportantForAccessibility(1);
        }
        this.mAccessibilityManager = (AccessibilityManager) getContext().getSystemService("accessibility");
        setAccessibilityDelegateCompat(new l2(this));
        int[] iArr = e3.d.RecyclerView;
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, iArr, i10, 0);
        androidx.core.view.s1.saveAttributeDataForStyleable(this, context, iArr, attributeSet, typedArrayObtainStyledAttributes, i10, 0);
        String string = typedArrayObtainStyledAttributes.getString(e3.d.RecyclerView_layoutManager);
        if (typedArrayObtainStyledAttributes.getInt(e3.d.RecyclerView_android_descendantFocusability, -1) == -1) {
            setDescendantFocusability(262144);
        }
        this.mClipToPadding = typedArrayObtainStyledAttributes.getBoolean(e3.d.RecyclerView_android_clipToPadding, true);
        boolean z10 = typedArrayObtainStyledAttributes.getBoolean(e3.d.RecyclerView_fastScrollEnabled, false);
        this.mEnableFastScroller = z10;
        if (z10) {
            initFastScroller((StateListDrawable) typedArrayObtainStyledAttributes.getDrawable(e3.d.RecyclerView_fastScrollVerticalThumbDrawable), typedArrayObtainStyledAttributes.getDrawable(e3.d.RecyclerView_fastScrollVerticalTrackDrawable), (StateListDrawable) typedArrayObtainStyledAttributes.getDrawable(e3.d.RecyclerView_fastScrollHorizontalThumbDrawable), typedArrayObtainStyledAttributes.getDrawable(e3.d.RecyclerView_fastScrollHorizontalTrackDrawable));
        }
        typedArrayObtainStyledAttributes.recycle();
        if (string != null) {
            String strTrim = string.trim();
            if (!strTrim.isEmpty()) {
                if (strTrim.charAt(0) == '.') {
                    strTrim = context.getPackageName() + strTrim;
                } else if (!strTrim.contains(".")) {
                    strTrim = RecyclerView.class.getPackage().getName() + '.' + strTrim;
                }
                String str = strTrim;
                try {
                    if (isInEditMode()) {
                        classLoader = getClass().getClassLoader();
                    } else {
                        classLoader = context.getClassLoader();
                    }
                    Class<? extends U> clsAsSubclass = Class.forName(str, false, classLoader).asSubclass(q1.class);
                    try {
                        constructor = clsAsSubclass.getConstructor(LAYOUT_MANAGER_CONSTRUCTOR_SIGNATURE);
                        objArr = new Object[]{context, attributeSet, Integer.valueOf(i10), 0};
                    } catch (NoSuchMethodException e10) {
                        try {
                            constructor = clsAsSubclass.getConstructor(new Class[0]);
                            objArr = null;
                        } catch (NoSuchMethodException e11) {
                            e11.initCause(e10);
                            throw new IllegalStateException(attributeSet.getPositionDescription() + ": Error creating LayoutManager " + str, e11);
                        }
                    }
                    constructor.setAccessible(true);
                    setLayoutManager((q1) constructor.newInstance(objArr));
                } catch (ClassCastException e12) {
                    throw new IllegalStateException(attributeSet.getPositionDescription() + ": Class is not a LayoutManager " + str, e12);
                } catch (ClassNotFoundException e13) {
                    throw new IllegalStateException(attributeSet.getPositionDescription() + ": Unable to find LayoutManager " + str, e13);
                } catch (IllegalAccessException e14) {
                    throw new IllegalStateException(attributeSet.getPositionDescription() + ": Cannot access non-public constructor " + str, e14);
                } catch (InstantiationException e15) {
                    throw new IllegalStateException(attributeSet.getPositionDescription() + ": Could not instantiate the LayoutManager: " + str, e15);
                } catch (InvocationTargetException e16) {
                    throw new IllegalStateException(attributeSet.getPositionDescription() + ": Could not instantiate the LayoutManager: " + str, e16);
                }
            }
        }
        int[] iArr2 = NESTED_SCROLLING_ATTRS;
        TypedArray typedArrayObtainStyledAttributes2 = context.obtainStyledAttributes(attributeSet, iArr2, i10, 0);
        androidx.core.view.s1.saveAttributeDataForStyleable(this, context, iArr2, attributeSet, typedArrayObtainStyledAttributes2, i10, 0);
        boolean z11 = typedArrayObtainStyledAttributes2.getBoolean(0, true);
        typedArrayObtainStyledAttributes2.recycle();
        setNestedScrollingEnabled(z11);
        setTag(w0.a.f34113b, Boolean.TRUE);
    }

    @Override // androidx.core.view.e0
    public final void dispatchNestedScroll(int i10, int i11, int i12, int i13, int[] iArr, int i14, @NonNull int[] iArr2) {
        getScrollingChildHelper().dispatchNestedScroll(i10, i11, i12, i13, iArr, i14, iArr2);
    }

    public boolean hasNestedScrollingParent(int i10) {
        return getScrollingChildHelper().d(i10);
    }

    public void smoothScrollBy(@Px int i10, @Px int i11, @Nullable Interpolator interpolator, int i12) {
        smoothScrollBy(i10, i11, interpolator, i12, false);
    }

    public boolean startNestedScroll(int i10, int i11) {
        return getScrollingChildHelper().f(i10, i11);
    }

    public void stopNestedScroll(int i10) {
        getScrollingChildHelper().g(i10);
    }

    public void smoothScrollBy(@Px int i10, @Px int i11, @Nullable Interpolator interpolator, int i12, boolean z10) {
        q1 q1Var = this.mLayout;
        if (q1Var == null || this.mLayoutSuppressed) {
            return;
        }
        if (!q1Var.canScrollHorizontally()) {
            i10 = 0;
        }
        if (!this.mLayout.canScrollVertically()) {
            i11 = 0;
        }
        if (i10 == 0 && i11 == 0) {
            return;
        }
        if (i12 != Integer.MIN_VALUE && i12 <= 0) {
            scrollBy(i10, i11);
            return;
        }
        if (z10) {
            int i13 = i10 != 0 ? 1 : 0;
            if (i11 != 0) {
                i13 |= 2;
            }
            startNestedScroll(i13, 1);
        }
        this.mViewFlinger.smoothScrollBy(i10, i11, i12, interpolator);
    }

    public void addItemDecoration(@NonNull m1 m1Var) {
        addItemDecoration(m1Var, -1);
    }

    @Override // android.view.ViewGroup
    public ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
        q1 q1Var = this.mLayout;
        if (q1Var != null) {
            return q1Var.generateLayoutParams(layoutParams);
        }
        throw new IllegalStateException(defpackage.e.d(this, new StringBuilder("RecyclerView has no LayoutManager")));
    }
}
