package androidx.recyclerview.widget;

import android.R;
import android.animation.LayoutTransition;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.database.Observable;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemClock;
import android.os.Trace;
import android.util.AttributeSet;
import android.util.Log;
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.media3.extractor.ts.TsExtractor;
import androidx.media3.session.MediaUtils;
import androidx.recyclerview.widget.a;
import androidx.recyclerview.widget.ao;
import androidx.recyclerview.widget.av;
import androidx.recyclerview.widget.aw;
import androidx.recyclerview.widget.h;
import androidx.recyclerview.widget.w;
import defpackage.b3;
import defpackage.bk6;
import defpackage.ck6;
import defpackage.cm7;
import defpackage.ek6;
import defpackage.fi7;
import defpackage.gp7;
import defpackage.i3;
import defpackage.kf7;
import defpackage.m38;
import defpackage.or0;
import defpackage.rc7;
import defpackage.rc8;
import defpackage.rq6;
import defpackage.sia;
import defpackage.sma;
import defpackage.uq9;
import defpackage.vo6;
import defpackage.vw2;
import defpackage.zs8;
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.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.WeakHashMap;

/* JADX INFO: loaded from: classes.dex */
public class RecyclerView extends ViewGroup implements rc8, bk6, ck6 {
    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 ad sDefaultEdgeEffectFactory;
    static final Interpolator sQuinticInterpolator;
    static boolean sVerboseLoggingEnabled = false;
    ao mAccessibilityDelegate;
    private final AccessibilityManager mAccessibilityManager;
    g mAdapter;
    androidx.recyclerview.widget.a mAdapterHelper;
    boolean mAdapterUpdateDuringMeasure;
    private EdgeEffect mBottomGlow;
    private j mChildDrawingOrderCallback;
    androidx.recyclerview.widget.h mChildHelper;
    boolean mClipToPadding;
    boolean mDataSetHasChangedAfterLayout;
    boolean mDispatchItemsChangedEvent;
    private int mDispatchScrollCounter;
    private int mEatenAccessibilityChangeFlags;

    @vo6
    private k mEdgeEffectFactory;
    boolean mEnableFastScroller;

    @sma
    boolean mFirstLayoutComplete;
    androidx.recyclerview.widget.w mGapWorker;
    boolean mHasFixedSize;
    private boolean mIgnoreMotionEventTillDown;
    private int mInitialTouchX;
    private int mInitialTouchY;
    private int mInterceptRequestLayoutDepth;
    private s mInterceptingOnItemTouchListener;
    boolean mIsAttached;
    l mItemAnimator;
    private l.c mItemAnimatorListener;
    private Runnable mItemAnimatorRunner;
    final ArrayList<n> mItemDecorations;
    boolean mItemsAddedOrRemoved;
    boolean mItemsChanged;
    private int mLastAutoMeasureNonExactMeasuredHeight;
    private int mLastAutoMeasureNonExactMeasuredWidth;
    private boolean mLastAutoMeasureSkippedDueToExact;
    private int mLastTouchX;
    private int mLastTouchY;

    @sma
    o 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 y mObserver;
    private List<q> mOnChildAttachStateListeners;
    private r mOnFlingListener;
    private final ArrayList<s> mOnItemTouchListeners;

    @sma
    final List<ag> mPendingAccessibilityImportanceChange;
    z mPendingSavedState;
    private final float mPhysicalCoef;
    boolean mPostedAnimatorRunner;
    w.b mPrefetchRegistry;
    private boolean mPreserveFocusAfterLayout;
    final w mRecycler;
    x mRecyclerListener;
    final List<x> mRecyclerListeners;
    final int[] mReusableIntPair;
    private EdgeEffect mRightGlow;
    private float mScaledHorizontalScrollFactor;
    private float mScaledVerticalScrollFactor;
    private t mScrollListener;
    private List<t> mScrollListeners;
    private final int[] mScrollOffset;
    private int mScrollPointerId;
    private int mScrollState;
    private ek6 mScrollingChildHelper;
    final ac mState;
    final Rect mTempRect;
    private final Rect mTempRect2;
    final RectF mTempRectF;
    private EdgeEffect mTopGlow;
    private int mTouchSlop;
    final Runnable mUpdateChildViewsRunnable;
    private VelocityTracker mVelocityTracker;
    final af mViewFlinger;
    private final aw.b mViewInfoProcessCallback;
    final aw 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;

    public class a implements Runnable {
        public a() {
        }

        @Override // java.lang.Runnable
        public final void run() {
            RecyclerView recyclerView = RecyclerView.this;
            if (!recyclerView.mFirstLayoutComplete || recyclerView.isLayoutRequested()) {
                return;
            }
            if (!recyclerView.mIsAttached) {
                recyclerView.requestLayout();
            } else if (recyclerView.mLayoutSuppressed) {
                recyclerView.mLayoutWasDefered = true;
            } else {
                recyclerView.consumePendingUpdateOperations();
            }
        }
    }

    public static class aa implements s {
        @Override // androidx.recyclerview.widget.RecyclerView.s
        public final boolean a(MotionEvent motionEvent) {
            return false;
        }

        @Override // androidx.recyclerview.widget.RecyclerView.s
        public final void d(boolean z) {
        }

        @Override // androidx.recyclerview.widget.RecyclerView.s
        public final void e(MotionEvent motionEvent) {
        }
    }

    public static abstract class ab {
        private o mLayoutManager;
        private boolean mPendingInitialRun;
        private RecyclerView mRecyclerView;
        private final a mRecyclingAction;
        private boolean mRunning;
        private boolean mStarted;
        private int mTargetPosition = -1;
        private View mTargetView;

        public static class a {
            public int a;
            public int b;
            public int c;
            public int d;
            public Interpolator e;
            public boolean f;
            public int g;

            public final void a(RecyclerView recyclerView) {
                int i = this.d;
                if (i >= 0) {
                    this.d = -1;
                    recyclerView.jumpToPositionForSmoothScroller(i);
                    this.f = false;
                    return;
                }
                if (!this.f) {
                    this.g = 0;
                    return;
                }
                Interpolator interpolator = this.e;
                if (interpolator != null && this.c < 1) {
                    throw new IllegalStateException("If you provide an interpolator, you must set a positive duration");
                }
                int i2 = this.c;
                if (i2 < 1) {
                    throw new IllegalStateException("Scroll duration must be a positive number");
                }
                recyclerView.mViewFlinger.c(this.a, this.b, interpolator, i2);
                int i3 = this.g + 1;
                this.g = i3;
                if (i3 > 10) {
                    Log.e(RecyclerView.TAG, "Smooth Scroll action is being updated too frequently. Make sure you are not changing it unless necessary");
                }
                this.f = false;
            }

            public final void b(int i, int i2, Interpolator interpolator, int i3) {
                this.a = i;
                this.b = i2;
                this.c = i3;
                this.e = interpolator;
                this.f = true;
            }
        }

        public interface b {
            PointF computeScrollVectorForPosition(int i);
        }

        public ab() {
            a aVar = new a();
            aVar.d = -1;
            aVar.f = false;
            aVar.g = 0;
            aVar.a = 0;
            aVar.b = 0;
            aVar.c = Integer.MIN_VALUE;
            aVar.e = null;
            this.mRecyclingAction = aVar;
        }

        @rq6
        public PointF computeScrollVectorForPosition(int i) {
            Object layoutManager = getLayoutManager();
            if (layoutManager instanceof b) {
                return ((b) layoutManager).computeScrollVectorForPosition(i);
            }
            Log.w(RecyclerView.TAG, "You should override computeScrollVectorForPosition when the LayoutManager does not implement " + b.class.getCanonicalName());
            return null;
        }

        public View findViewByPosition(int i) {
            return this.mRecyclerView.mLayout.findViewByPosition(i);
        }

        public int getChildCount() {
            return this.mRecyclerView.mLayout.getChildCount();
        }

        public int getChildPosition(View view) {
            return this.mRecyclerView.getChildLayoutPosition(view);
        }

        @rq6
        public o getLayoutManager() {
            return this.mLayoutManager;
        }

        public int getTargetPosition() {
            return this.mTargetPosition;
        }

        @Deprecated
        public void instantScrollToPosition(int i) {
            this.mRecyclerView.scrollToPosition(i);
        }

        public boolean isPendingInitialRun() {
            return this.mPendingInitialRun;
        }

        public boolean isRunning() {
            return this.mRunning;
        }

        public void normalize(@vo6 PointF pointF) {
            float f = pointF.x;
            float f2 = pointF.y;
            float fSqrt = (float) Math.sqrt((f2 * f2) + (f * f));
            pointF.x /= fSqrt;
            pointF.y /= fSqrt;
        }

        public void onAnimation(int i, int i2) {
            PointF pointFComputeScrollVectorForPosition;
            RecyclerView recyclerView = this.mRecyclerView;
            if (this.mTargetPosition == -1 || recyclerView == null) {
                stop();
            }
            if (this.mPendingInitialRun && this.mTargetView == null && this.mLayoutManager != null && (pointFComputeScrollVectorForPosition = computeScrollVectorForPosition(this.mTargetPosition)) != null) {
                float f = pointFComputeScrollVectorForPosition.x;
                if (f != 0.0f || pointFComputeScrollVectorForPosition.y != 0.0f) {
                    recyclerView.scrollStep((int) Math.signum(f), (int) Math.signum(pointFComputeScrollVectorForPosition.y), null);
                }
            }
            this.mPendingInitialRun = false;
            View view = this.mTargetView;
            if (view != null) {
                if (getChildPosition(view) == this.mTargetPosition) {
                    onTargetFound(this.mTargetView, recyclerView.mState, this.mRecyclingAction);
                    this.mRecyclingAction.a(recyclerView);
                    stop();
                } else {
                    Log.e(RecyclerView.TAG, "Passed over target position while smooth scrolling.");
                    this.mTargetView = null;
                }
            }
            if (this.mRunning) {
                onSeekTargetStep(i, i2, recyclerView.mState, this.mRecyclingAction);
                a aVar = this.mRecyclingAction;
                boolean z = aVar.d >= 0;
                aVar.a(recyclerView);
                if (z && this.mRunning) {
                    this.mPendingInitialRun = true;
                    recyclerView.mViewFlinger.b();
                }
            }
        }

        public void onChildAttachedToWindow(View view) {
            if (getChildPosition(view) == getTargetPosition()) {
                this.mTargetView = view;
                int i = RecyclerView.HORIZONTAL;
            }
        }

        public abstract void onSeekTargetStep(int i, int i2, ac acVar, a aVar);

        public abstract void onStart();

        public abstract void onStop();

        public abstract void onTargetFound(View view, ac acVar, a aVar);

        public void setTargetPosition(int i) {
            this.mTargetPosition = i;
        }

        public void start(RecyclerView recyclerView, o oVar) {
            af afVar = recyclerView.mViewFlinger;
            RecyclerView.this.removeCallbacks(afVar);
            afVar.c.abortAnimation();
            if (this.mStarted) {
                Log.w(RecyclerView.TAG, "An instance of " + getClass().getSimpleName() + " was started more than once. Each instance of" + getClass().getSimpleName() + " is intended to only be used once. You should create a new instance for each use.");
            }
            this.mRecyclerView = recyclerView;
            this.mLayoutManager = oVar;
            int i = this.mTargetPosition;
            if (i == -1) {
                throw new IllegalArgumentException("Invalid target position");
            }
            recyclerView.mState.a = i;
            this.mRunning = true;
            this.mPendingInitialRun = true;
            this.mTargetView = findViewByPosition(getTargetPosition());
            onStart();
            this.mRecyclerView.mViewFlinger.b();
            this.mStarted = true;
        }

        public final void stop() {
            if (this.mRunning) {
                this.mRunning = false;
                onStop();
                this.mRecyclerView.mState.a = -1;
                this.mTargetView = null;
                this.mTargetPosition = -1;
                this.mPendingInitialRun = false;
                this.mLayoutManager.onSmoothScrollerStopped(this);
                this.mLayoutManager = null;
                this.mRecyclerView = null;
            }
        }
    }

    public static class ac {
        public int a;
        public int b;
        public int c;
        public int d;
        public int e;
        public boolean f;
        public boolean g;
        public boolean h;
        public boolean i;
        public boolean j;
        public boolean k;
        public int l;
        public long m;
        public int n;
        public int o;
        public int p;

        public final void a(int i) {
            if ((this.d & i) != 0) {
                return;
            }
            throw new IllegalStateException("Layout state should be one of " + Integer.toBinaryString(i) + " but it is " + Integer.toBinaryString(this.d));
        }

        public final int b() {
            return this.g ? this.b - this.c : this.e;
        }

        public final String toString() {
            return "State{mTargetPosition=" + this.a + ", mData=null, mItemCount=" + this.e + ", mIsMeasuring=" + this.i + ", mPreviousLayoutItemCount=" + this.b + ", mDeletedInvisibleItemCountSincePreviousLayout=" + this.c + ", mStructureChanged=" + this.f + ", mInPreLayout=" + this.g + ", mRunSimpleAnimations=" + this.j + ", mRunPredictiveAnimations=" + this.k + '}';
        }
    }

    public static class ad extends k {
        @Override // androidx.recyclerview.widget.RecyclerView.k
        public final EdgeEffect a(RecyclerView recyclerView) {
            return new EdgeEffect(recyclerView.getContext());
        }
    }

    public static abstract class ae {
        public abstract View a();
    }

    public class af implements Runnable {
        public int a;
        public int b;
        public OverScroller c;
        public Interpolator d;
        public boolean e;
        public boolean f;

        public af() {
            Interpolator interpolator = RecyclerView.sQuinticInterpolator;
            this.d = interpolator;
            this.e = false;
            this.f = false;
            this.c = new OverScroller(RecyclerView.this.getContext(), interpolator);
        }

        public final void a(int i, int i2) {
            RecyclerView recyclerView = RecyclerView.this;
            recyclerView.setScrollState(2);
            this.b = 0;
            this.a = 0;
            Interpolator interpolator = this.d;
            Interpolator interpolator2 = RecyclerView.sQuinticInterpolator;
            if (interpolator != interpolator2) {
                this.d = interpolator2;
                this.c = new OverScroller(recyclerView.getContext(), interpolator2);
            }
            this.c.fling(0, 0, i, i2, Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE);
            b();
        }

        public final void b() {
            if (this.e) {
                this.f = true;
                return;
            }
            RecyclerView recyclerView = RecyclerView.this;
            recyclerView.removeCallbacks(this);
            WeakHashMap weakHashMap = sia.a;
            recyclerView.postOnAnimation(this);
        }

        public final void c(int i, int i2, Interpolator interpolator, int i3) {
            RecyclerView recyclerView = RecyclerView.this;
            if (i3 == Integer.MIN_VALUE) {
                int iAbs = Math.abs(i);
                int iAbs2 = Math.abs(i2);
                boolean z = iAbs > iAbs2;
                int width = z ? recyclerView.getWidth() : recyclerView.getHeight();
                if (!z) {
                    iAbs = iAbs2;
                }
                i3 = Math.min((int) (((iAbs / width) + 1.0f) * 300.0f), 2000);
            }
            int i4 = i3;
            if (interpolator == null) {
                interpolator = RecyclerView.sQuinticInterpolator;
            }
            if (this.d != interpolator) {
                this.d = interpolator;
                this.c = new OverScroller(recyclerView.getContext(), interpolator);
            }
            this.b = 0;
            this.a = 0;
            recyclerView.setScrollState(2);
            this.c.startScroll(0, 0, i, i2, i4);
            b();
        }

        @Override // java.lang.Runnable
        public final void run() {
            int i;
            int i2;
            int i3;
            int i4;
            RecyclerView recyclerView = RecyclerView.this;
            if (recyclerView.mLayout == null) {
                recyclerView.removeCallbacks(this);
                this.c.abortAnimation();
                return;
            }
            this.f = false;
            this.e = true;
            recyclerView.consumePendingUpdateOperations();
            OverScroller overScroller = this.c;
            if (overScroller.computeScrollOffset()) {
                int currX = overScroller.getCurrX();
                int currY = overScroller.getCurrY();
                int i5 = currX - this.a;
                int i6 = currY - this.b;
                this.a = currX;
                this.b = currY;
                int iConsumeFlingInHorizontalStretch = recyclerView.consumeFlingInHorizontalStretch(i5);
                int iConsumeFlingInVerticalStretch = recyclerView.consumeFlingInVerticalStretch(i6);
                int[] iArr = recyclerView.mReusableIntPair;
                iArr[0] = 0;
                iArr[1] = 0;
                if (recyclerView.dispatchNestedPreScroll(iConsumeFlingInHorizontalStretch, iConsumeFlingInVerticalStretch, iArr, null, 1)) {
                    int[] iArr2 = recyclerView.mReusableIntPair;
                    iConsumeFlingInHorizontalStretch -= iArr2[0];
                    iConsumeFlingInVerticalStretch -= iArr2[1];
                }
                if (recyclerView.getOverScrollMode() != 2) {
                    recyclerView.considerReleasingGlowsOnScroll(iConsumeFlingInHorizontalStretch, iConsumeFlingInVerticalStretch);
                }
                if (recyclerView.mAdapter != null) {
                    int[] iArr3 = recyclerView.mReusableIntPair;
                    iArr3[0] = 0;
                    iArr3[1] = 0;
                    recyclerView.scrollStep(iConsumeFlingInHorizontalStretch, iConsumeFlingInVerticalStretch, iArr3);
                    int[] iArr4 = recyclerView.mReusableIntPair;
                    int i7 = iArr4[0];
                    int i8 = iArr4[1];
                    int i9 = iConsumeFlingInHorizontalStretch - i7;
                    int i10 = iConsumeFlingInVerticalStretch - i8;
                    ab abVar = recyclerView.mLayout.mSmoothScroller;
                    if (abVar != null && !abVar.isPendingInitialRun() && abVar.isRunning()) {
                        int iB = recyclerView.mState.b();
                        if (iB == 0) {
                            abVar.stop();
                        } else if (abVar.getTargetPosition() >= iB) {
                            abVar.setTargetPosition(iB - 1);
                            abVar.onAnimation(i7, i8);
                        } else {
                            abVar.onAnimation(i7, i8);
                        }
                    }
                    i = i9;
                    i3 = i7;
                    i2 = i10;
                    i4 = i8;
                } else {
                    i = iConsumeFlingInHorizontalStretch;
                    i2 = iConsumeFlingInVerticalStretch;
                    i3 = 0;
                    i4 = 0;
                }
                if (!recyclerView.mItemDecorations.isEmpty()) {
                    recyclerView.invalidate();
                }
                int[] iArr5 = recyclerView.mReusableIntPair;
                iArr5[0] = 0;
                iArr5[1] = 0;
                recyclerView.dispatchNestedScroll(i3, i4, i, i2, null, 1, iArr5);
                int[] iArr6 = recyclerView.mReusableIntPair;
                int i11 = i - iArr6[0];
                int i12 = i2 - iArr6[1];
                if (i3 != 0 || i4 != 0) {
                    recyclerView.dispatchOnScrolled(i3, i4);
                }
                if (!recyclerView.awakenScrollBars()) {
                    recyclerView.invalidate();
                }
                boolean z = overScroller.isFinished() || (((overScroller.getCurrX() == overScroller.getFinalX()) || i11 != 0) && ((overScroller.getCurrY() == overScroller.getFinalY()) || i12 != 0));
                ab abVar2 = recyclerView.mLayout.mSmoothScroller;
                if ((abVar2 == null || !abVar2.isPendingInitialRun()) && z) {
                    if (recyclerView.getOverScrollMode() != 2) {
                        int currVelocity = (int) overScroller.getCurrVelocity();
                        int i13 = i11 < 0 ? -currVelocity : i11 > 0 ? currVelocity : 0;
                        if (i12 < 0) {
                            currVelocity = -currVelocity;
                        } else if (i12 <= 0) {
                            currVelocity = 0;
                        }
                        recyclerView.absorbGlows(i13, currVelocity);
                    }
                    if (RecyclerView.ALLOW_THREAD_GAP_WORK) {
                        w.b bVar = recyclerView.mPrefetchRegistry;
                        int[] iArr7 = bVar.c;
                        if (iArr7 != null) {
                            Arrays.fill(iArr7, -1);
                        }
                        bVar.d = 0;
                    }
                } else {
                    b();
                    androidx.recyclerview.widget.w wVar = recyclerView.mGapWorker;
                    if (wVar != null) {
                        wVar.a(recyclerView, i3, i4);
                    }
                }
            }
            ab abVar3 = recyclerView.mLayout.mSmoothScroller;
            if (abVar3 != null && abVar3.isPendingInitialRun()) {
                abVar3.onAnimation(0, 0);
            }
            this.e = false;
            if (!this.f) {
                recyclerView.setScrollState(0);
                recyclerView.stopNestedScroll(1);
            } else {
                recyclerView.removeCallbacks(this);
                WeakHashMap weakHashMap = sia.a;
                recyclerView.postOnAnimation(this);
            }
        }
    }

    public static abstract class ag {
        static final int FLAG_ADAPTER_FULLUPDATE = 1024;
        static final int FLAG_ADAPTER_POSITION_UNKNOWN = 512;
        static final int FLAG_APPEARED_IN_PRE_LAYOUT = 4096;
        static final int FLAG_BOUNCED_FROM_HIDDEN_LIST = 8192;
        static final int FLAG_BOUND = 1;
        static final int FLAG_IGNORE = 128;
        static final int FLAG_INVALID = 4;
        static final int FLAG_MOVED = 2048;
        static final int FLAG_NOT_RECYCLABLE = 16;
        static final int FLAG_REMOVED = 8;
        static final int FLAG_RETURNED_FROM_SCRAP = 32;
        static final int FLAG_TMP_DETACHED = 256;
        static final int FLAG_UPDATE = 2;
        private static final List<Object> FULLUPDATE_PAYLOADS = Collections.EMPTY_LIST;
        static final int PENDING_ACCESSIBILITY_STATE_NOT_SET = -1;

        @vo6
        public final View itemView;
        g<? extends ag> mBindingAdapter;
        int mFlags;
        WeakReference<RecyclerView> mNestedRecyclerView;
        RecyclerView mOwnerRecyclerView;
        int mPosition = -1;
        int mOldPosition = -1;
        long mItemId = -1;
        int mItemViewType = -1;
        int mPreLayoutPosition = -1;
        ag mShadowedHolder = null;
        ag mShadowingHolder = null;
        List<Object> mPayloads = null;
        List<Object> mUnmodifiedPayloads = null;
        private int mIsRecyclableCount = 0;
        w mScrapContainer = null;
        boolean mInChangeScrap = false;
        private int mWasImportantForAccessibilityBeforeHidden = 0;

        @sma
        int mPendingAccessibilityState = -1;

        public ag(View view) {
            if (view == null) {
                throw new IllegalArgumentException("itemView may not be null");
            }
            this.itemView = view;
        }

        public void addChangePayload(Object obj) {
            if (obj == null) {
                addFlags(1024);
                return;
            }
            if ((1024 & this.mFlags) == 0) {
                if (this.mPayloads == null) {
                    ArrayList arrayList = new ArrayList();
                    this.mPayloads = arrayList;
                    this.mUnmodifiedPayloads = Collections.unmodifiableList(arrayList);
                }
                this.mPayloads.add(obj);
            }
        }

        public void addFlags(int i) {
            this.mFlags = i | this.mFlags;
        }

        public void clearOldPosition() {
            this.mOldPosition = -1;
            this.mPreLayoutPosition = -1;
        }

        public void clearPayload() {
            List<Object> list = this.mPayloads;
            if (list != null) {
                list.clear();
            }
            this.mFlags &= -1025;
        }

        public void clearReturnedFromScrapFlag() {
            this.mFlags &= -33;
        }

        public void clearTmpDetachFlag() {
            this.mFlags &= -257;
        }

        public boolean doesTransientStatePreventRecycling() {
            if ((this.mFlags & 16) != 0) {
                return false;
            }
            View view = this.itemView;
            WeakHashMap weakHashMap = sia.a;
            return view.hasTransientState();
        }

        public void flagRemovedAndOffsetPosition(int i, int i2, boolean z) {
            addFlags(8);
            offsetPosition(i2, z);
            this.mPosition = i;
        }

        public final int getAbsoluteAdapterPosition() {
            RecyclerView recyclerView = this.mOwnerRecyclerView;
            if (recyclerView == null) {
                return -1;
            }
            return recyclerView.getAdapterPositionInRecyclerView(this);
        }

        @Deprecated
        public final int getAdapterPosition() {
            return getBindingAdapterPosition();
        }

        @rq6
        public final g<? extends ag> getBindingAdapter() {
            return this.mBindingAdapter;
        }

        public final int getBindingAdapterPosition() {
            RecyclerView recyclerView;
            g adapter;
            int adapterPositionInRecyclerView;
            if (this.mBindingAdapter == null || (recyclerView = this.mOwnerRecyclerView) == null || (adapter = recyclerView.getAdapter()) == null || (adapterPositionInRecyclerView = this.mOwnerRecyclerView.getAdapterPositionInRecyclerView(this)) == -1) {
                return -1;
            }
            return adapter.findRelativeAdapterPositionIn(this.mBindingAdapter, this, adapterPositionInRecyclerView);
        }

        public final long getItemId() {
            return this.mItemId;
        }

        public final int getItemViewType() {
            return this.mItemViewType;
        }

        public final int getLayoutPosition() {
            int i = this.mPreLayoutPosition;
            return i == -1 ? this.mPosition : i;
        }

        public final int getOldPosition() {
            return this.mOldPosition;
        }

        @Deprecated
        public final int getPosition() {
            int i = this.mPreLayoutPosition;
            return i == -1 ? this.mPosition : i;
        }

        public List<Object> getUnmodifiedPayloads() {
            if ((this.mFlags & 1024) != 0) {
                return FULLUPDATE_PAYLOADS;
            }
            List<Object> list = this.mPayloads;
            return (list == null || list.size() == 0) ? FULLUPDATE_PAYLOADS : this.mUnmodifiedPayloads;
        }

        public boolean hasAnyOfTheFlags(int i) {
            return (i & this.mFlags) != 0;
        }

        public boolean isAdapterPositionUnknown() {
            return (this.mFlags & 512) != 0 || isInvalid();
        }

        public boolean isAttachedToTransitionOverlay() {
            return (this.itemView.getParent() == null || this.itemView.getParent() == this.mOwnerRecyclerView) ? false : true;
        }

        public boolean isBound() {
            return (this.mFlags & 1) != 0;
        }

        public boolean isInvalid() {
            return (this.mFlags & 4) != 0;
        }

        public final boolean isRecyclable() {
            if ((this.mFlags & 16) != 0) {
                return false;
            }
            View view = this.itemView;
            WeakHashMap weakHashMap = sia.a;
            return !view.hasTransientState();
        }

        public boolean isRemoved() {
            return (this.mFlags & 8) != 0;
        }

        public boolean isScrap() {
            return this.mScrapContainer != null;
        }

        public boolean isTmpDetached() {
            return (this.mFlags & 256) != 0;
        }

        public boolean isUpdated() {
            return (this.mFlags & 2) != 0;
        }

        public boolean needsUpdate() {
            return (this.mFlags & 2) != 0;
        }

        public void offsetPosition(int i, boolean z) {
            if (this.mOldPosition == -1) {
                this.mOldPosition = this.mPosition;
            }
            if (this.mPreLayoutPosition == -1) {
                this.mPreLayoutPosition = this.mPosition;
            }
            if (z) {
                this.mPreLayoutPosition += i;
            }
            this.mPosition += i;
            if (this.itemView.getLayoutParams() != null) {
                ((p) this.itemView.getLayoutParams()).c = true;
            }
        }

        public void onEnteredHiddenState(RecyclerView recyclerView) {
            int i = this.mPendingAccessibilityState;
            if (i != -1) {
                this.mWasImportantForAccessibilityBeforeHidden = i;
            } else {
                View view = this.itemView;
                WeakHashMap weakHashMap = sia.a;
                this.mWasImportantForAccessibilityBeforeHidden = view.getImportantForAccessibility();
            }
            recyclerView.setChildImportantForAccessibilityInternal(this, 4);
        }

        public void onLeftHiddenState(RecyclerView recyclerView) {
            recyclerView.setChildImportantForAccessibilityInternal(this, this.mWasImportantForAccessibilityBeforeHidden);
            this.mWasImportantForAccessibilityBeforeHidden = 0;
        }

        public void resetInternal() {
            if (RecyclerView.sDebugAssertionsEnabled && isTmpDetached()) {
                throw new IllegalStateException("Attempting to reset temp-detached ViewHolder: " + this + ". ViewHolders should be fully detached before resetting.");
            }
            this.mFlags = 0;
            this.mPosition = -1;
            this.mOldPosition = -1;
            this.mItemId = -1L;
            this.mPreLayoutPosition = -1;
            this.mIsRecyclableCount = 0;
            this.mShadowedHolder = null;
            this.mShadowingHolder = null;
            clearPayload();
            this.mWasImportantForAccessibilityBeforeHidden = 0;
            this.mPendingAccessibilityState = -1;
            RecyclerView.clearNestedRecyclerViewIfNotNested(this);
        }

        public void saveOldPosition() {
            if (this.mOldPosition == -1) {
                this.mOldPosition = this.mPosition;
            }
        }

        public void setFlags(int i, int i2) {
            this.mFlags = (i & i2) | (this.mFlags & (~i2));
        }

        public final void setIsRecyclable(boolean z) {
            int i = this.mIsRecyclableCount;
            int i2 = z ? i - 1 : i + 1;
            this.mIsRecyclableCount = i2;
            if (i2 < 0) {
                this.mIsRecyclableCount = 0;
                if (RecyclerView.sDebugAssertionsEnabled) {
                    throw new RuntimeException("isRecyclable decremented below 0: unmatched pair of setIsRecyable() calls for " + this);
                }
                Log.e("View", "isRecyclable decremented below 0: unmatched pair of setIsRecyable() calls for " + this);
            } else if (!z && i2 == 1) {
                this.mFlags |= 16;
            } else if (z && i2 == 0) {
                this.mFlags &= -17;
            }
            if (RecyclerView.sVerboseLoggingEnabled) {
                toString();
            }
        }

        public void setScrapContainer(w wVar, boolean z) {
            this.mScrapContainer = wVar;
            this.mInChangeScrap = z;
        }

        public boolean shouldBeKeptAsChild() {
            return (this.mFlags & 16) != 0;
        }

        public boolean shouldIgnore() {
            return (this.mFlags & 128) != 0;
        }

        public void stopIgnoring() {
            this.mFlags &= -129;
        }

        public String toString() {
            StringBuilder sbL = fi7.l(getClass().isAnonymousClass() ? "ViewHolder" : getClass().getSimpleName(), "{");
            sbL.append(Integer.toHexString(hashCode()));
            sbL.append(" position=");
            sbL.append(this.mPosition);
            sbL.append(" id=");
            sbL.append(this.mItemId);
            sbL.append(", oldPos=");
            sbL.append(this.mOldPosition);
            sbL.append(", pLpos:");
            sbL.append(this.mPreLayoutPosition);
            StringBuilder sb = new StringBuilder(sbL.toString());
            if (isScrap()) {
                sb.append(" scrap ");
                sb.append(this.mInChangeScrap ? "[changeScrap]" : "[attachedScrap]");
            }
            if (isInvalid()) {
                sb.append(" invalid");
            }
            if (!isBound()) {
                sb.append(" unbound");
            }
            if (needsUpdate()) {
                sb.append(" update");
            }
            if (isRemoved()) {
                sb.append(" removed");
            }
            if (shouldIgnore()) {
                sb.append(" ignored");
            }
            if (isTmpDetached()) {
                sb.append(" tmpDetached");
            }
            if (!isRecyclable()) {
                sb.append(" not recyclable(" + this.mIsRecyclableCount + ")");
            }
            if (isAdapterPositionUnknown()) {
                sb.append(" undefined adapter position");
            }
            if (this.itemView.getParent() == null) {
                sb.append(" no parent");
            }
            sb.append("}");
            return sb.toString();
        }

        public void unScrap() {
            this.mScrapContainer.n(this);
        }

        public boolean wasReturnedFromScrap() {
            return (this.mFlags & 32) != 0;
        }
    }

    public class b implements Runnable {
        public b() {
        }

        @Override // java.lang.Runnable
        public final void run() {
            RecyclerView recyclerView = RecyclerView.this;
            l lVar = recyclerView.mItemAnimator;
            if (lVar != null) {
                lVar.l();
            }
            recyclerView.mPostedAnimatorRunner = false;
        }
    }

    public class c implements Interpolator {
        @Override // android.animation.TimeInterpolator
        public final float getInterpolation(float f) {
            float f2 = f - 1.0f;
            return (f2 * f2 * f2 * f2 * f2) + 1.0f;
        }
    }

    public class d implements aw.b {
        public d() {
        }

        @Override // androidx.recyclerview.widget.aw.b
        public final void a(ag agVar, l.d dVar, l.d dVar2) {
            RecyclerView.this.animateAppearance(agVar, dVar, dVar2);
        }

        @Override // androidx.recyclerview.widget.aw.b
        public final void b(ag agVar) {
            RecyclerView recyclerView = RecyclerView.this;
            recyclerView.mLayout.removeAndRecycleView(agVar.itemView, recyclerView.mRecycler);
        }

        @Override // androidx.recyclerview.widget.aw.b
        public final void c(ag agVar, l.d dVar, l.d dVar2) {
            RecyclerView recyclerView = RecyclerView.this;
            recyclerView.mRecycler.n(agVar);
            recyclerView.animateDisappearance(agVar, dVar, dVar2);
        }

        @Override // androidx.recyclerview.widget.aw.b
        public final void d(ag agVar, l.d dVar, l.d dVar2) {
            agVar.setIsRecyclable(false);
            RecyclerView recyclerView = RecyclerView.this;
            if (recyclerView.mDataSetHasChangedAfterLayout) {
                if (recyclerView.mItemAnimator.b(agVar, agVar, dVar, dVar2)) {
                    recyclerView.postAnimationRunner();
                }
            } else if (recyclerView.mItemAnimator.d(agVar, dVar, dVar2)) {
                recyclerView.postAnimationRunner();
            }
        }
    }

    public class e implements a.InterfaceC0060a {
        public e() {
        }

        public final void a(a.b bVar) {
            int i = bVar.a;
            RecyclerView recyclerView = RecyclerView.this;
            if (i == 1) {
                recyclerView.mLayout.onItemsAdded(recyclerView, bVar.b, bVar.d);
                return;
            }
            if (i == 2) {
                recyclerView.mLayout.onItemsRemoved(recyclerView, bVar.b, bVar.d);
            } else if (i == 4) {
                recyclerView.mLayout.onItemsUpdated(recyclerView, bVar.b, bVar.d, bVar.c);
            } else {
                if (i != 8) {
                    return;
                }
                recyclerView.mLayout.onItemsMoved(recyclerView, bVar.b, bVar.d, 1);
            }
        }

        public final ag b(int i) {
            RecyclerView recyclerView = RecyclerView.this;
            ag agVarFindViewHolderForPosition = recyclerView.findViewHolderForPosition(i, true);
            if (agVarFindViewHolderForPosition == null) {
                return null;
            }
            androidx.recyclerview.widget.h hVar = recyclerView.mChildHelper;
            if (!hVar.c.contains(agVarFindViewHolderForPosition.itemView)) {
                return agVarFindViewHolderForPosition;
            }
            int i2 = RecyclerView.HORIZONTAL;
            return null;
        }

        public final void c(int i, int i2, Object obj) {
            RecyclerView recyclerView = RecyclerView.this;
            recyclerView.viewRangeUpdate(i, i2, obj);
            recyclerView.mItemsChanged = true;
        }

        public final void d(int i, int i2) {
            RecyclerView recyclerView = RecyclerView.this;
            recyclerView.offsetPositionRecordsForInsert(i, i2);
            recyclerView.mItemsAddedOrRemoved = true;
        }

        public final void e(int i, int i2) {
            RecyclerView recyclerView = RecyclerView.this;
            recyclerView.offsetPositionRecordsForMove(i, i2);
            recyclerView.mItemsAddedOrRemoved = true;
        }

        public final void f(int i, int i2) {
            RecyclerView recyclerView = RecyclerView.this;
            recyclerView.offsetPositionRecordsForRemove(i, i2, true);
            recyclerView.mItemsAddedOrRemoved = true;
            recyclerView.mState.c += i2;
        }
    }

    public static /* synthetic */ class f {
        public static final /* synthetic */ int[] a;

        static {
            int[] iArr = new int[g.a.values().length];
            a = iArr;
            try {
                iArr[2] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                a[1] = 2;
            } catch (NoSuchFieldError unused2) {
            }
        }
    }

    public static class h extends Observable<i> {
        public final boolean a() {
            return !((Observable) this).mObservers.isEmpty();
        }

        public final void b() {
            for (int size = ((Observable) this).mObservers.size() - 1; size >= 0; size--) {
                ((i) ((Observable) this).mObservers.get(size)).onChanged();
            }
        }

        public final void c(int i, int i2) {
            for (int size = ((Observable) this).mObservers.size() - 1; size >= 0; size--) {
                ((i) ((Observable) this).mObservers.get(size)).onItemRangeMoved(i, i2, 1);
            }
        }

        public final void d(int i, int i2, Object obj) {
            for (int size = ((Observable) this).mObservers.size() - 1; size >= 0; size--) {
                ((i) ((Observable) this).mObservers.get(size)).onItemRangeChanged(i, i2, obj);
            }
        }

        public final void e(int i, int i2) {
            for (int size = ((Observable) this).mObservers.size() - 1; size >= 0; size--) {
                ((i) ((Observable) this).mObservers.get(size)).onItemRangeInserted(i, i2);
            }
        }

        public final void f(int i, int i2) {
            for (int size = ((Observable) this).mObservers.size() - 1; size >= 0; size--) {
                ((i) ((Observable) this).mObservers.get(size)).onItemRangeRemoved(i, i2);
            }
        }

        public final void g() {
            for (int size = ((Observable) this).mObservers.size() - 1; size >= 0; size--) {
                ((i) ((Observable) this).mObservers.get(size)).onStateRestorationPolicyChanged();
            }
        }
    }

    public static abstract class i {
        public void onChanged() {
        }

        public void onItemRangeChanged(int i, int i2) {
        }

        public void onItemRangeInserted(int i, int i2) {
        }

        public void onItemRangeMoved(int i, int i2, int i3) {
        }

        public void onItemRangeRemoved(int i, int i2) {
        }

        public void onStateRestorationPolicyChanged() {
        }

        public void onItemRangeChanged(int i, int i2, Object obj) {
            onItemRangeChanged(i, i2);
        }
    }

    public interface j {
        int a(int i, int i2);
    }

    public static class k {

        @Retention(RetentionPolicy.SOURCE)
        public @interface a {
        }

        public EdgeEffect a(RecyclerView recyclerView) {
            return new EdgeEffect(recyclerView.getContext());
        }
    }

    public static abstract class l {
        public c a;
        public ArrayList b;
        public long c;
        public long d;
        public long e;
        public long f;

        @Retention(RetentionPolicy.SOURCE)
        public @interface a {
        }

        public interface b {
            void a();
        }

        public interface c {
            void a(ag agVar);
        }

        public static class d {
            public int a;
            public int b;

            public final void a(ag agVar) {
                View view = agVar.itemView;
                this.a = view.getLeft();
                this.b = view.getTop();
                view.getRight();
                view.getBottom();
            }
        }

        public static void e(ag agVar) {
            int i = agVar.mFlags;
            if (!agVar.isInvalid() && (i & 4) == 0) {
                agVar.getOldPosition();
                agVar.getAbsoluteAdapterPosition();
            }
        }

        public abstract boolean a(ag agVar, d dVar, d dVar2);

        public abstract boolean b(ag agVar, ag agVar2, d dVar, d dVar2);

        public abstract boolean c(ag agVar, d dVar, d dVar2);

        public abstract boolean d(ag agVar, d dVar, d dVar2);

        public boolean f(ag agVar) {
            return true;
        }

        public boolean g(ag agVar, List list) {
            return f(agVar);
        }

        public final void h(ag agVar) {
            c cVar = this.a;
            if (cVar != null) {
                cVar.a(agVar);
            }
        }

        public abstract void i(ag agVar);

        public abstract void j();

        public abstract boolean k();

        public abstract void l();
    }

    public class m implements l.c {
        public m() {
        }

        @Override // androidx.recyclerview.widget.RecyclerView.l.c
        public final void a(ag agVar) {
            agVar.setIsRecyclable(true);
            if (agVar.mShadowedHolder != null && agVar.mShadowingHolder == null) {
                agVar.mShadowedHolder = null;
            }
            agVar.mShadowingHolder = null;
            if (agVar.shouldBeKeptAsChild()) {
                return;
            }
            View view = agVar.itemView;
            RecyclerView recyclerView = RecyclerView.this;
            if (recyclerView.removeAnimatingView(view) || !agVar.isTmpDetached()) {
                return;
            }
            recyclerView.removeDetachedView(agVar.itemView, false);
        }
    }

    public static abstract class n {
        @Deprecated
        public void getItemOffsets(@vo6 Rect rect, int i, @vo6 RecyclerView recyclerView) {
            rect.set(0, 0, 0, 0);
        }

        @Deprecated
        public void onDraw(@vo6 Canvas canvas, @vo6 RecyclerView recyclerView) {
        }

        @Deprecated
        public void onDrawOver(@vo6 Canvas canvas, @vo6 RecyclerView recyclerView) {
        }

        public void getItemOffsets(@vo6 Rect rect, @vo6 View view, @vo6 RecyclerView recyclerView, @vo6 ac acVar) {
            getItemOffsets(rect, ((p) view.getLayoutParams()).a.getLayoutPosition(), recyclerView);
        }

        public void onDraw(@vo6 Canvas canvas, @vo6 RecyclerView recyclerView, @vo6 ac acVar) {
            onDraw(canvas, recyclerView);
        }

        public void onDrawOver(@vo6 Canvas canvas, @vo6 RecyclerView recyclerView, @vo6 ac acVar) {
            onDrawOver(canvas, recyclerView);
        }
    }

    public static abstract class o {
        boolean mAutoMeasure;
        androidx.recyclerview.widget.h mChildHelper;
        private int mHeight;
        private int mHeightMode;
        av mHorizontalBoundCheck;
        private final av.b mHorizontalBoundCheckCallback;
        boolean mIsAttachedToWindow;
        private boolean mItemPrefetchEnabled;
        private boolean mMeasurementCacheEnabled;
        int mPrefetchMaxCountObserved;
        boolean mPrefetchMaxObservedInInitialPrefetch;
        RecyclerView mRecyclerView;
        boolean mRequestedSimpleAnimations;

        @rq6
        ab mSmoothScroller;
        av mVerticalBoundCheck;
        private final av.b mVerticalBoundCheckCallback;
        private int mWidth;
        private int mWidthMode;

        public class a implements av.b {
            public a() {
            }

            @Override // androidx.recyclerview.widget.av.b
            public final int a(View view) {
                return o.this.getDecoratedLeft(view) - ((ViewGroup.MarginLayoutParams) ((p) view.getLayoutParams())).leftMargin;
            }

            @Override // androidx.recyclerview.widget.av.b
            public final int b() {
                return o.this.getPaddingLeft();
            }

            @Override // androidx.recyclerview.widget.av.b
            public final int c() {
                o oVar = o.this;
                return oVar.getWidth() - oVar.getPaddingRight();
            }

            @Override // androidx.recyclerview.widget.av.b
            public final View d(int i) {
                return o.this.getChildAt(i);
            }

            @Override // androidx.recyclerview.widget.av.b
            public final int e(View view) {
                return o.this.getDecoratedRight(view) + ((ViewGroup.MarginLayoutParams) ((p) view.getLayoutParams())).rightMargin;
            }
        }

        public class b implements av.b {
            public b() {
            }

            @Override // androidx.recyclerview.widget.av.b
            public final int a(View view) {
                return o.this.getDecoratedTop(view) - ((ViewGroup.MarginLayoutParams) ((p) view.getLayoutParams())).topMargin;
            }

            @Override // androidx.recyclerview.widget.av.b
            public final int b() {
                return o.this.getPaddingTop();
            }

            @Override // androidx.recyclerview.widget.av.b
            public final int c() {
                o oVar = o.this;
                return oVar.getHeight() - oVar.getPaddingBottom();
            }

            @Override // androidx.recyclerview.widget.av.b
            public final View d(int i) {
                return o.this.getChildAt(i);
            }

            @Override // androidx.recyclerview.widget.av.b
            public final int e(View view) {
                return o.this.getDecoratedBottom(view) + ((ViewGroup.MarginLayoutParams) ((p) view.getLayoutParams())).bottomMargin;
            }
        }

        public interface c {
            void a(int i, int i2);
        }

        public static class d {
            public int a;
            public int b;
            public boolean c;
            public boolean d;
        }

        public o() {
            a aVar = new a();
            this.mHorizontalBoundCheckCallback = aVar;
            b bVar = new b();
            this.mVerticalBoundCheckCallback = bVar;
            this.mHorizontalBoundCheck = new av(aVar);
            this.mVerticalBoundCheck = new av(bVar);
            this.mRequestedSimpleAnimations = false;
            this.mIsAttachedToWindow = false;
            this.mAutoMeasure = false;
            this.mMeasurementCacheEnabled = true;
            this.mItemPrefetchEnabled = true;
        }

        public static int chooseSize(int i, int i2, int i3) {
            int mode = View.MeasureSpec.getMode(i);
            int size = View.MeasureSpec.getSize(i);
            return mode != Integer.MIN_VALUE ? mode != 1073741824 ? Math.max(i2, i3) : size : Math.min(size, Math.max(i2, i3));
        }

        /* JADX WARN: Removed duplicated region for block: B:5:0x000c A[PHI: r3
          0x000c: PHI (r3v5 int) = (r3v0 int), (r3v2 int), (r3v0 int) binds: [B:7:0x0010, B:11:0x0016, B:4:0x000a] A[DONT_GENERATE, DONT_INLINE]] */
        /* JADX WARN: Removed duplicated region for block: B:6:0x000e  */
        @Deprecated
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public static int getChildMeasureSpec(int i, int i2, int i3, boolean z) {
            int i4 = i - i2;
            int i5 = 0;
            int iMax = Math.max(0, i4);
            if (z) {
                if (i3 >= 0) {
                    i5 = 1073741824;
                } else {
                    i3 = 0;
                }
            } else if (i3 < 0) {
                if (i3 == -1) {
                    i3 = iMax;
                    i5 = 1073741824;
                } else if (i3 == -2) {
                    i5 = Integer.MIN_VALUE;
                    i3 = iMax;
                }
            }
            return View.MeasureSpec.makeMeasureSpec(i3, i5);
        }

        public static d getProperties(@vo6 Context context, @rq6 AttributeSet attributeSet, int i, int i2) {
            d dVar = new d();
            TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, gp7.d.a, i, i2);
            dVar.a = typedArrayObtainStyledAttributes.getInt(0, 1);
            dVar.b = typedArrayObtainStyledAttributes.getInt(10, 1);
            dVar.c = typedArrayObtainStyledAttributes.getBoolean(9, false);
            dVar.d = typedArrayObtainStyledAttributes.getBoolean(11, false);
            typedArrayObtainStyledAttributes.recycle();
            return dVar;
        }

        public static boolean l(int i, int i2, int i3) {
            int mode = View.MeasureSpec.getMode(i2);
            int size = View.MeasureSpec.getSize(i2);
            if (i3 > 0 && i != i3) {
                return false;
            }
            if (mode == Integer.MIN_VALUE) {
                return size >= i;
            }
            if (mode != 0) {
                return mode == 1073741824 && size == i;
            }
            return true;
        }

        @SuppressLint({"UnknownNullness"})
        public void addDisappearingView(View view) {
            addDisappearingView(view, -1);
        }

        @SuppressLint({"UnknownNullness"})
        public void addView(View view) {
            addView(view, -1);
        }

        public void assertInLayoutOrScroll(String str) {
            RecyclerView recyclerView = this.mRecyclerView;
            if (recyclerView != null) {
                recyclerView.assertInLayoutOrScroll(str);
            }
        }

        @SuppressLint({"UnknownNullness"})
        public void assertNotInLayoutOrScroll(String str) {
            RecyclerView recyclerView = this.mRecyclerView;
            if (recyclerView != null) {
                recyclerView.assertNotInLayoutOrScroll(str);
            }
        }

        public void attachView(@vo6 View view, int i, p pVar) {
            ag childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
            if (childViewHolderInt.isRemoved()) {
                zs8 zs8Var = this.mRecyclerView.mViewInfoStore.a;
                aw.a aVarA = (aw.a) zs8Var.get(childViewHolderInt);
                if (aVarA == null) {
                    aVarA = aw.a.a();
                    zs8Var.put(childViewHolderInt, aVarA);
                }
                aVarA.a |= 1;
            } else {
                this.mRecyclerView.mViewInfoStore.c(childViewHolderInt);
            }
            this.mChildHelper.a(view, i, pVar, childViewHolderInt.isRemoved());
        }

        public void calculateItemDecorationsForChild(@vo6 View view, @vo6 Rect rect) {
            RecyclerView recyclerView = this.mRecyclerView;
            if (recyclerView == null) {
                rect.set(0, 0, 0, 0);
            } else {
                rect.set(recyclerView.getItemDecorInsetsForChild(view));
            }
        }

        public boolean canScrollHorizontally() {
            return false;
        }

        public boolean canScrollVertically() {
            return false;
        }

        public boolean checkLayoutParams(p pVar) {
            return pVar != null;
        }

        @SuppressLint({"UnknownNullness"})
        public void collectAdjacentPrefetchPositions(int i, int i2, ac acVar, c cVar) {
        }

        @SuppressLint({"UnknownNullness"})
        public void collectInitialPrefetchPositions(int i, c cVar) {
        }

        public int computeHorizontalScrollExtent(ac acVar) {
            return 0;
        }

        public int computeHorizontalScrollOffset(ac acVar) {
            return 0;
        }

        public int computeHorizontalScrollRange(ac acVar) {
            return 0;
        }

        public int computeVerticalScrollExtent(ac acVar) {
            return 0;
        }

        public int computeVerticalScrollOffset(ac acVar) {
            return 0;
        }

        public int computeVerticalScrollRange(ac acVar) {
            return 0;
        }

        public void detachAndScrapAttachedViews(@vo6 w wVar) {
            for (int childCount = getChildCount() - 1; childCount >= 0; childCount--) {
                m(wVar, childCount, getChildAt(childCount));
            }
        }

        public void detachAndScrapView(@vo6 View view, @vo6 w wVar) {
            m(wVar, this.mChildHelper.e(view), view);
        }

        public void detachAndScrapViewAt(int i, @vo6 w wVar) {
            m(wVar, i, getChildAt(i));
        }

        public void detachView(@vo6 View view) {
            int iE = this.mChildHelper.e(view);
            if (iE >= 0) {
                androidx.recyclerview.widget.h hVar = this.mChildHelper;
                int iD = hVar.d(iE);
                hVar.b.f(iD);
                RecyclerView recyclerView = hVar.a.a;
                View childAt = recyclerView.getChildAt(iD);
                if (childAt != null) {
                    ag childViewHolderInt = RecyclerView.getChildViewHolderInt(childAt);
                    if (childViewHolderInt != null) {
                        if (childViewHolderInt.isTmpDetached() && !childViewHolderInt.shouldIgnore()) {
                            StringBuilder sb = new StringBuilder("called detach on an already detached child ");
                            sb.append(childViewHolderInt);
                            throw new IllegalArgumentException(vw2.j(recyclerView, sb));
                        }
                        if (RecyclerView.sVerboseLoggingEnabled) {
                            childViewHolderInt.toString();
                        }
                        childViewHolderInt.addFlags(256);
                    }
                } else if (RecyclerView.sDebugAssertionsEnabled) {
                    StringBuilder sb2 = new StringBuilder("No view at offset ");
                    sb2.append(iD);
                    throw new IllegalArgumentException(vw2.j(recyclerView, sb2));
                }
                recyclerView.detachViewFromParent(iD);
            }
        }

        public void detachViewAt(int i) {
            getChildAt(i);
            androidx.recyclerview.widget.h hVar = this.mChildHelper;
            int iD = hVar.d(i);
            hVar.b.f(iD);
            RecyclerView recyclerView = hVar.a.a;
            View childAt = recyclerView.getChildAt(iD);
            if (childAt != null) {
                ag childViewHolderInt = RecyclerView.getChildViewHolderInt(childAt);
                if (childViewHolderInt != null) {
                    if (childViewHolderInt.isTmpDetached() && !childViewHolderInt.shouldIgnore()) {
                        StringBuilder sb = new StringBuilder("called detach on an already detached child ");
                        sb.append(childViewHolderInt);
                        throw new IllegalArgumentException(vw2.j(recyclerView, sb));
                    }
                    if (RecyclerView.sVerboseLoggingEnabled) {
                        childViewHolderInt.toString();
                    }
                    childViewHolderInt.addFlags(256);
                }
            } else if (RecyclerView.sDebugAssertionsEnabled) {
                StringBuilder sb2 = new StringBuilder("No view at offset ");
                sb2.append(iD);
                throw new IllegalArgumentException(vw2.j(recyclerView, sb2));
            }
            recyclerView.detachViewFromParent(iD);
        }

        public void dispatchAttachedToWindow(RecyclerView recyclerView) {
            this.mIsAttachedToWindow = true;
            onAttachedToWindow(recyclerView);
        }

        public void dispatchDetachedFromWindow(RecyclerView recyclerView, w wVar) {
            this.mIsAttachedToWindow = false;
            onDetachedFromWindow(recyclerView, wVar);
        }

        @SuppressLint({"UnknownNullness"})
        public void endAnimation(View view) {
            l lVar = this.mRecyclerView.mItemAnimator;
            if (lVar != null) {
                lVar.i(RecyclerView.getChildViewHolderInt(view));
            }
        }

        @rq6
        public View findContainingItemView(@vo6 View view) {
            View viewFindContainingItemView;
            RecyclerView recyclerView = this.mRecyclerView;
            if (recyclerView == null || (viewFindContainingItemView = recyclerView.findContainingItemView(view)) == null || this.mChildHelper.c.contains(viewFindContainingItemView)) {
                return null;
            }
            return viewFindContainingItemView;
        }

        @rq6
        public View findViewByPosition(int i) {
            int childCount = getChildCount();
            for (int i2 = 0; i2 < childCount; i2++) {
                View childAt = getChildAt(i2);
                ag childViewHolderInt = RecyclerView.getChildViewHolderInt(childAt);
                if (childViewHolderInt != null && childViewHolderInt.getLayoutPosition() == i && !childViewHolderInt.shouldIgnore() && (this.mRecyclerView.mState.g || !childViewHolderInt.isRemoved())) {
                    return childAt;
                }
            }
            return null;
        }

        public abstract p generateDefaultLayoutParams();

        @SuppressLint({"UnknownNullness"})
        public p generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
            return layoutParams instanceof p ? new p((p) layoutParams) : layoutParams instanceof ViewGroup.MarginLayoutParams ? new p((ViewGroup.MarginLayoutParams) layoutParams) : new p(layoutParams);
        }

        public int getBaseline() {
            return -1;
        }

        public int getBottomDecorationHeight(@vo6 View view) {
            return ((p) view.getLayoutParams()).b.bottom;
        }

        @rq6
        public View getChildAt(int i) {
            androidx.recyclerview.widget.h hVar = this.mChildHelper;
            if (hVar != null) {
                return hVar.b(i);
            }
            return null;
        }

        public int getChildCount() {
            androidx.recyclerview.widget.h hVar = this.mChildHelper;
            if (hVar != null) {
                return hVar.c();
            }
            return 0;
        }

        public boolean getClipToPadding() {
            RecyclerView recyclerView = this.mRecyclerView;
            return recyclerView != null && recyclerView.mClipToPadding;
        }

        public int getColumnCountForAccessibility(@vo6 w wVar, @vo6 ac acVar) {
            return -1;
        }

        public int getDecoratedBottom(@vo6 View view) {
            return getBottomDecorationHeight(view) + view.getBottom();
        }

        public void getDecoratedBoundsWithMargins(@vo6 View view, @vo6 Rect rect) {
            RecyclerView.getDecoratedBoundsWithMarginsInt(view, rect);
        }

        public int getDecoratedLeft(@vo6 View view) {
            return view.getLeft() - getLeftDecorationWidth(view);
        }

        public int getDecoratedMeasuredHeight(@vo6 View view) {
            Rect rect = ((p) view.getLayoutParams()).b;
            return view.getMeasuredHeight() + rect.top + rect.bottom;
        }

        public int getDecoratedMeasuredWidth(@vo6 View view) {
            Rect rect = ((p) view.getLayoutParams()).b;
            return view.getMeasuredWidth() + rect.left + rect.right;
        }

        public int getDecoratedRight(@vo6 View view) {
            return getRightDecorationWidth(view) + view.getRight();
        }

        public int getDecoratedTop(@vo6 View view) {
            return view.getTop() - getTopDecorationHeight(view);
        }

        @rq6
        public View getFocusedChild() {
            View focusedChild;
            RecyclerView recyclerView = this.mRecyclerView;
            if (recyclerView == null || (focusedChild = recyclerView.getFocusedChild()) == null || this.mChildHelper.c.contains(focusedChild)) {
                return null;
            }
            return focusedChild;
        }

        @cm7
        public int getHeight() {
            return this.mHeight;
        }

        public int getHeightMode() {
            return this.mHeightMode;
        }

        public int getItemCount() {
            RecyclerView recyclerView = this.mRecyclerView;
            g adapter = recyclerView != null ? recyclerView.getAdapter() : null;
            if (adapter != null) {
                return adapter.getItemCount();
            }
            return 0;
        }

        public int getItemViewType(@vo6 View view) {
            return RecyclerView.getChildViewHolderInt(view).getItemViewType();
        }

        public int getLayoutDirection() {
            RecyclerView recyclerView = this.mRecyclerView;
            WeakHashMap weakHashMap = sia.a;
            return recyclerView.getLayoutDirection();
        }

        public int getLeftDecorationWidth(@vo6 View view) {
            return ((p) view.getLayoutParams()).b.left;
        }

        @cm7
        public int getMinimumHeight() {
            RecyclerView recyclerView = this.mRecyclerView;
            WeakHashMap weakHashMap = sia.a;
            return recyclerView.getMinimumHeight();
        }

        @cm7
        public int getMinimumWidth() {
            RecyclerView recyclerView = this.mRecyclerView;
            WeakHashMap weakHashMap = sia.a;
            return recyclerView.getMinimumWidth();
        }

        @cm7
        public int getPaddingBottom() {
            RecyclerView recyclerView = this.mRecyclerView;
            if (recyclerView != null) {
                return recyclerView.getPaddingBottom();
            }
            return 0;
        }

        @cm7
        public int getPaddingEnd() {
            RecyclerView recyclerView = this.mRecyclerView;
            if (recyclerView == null) {
                return 0;
            }
            WeakHashMap weakHashMap = sia.a;
            return recyclerView.getPaddingEnd();
        }

        @cm7
        public int getPaddingLeft() {
            RecyclerView recyclerView = this.mRecyclerView;
            if (recyclerView != null) {
                return recyclerView.getPaddingLeft();
            }
            return 0;
        }

        @cm7
        public int getPaddingRight() {
            RecyclerView recyclerView = this.mRecyclerView;
            if (recyclerView != null) {
                return recyclerView.getPaddingRight();
            }
            return 0;
        }

        @cm7
        public int getPaddingStart() {
            RecyclerView recyclerView = this.mRecyclerView;
            if (recyclerView == null) {
                return 0;
            }
            WeakHashMap weakHashMap = sia.a;
            return recyclerView.getPaddingStart();
        }

        @cm7
        public int getPaddingTop() {
            RecyclerView recyclerView = this.mRecyclerView;
            if (recyclerView != null) {
                return recyclerView.getPaddingTop();
            }
            return 0;
        }

        public int getPosition(@vo6 View view) {
            return ((p) view.getLayoutParams()).a.getLayoutPosition();
        }

        public int getRightDecorationWidth(@vo6 View view) {
            return ((p) view.getLayoutParams()).b.right;
        }

        public int getRowCountForAccessibility(@vo6 w wVar, @vo6 ac acVar) {
            return -1;
        }

        public int getSelectionModeForAccessibility(@vo6 w wVar, @vo6 ac acVar) {
            return 0;
        }

        public int getTopDecorationHeight(@vo6 View view) {
            return ((p) view.getLayoutParams()).b.top;
        }

        public void getTransformedBoundingBox(@vo6 View view, boolean z, @vo6 Rect rect) {
            Matrix matrix;
            if (z) {
                Rect rect2 = ((p) view.getLayoutParams()).b;
                rect.set(-rect2.left, -rect2.top, view.getWidth() + rect2.right, view.getHeight() + rect2.bottom);
            } else {
                rect.set(0, 0, view.getWidth(), view.getHeight());
            }
            if (this.mRecyclerView != null && (matrix = view.getMatrix()) != null && !matrix.isIdentity()) {
                RectF rectF = this.mRecyclerView.mTempRectF;
                rectF.set(rect);
                matrix.mapRect(rectF);
                rect.set((int) Math.floor(rectF.left), (int) Math.floor(rectF.top), (int) Math.ceil(rectF.right), (int) Math.ceil(rectF.bottom));
            }
            rect.offset(view.getLeft(), view.getTop());
        }

        @cm7
        public int getWidth() {
            return this.mWidth;
        }

        public int getWidthMode() {
            return this.mWidthMode;
        }

        public boolean hasFlexibleChildInBothOrientations() {
            int childCount = getChildCount();
            for (int i = 0; i < childCount; i++) {
                ViewGroup.LayoutParams layoutParams = getChildAt(i).getLayoutParams();
                if (layoutParams.width < 0 && layoutParams.height < 0) {
                    return true;
                }
            }
            return false;
        }

        public boolean hasFocus() {
            RecyclerView recyclerView = this.mRecyclerView;
            return recyclerView != null && recyclerView.hasFocus();
        }

        public void ignoreView(@vo6 View view) {
            ViewParent parent = view.getParent();
            RecyclerView recyclerView = this.mRecyclerView;
            if (parent != recyclerView || recyclerView.indexOfChild(view) == -1) {
                throw new IllegalArgumentException(vw2.j(this.mRecyclerView, new StringBuilder("View should be fully attached to be ignored")));
            }
            ag childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
            childViewHolderInt.addFlags(128);
            this.mRecyclerView.mViewInfoStore.d(childViewHolderInt);
        }

        public boolean isAttachedToWindow() {
            return this.mIsAttachedToWindow;
        }

        public boolean isAutoMeasureEnabled() {
            return this.mAutoMeasure;
        }

        public boolean isFocused() {
            RecyclerView recyclerView = this.mRecyclerView;
            return recyclerView != null && recyclerView.isFocused();
        }

        public final boolean isItemPrefetchEnabled() {
            return this.mItemPrefetchEnabled;
        }

        public boolean isLayoutHierarchical(@vo6 w wVar, @vo6 ac acVar) {
            return false;
        }

        public boolean isMeasurementCacheEnabled() {
            return this.mMeasurementCacheEnabled;
        }

        public boolean isSmoothScrolling() {
            ab abVar = this.mSmoothScroller;
            return abVar != null && abVar.isRunning();
        }

        public boolean isViewPartiallyVisible(@vo6 View view, boolean z, boolean z2) {
            boolean z3 = this.mHorizontalBoundCheck.b(view) && this.mVerticalBoundCheck.b(view);
            return z ? z3 : !z3;
        }

        public final void k(View view, int i, boolean z) {
            ag childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
            if (z || childViewHolderInt.isRemoved()) {
                zs8 zs8Var = this.mRecyclerView.mViewInfoStore.a;
                aw.a aVarA = (aw.a) zs8Var.get(childViewHolderInt);
                if (aVarA == null) {
                    aVarA = aw.a.a();
                    zs8Var.put(childViewHolderInt, aVarA);
                }
                aVarA.a |= 1;
            } else {
                this.mRecyclerView.mViewInfoStore.c(childViewHolderInt);
            }
            p pVar = (p) view.getLayoutParams();
            if (childViewHolderInt.wasReturnedFromScrap() || childViewHolderInt.isScrap()) {
                if (childViewHolderInt.isScrap()) {
                    childViewHolderInt.unScrap();
                } else {
                    childViewHolderInt.clearReturnedFromScrapFlag();
                }
                this.mChildHelper.a(view, i, view.getLayoutParams(), false);
            } else if (view.getParent() == this.mRecyclerView) {
                int iE = this.mChildHelper.e(view);
                if (i == -1) {
                    i = this.mChildHelper.c();
                }
                if (iE == -1) {
                    StringBuilder sb = new StringBuilder("Added View has RecyclerView as parent but view is not a real child. Unfiltered index:");
                    sb.append(this.mRecyclerView.indexOfChild(view));
                    throw new IllegalStateException(vw2.j(this.mRecyclerView, sb));
                }
                if (iE != i) {
                    this.mRecyclerView.mLayout.moveView(iE, i);
                }
            } else {
                androidx.recyclerview.widget.h hVar = this.mChildHelper;
                RecyclerView recyclerView = hVar.a.a;
                int childCount = i < 0 ? recyclerView.getChildCount() : hVar.d(i);
                hVar.b.e(childCount, false);
                recyclerView.addView(view, childCount);
                recyclerView.dispatchChildAttached(view);
                pVar.c = true;
                ab abVar = this.mSmoothScroller;
                if (abVar != null && abVar.isRunning()) {
                    this.mSmoothScroller.onChildAttachedToWindow(view);
                }
            }
            if (pVar.d) {
                if (RecyclerView.sVerboseLoggingEnabled) {
                    Objects.toString(pVar.a);
                }
                childViewHolderInt.itemView.invalidate();
                pVar.d = false;
            }
        }

        public void layoutDecorated(@vo6 View view, int i, int i2, int i3, int i4) {
            Rect rect = ((p) view.getLayoutParams()).b;
            view.layout(i + rect.left, i2 + rect.top, i3 - rect.right, i4 - rect.bottom);
        }

        public void layoutDecoratedWithMargins(@vo6 View view, int i, int i2, int i3, int i4) {
            p pVar = (p) view.getLayoutParams();
            Rect rect = pVar.b;
            view.layout(i + rect.left + ((ViewGroup.MarginLayoutParams) pVar).leftMargin, i2 + rect.top + ((ViewGroup.MarginLayoutParams) pVar).topMargin, (i3 - rect.right) - ((ViewGroup.MarginLayoutParams) pVar).rightMargin, (i4 - rect.bottom) - ((ViewGroup.MarginLayoutParams) pVar).bottomMargin);
        }

        public final void m(w wVar, int i, View view) {
            ag childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
            if (childViewHolderInt.shouldIgnore()) {
                if (RecyclerView.sVerboseLoggingEnabled) {
                    childViewHolderInt.toString();
                }
            } else if (childViewHolderInt.isInvalid() && !childViewHolderInt.isRemoved() && !this.mRecyclerView.mAdapter.hasStableIds()) {
                removeViewAt(i);
                wVar.k(childViewHolderInt);
            } else {
                detachViewAt(i);
                wVar.l(view);
                this.mRecyclerView.mViewInfoStore.c(childViewHolderInt);
            }
        }

        public void measureChild(@vo6 View view, int i, int i2) {
            p pVar = (p) view.getLayoutParams();
            Rect itemDecorInsetsForChild = this.mRecyclerView.getItemDecorInsetsForChild(view);
            int i3 = itemDecorInsetsForChild.left + itemDecorInsetsForChild.right + i;
            int i4 = itemDecorInsetsForChild.top + itemDecorInsetsForChild.bottom + i2;
            int childMeasureSpec = getChildMeasureSpec(getWidth(), getWidthMode(), getPaddingRight() + getPaddingLeft() + i3, ((ViewGroup.MarginLayoutParams) pVar).width, canScrollHorizontally());
            int childMeasureSpec2 = getChildMeasureSpec(getHeight(), getHeightMode(), getPaddingBottom() + getPaddingTop() + i4, ((ViewGroup.MarginLayoutParams) pVar).height, canScrollVertically());
            if (shouldMeasureChild(view, childMeasureSpec, childMeasureSpec2, pVar)) {
                view.measure(childMeasureSpec, childMeasureSpec2);
            }
        }

        public void measureChildWithMargins(@vo6 View view, int i, int i2) {
            p pVar = (p) view.getLayoutParams();
            Rect itemDecorInsetsForChild = this.mRecyclerView.getItemDecorInsetsForChild(view);
            int i3 = itemDecorInsetsForChild.left + itemDecorInsetsForChild.right + i;
            int i4 = itemDecorInsetsForChild.top + itemDecorInsetsForChild.bottom + i2;
            int childMeasureSpec = getChildMeasureSpec(getWidth(), getWidthMode(), getPaddingRight() + getPaddingLeft() + ((ViewGroup.MarginLayoutParams) pVar).leftMargin + ((ViewGroup.MarginLayoutParams) pVar).rightMargin + i3, ((ViewGroup.MarginLayoutParams) pVar).width, canScrollHorizontally());
            int childMeasureSpec2 = getChildMeasureSpec(getHeight(), getHeightMode(), getPaddingBottom() + getPaddingTop() + ((ViewGroup.MarginLayoutParams) pVar).topMargin + ((ViewGroup.MarginLayoutParams) pVar).bottomMargin + i4, ((ViewGroup.MarginLayoutParams) pVar).height, canScrollVertically());
            if (shouldMeasureChild(view, childMeasureSpec, childMeasureSpec2, pVar)) {
                view.measure(childMeasureSpec, childMeasureSpec2);
            }
        }

        public void moveView(int i, int i2) {
            View childAt = getChildAt(i);
            if (childAt != null) {
                detachViewAt(i);
                attachView(childAt, i2);
            } else {
                throw new IllegalArgumentException("Cannot move a child from non-existing index:" + i + this.mRecyclerView.toString());
            }
        }

        public void offsetChildrenHorizontal(@cm7 int i) {
            RecyclerView recyclerView = this.mRecyclerView;
            if (recyclerView != null) {
                recyclerView.offsetChildrenHorizontal(i);
            }
        }

        public void offsetChildrenVertical(@cm7 int i) {
            RecyclerView recyclerView = this.mRecyclerView;
            if (recyclerView != null) {
                recyclerView.offsetChildrenVertical(i);
            }
        }

        public void onAdapterChanged(@rq6 g gVar, @rq6 g gVar2) {
        }

        public boolean onAddFocusables(@vo6 RecyclerView recyclerView, @vo6 ArrayList<View> arrayList, int i, int i2) {
            return false;
        }

        @or0
        public void onAttachedToWindow(RecyclerView recyclerView) {
        }

        @Deprecated
        public void onDetachedFromWindow(RecyclerView recyclerView) {
        }

        public View onFocusSearchFailed(View view, int i, w wVar, ac acVar) {
            return null;
        }

        public void onInitializeAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
            RecyclerView recyclerView = this.mRecyclerView;
            onInitializeAccessibilityEvent(recyclerView.mRecycler, recyclerView.mState, accessibilityEvent);
        }

        public void onInitializeAccessibilityNodeInfo(i3 i3Var) {
            RecyclerView recyclerView = this.mRecyclerView;
            onInitializeAccessibilityNodeInfo(recyclerView.mRecycler, recyclerView.mState, i3Var);
        }

        public void onInitializeAccessibilityNodeInfoForItem(View view, i3 i3Var) {
            ag childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
            if (childViewHolderInt == null || childViewHolderInt.isRemoved()) {
                return;
            }
            androidx.recyclerview.widget.h hVar = this.mChildHelper;
            if (hVar.c.contains(childViewHolderInt.itemView)) {
                return;
            }
            RecyclerView recyclerView = this.mRecyclerView;
            onInitializeAccessibilityNodeInfoForItem(recyclerView.mRecycler, recyclerView.mState, view, i3Var);
        }

        @rq6
        public View onInterceptFocusSearch(@vo6 View view, int i) {
            return null;
        }

        public void onItemsAdded(@vo6 RecyclerView recyclerView, int i, int i2) {
        }

        public void onItemsChanged(@vo6 RecyclerView recyclerView) {
        }

        public void onItemsMoved(@vo6 RecyclerView recyclerView, int i, int i2, int i3) {
        }

        public void onItemsRemoved(@vo6 RecyclerView recyclerView, int i, int i2) {
        }

        public void onItemsUpdated(@vo6 RecyclerView recyclerView, int i, int i2) {
        }

        public void onLayoutChildren(w wVar, ac acVar) {
            Log.e(RecyclerView.TAG, "You must override onLayoutChildren(Recycler recycler, State state) ");
        }

        public void onLayoutCompleted(ac acVar) {
        }

        public void onMeasure(@vo6 w wVar, @vo6 ac acVar, int i, int i2) {
            this.mRecyclerView.defaultOnMeasure(i, i2);
        }

        @Deprecated
        public boolean onRequestChildFocus(@vo6 RecyclerView recyclerView, @vo6 View view, @rq6 View view2) {
            return isSmoothScrolling() || recyclerView.isComputingLayout();
        }

        @SuppressLint({"UnknownNullness"})
        public void onRestoreInstanceState(Parcelable parcelable) {
        }

        @rq6
        public Parcelable onSaveInstanceState() {
            return null;
        }

        public void onScrollStateChanged(int i) {
        }

        public void onSmoothScrollerStopped(ab abVar) {
            if (this.mSmoothScroller == abVar) {
                this.mSmoothScroller = null;
            }
        }

        public boolean performAccessibilityAction(int i, @rq6 Bundle bundle) {
            RecyclerView recyclerView = this.mRecyclerView;
            return performAccessibilityAction(recyclerView.mRecycler, recyclerView.mState, i, bundle);
        }

        public boolean performAccessibilityActionForItem(@vo6 w wVar, @vo6 ac acVar, @vo6 View view, int i, @rq6 Bundle bundle) {
            return false;
        }

        public void postOnAnimation(Runnable runnable) {
            RecyclerView recyclerView = this.mRecyclerView;
            if (recyclerView != null) {
                WeakHashMap weakHashMap = sia.a;
                recyclerView.postOnAnimation(runnable);
            }
        }

        public void removeAllViews() {
            for (int childCount = getChildCount() - 1; childCount >= 0; childCount--) {
                this.mChildHelper.f(childCount);
            }
        }

        public void removeAndRecycleAllViews(@vo6 w wVar) {
            for (int childCount = getChildCount() - 1; childCount >= 0; childCount--) {
                if (!RecyclerView.getChildViewHolderInt(getChildAt(childCount)).shouldIgnore()) {
                    removeAndRecycleViewAt(childCount, wVar);
                }
            }
        }

        public void removeAndRecycleScrapInt(w wVar) {
            ArrayList arrayList = wVar.a;
            int size = arrayList.size();
            for (int i = size - 1; i >= 0; i--) {
                View view = ((ag) arrayList.get(i)).itemView;
                ag childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
                if (!childViewHolderInt.shouldIgnore()) {
                    childViewHolderInt.setIsRecyclable(false);
                    if (childViewHolderInt.isTmpDetached()) {
                        this.mRecyclerView.removeDetachedView(view, false);
                    }
                    l lVar = this.mRecyclerView.mItemAnimator;
                    if (lVar != null) {
                        lVar.i(childViewHolderInt);
                    }
                    childViewHolderInt.setIsRecyclable(true);
                    ag childViewHolderInt2 = RecyclerView.getChildViewHolderInt(view);
                    childViewHolderInt2.mScrapContainer = null;
                    childViewHolderInt2.mInChangeScrap = false;
                    childViewHolderInt2.clearReturnedFromScrapFlag();
                    wVar.k(childViewHolderInt2);
                }
            }
            arrayList.clear();
            ArrayList arrayList2 = wVar.b;
            if (arrayList2 != null) {
                arrayList2.clear();
            }
            if (size > 0) {
                this.mRecyclerView.invalidate();
            }
        }

        public void removeAndRecycleView(@vo6 View view, @vo6 w wVar) {
            removeView(view);
            wVar.j(view);
        }

        public void removeAndRecycleViewAt(int i, @vo6 w wVar) {
            View childAt = getChildAt(i);
            removeViewAt(i);
            wVar.j(childAt);
        }

        public boolean removeCallbacks(Runnable runnable) {
            RecyclerView recyclerView = this.mRecyclerView;
            if (recyclerView != null) {
                return recyclerView.removeCallbacks(runnable);
            }
            return false;
        }

        public void removeDetachedView(@vo6 View view) {
            this.mRecyclerView.removeDetachedView(view, false);
        }

        @SuppressLint({"UnknownNullness"})
        public void removeView(View view) {
            androidx.recyclerview.widget.h hVar = this.mChildHelper;
            an anVar = hVar.a;
            int i = hVar.d;
            if (i == 1) {
                throw new IllegalStateException("Cannot call removeView(At) within removeView(At)");
            }
            if (i == 2) {
                throw new IllegalStateException("Cannot call removeView(At) within removeViewIfHidden");
            }
            try {
                hVar.d = 1;
                hVar.e = view;
                int iIndexOfChild = anVar.a.indexOfChild(view);
                if (iIndexOfChild >= 0) {
                    if (hVar.b.f(iIndexOfChild)) {
                        hVar.g(view);
                    }
                    anVar.b(iIndexOfChild);
                }
                hVar.d = 0;
                hVar.e = null;
            } catch (Throwable th) {
                hVar.d = 0;
                hVar.e = null;
                throw th;
            }
        }

        public void removeViewAt(int i) {
            if (getChildAt(i) != null) {
                this.mChildHelper.f(i);
            }
        }

        /* JADX WARN: Removed duplicated region for block: B:28:0x00b6  */
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public boolean requestChildRectangleOnScreen(@vo6 RecyclerView recyclerView, @vo6 View view, @vo6 Rect rect, boolean z, boolean z2) {
            int paddingLeft = getPaddingLeft();
            int paddingTop = getPaddingTop();
            int width = getWidth() - getPaddingRight();
            int height = getHeight() - getPaddingBottom();
            int left = (view.getLeft() + rect.left) - view.getScrollX();
            int top = (view.getTop() + rect.top) - view.getScrollY();
            int iWidth = rect.width() + left;
            int iHeight = rect.height() + top;
            int i = left - paddingLeft;
            int iMin = Math.min(0, i);
            int i2 = top - paddingTop;
            int iMin2 = Math.min(0, i2);
            int i3 = iWidth - width;
            int iMax = Math.max(0, i3);
            int iMax2 = Math.max(0, iHeight - height);
            if (getLayoutDirection() != 1) {
                if (iMin == 0) {
                    iMin = Math.min(i, iMax);
                }
                iMax = iMin;
            } else if (iMax == 0) {
                iMax = Math.max(iMin, i3);
            }
            if (iMin2 == 0) {
                iMin2 = Math.min(i2, iMax2);
            }
            int[] iArr = {iMax, iMin2};
            int i4 = iArr[0];
            int i5 = iArr[1];
            if (z2) {
                View focusedChild = recyclerView.getFocusedChild();
                if (focusedChild != null) {
                    int paddingLeft2 = getPaddingLeft();
                    int paddingTop2 = getPaddingTop();
                    int width2 = getWidth() - getPaddingRight();
                    int height2 = getHeight() - getPaddingBottom();
                    Rect rect2 = this.mRecyclerView.mTempRect;
                    getDecoratedBoundsWithMargins(focusedChild, rect2);
                    if (rect2.left - i4 < width2 && rect2.right - i4 > paddingLeft2 && rect2.top - i5 < height2 && rect2.bottom - i5 > paddingTop2) {
                    }
                }
            } else if (i4 != 0 || i5 != 0) {
                if (z) {
                    recyclerView.scrollBy(i4, i5);
                } else {
                    recyclerView.smoothScrollBy(i4, i5);
                }
                return true;
            }
            return false;
        }

        public void requestLayout() {
            RecyclerView recyclerView = this.mRecyclerView;
            if (recyclerView != null) {
                recyclerView.requestLayout();
            }
        }

        public void requestSimpleAnimationsInNextLayout() {
            this.mRequestedSimpleAnimations = true;
        }

        public int scrollHorizontallyBy(int i, w wVar, ac acVar) {
            return 0;
        }

        public void scrollToPosition(int i) {
            if (RecyclerView.sVerboseLoggingEnabled) {
                Log.e(RecyclerView.TAG, "You MUST implement scrollToPosition. It will soon become abstract");
            }
        }

        public int scrollVerticallyBy(int i, w wVar, ac acVar) {
            return 0;
        }

        @Deprecated
        public void setAutoMeasureEnabled(boolean z) {
            this.mAutoMeasure = z;
        }

        public void setExactMeasureSpecsFrom(RecyclerView recyclerView) {
            setMeasureSpecs(View.MeasureSpec.makeMeasureSpec(recyclerView.getWidth(), 1073741824), View.MeasureSpec.makeMeasureSpec(recyclerView.getHeight(), 1073741824));
        }

        public final void setItemPrefetchEnabled(boolean z) {
            if (z != this.mItemPrefetchEnabled) {
                this.mItemPrefetchEnabled = z;
                this.mPrefetchMaxCountObserved = 0;
                RecyclerView recyclerView = this.mRecyclerView;
                if (recyclerView != null) {
                    recyclerView.mRecycler.o();
                }
            }
        }

        public void setMeasureSpecs(int i, int i2) {
            this.mWidth = View.MeasureSpec.getSize(i);
            int mode = View.MeasureSpec.getMode(i);
            this.mWidthMode = mode;
            if (mode == 0 && !RecyclerView.ALLOW_SIZE_IN_UNSPECIFIED_SPEC) {
                this.mWidth = 0;
            }
            this.mHeight = View.MeasureSpec.getSize(i2);
            int mode2 = View.MeasureSpec.getMode(i2);
            this.mHeightMode = mode2;
            if (mode2 != 0 || RecyclerView.ALLOW_SIZE_IN_UNSPECIFIED_SPEC) {
                return;
            }
            this.mHeight = 0;
        }

        public void setMeasuredDimension(Rect rect, int i, int i2) {
            setMeasuredDimension(chooseSize(i, getPaddingRight() + getPaddingLeft() + rect.width(), getMinimumWidth()), chooseSize(i2, getPaddingBottom() + getPaddingTop() + rect.height(), getMinimumHeight()));
        }

        public void setMeasuredDimensionFromChildren(int i, int i2) {
            int childCount = getChildCount();
            if (childCount == 0) {
                this.mRecyclerView.defaultOnMeasure(i, i2);
                return;
            }
            int i3 = Integer.MIN_VALUE;
            int i4 = Integer.MAX_VALUE;
            int i5 = Integer.MIN_VALUE;
            int i6 = Integer.MAX_VALUE;
            for (int i7 = 0; i7 < childCount; i7++) {
                View childAt = getChildAt(i7);
                Rect rect = this.mRecyclerView.mTempRect;
                getDecoratedBoundsWithMargins(childAt, rect);
                int i8 = rect.left;
                if (i8 < i6) {
                    i6 = i8;
                }
                int i9 = rect.right;
                if (i9 > i3) {
                    i3 = i9;
                }
                int i10 = rect.top;
                if (i10 < i4) {
                    i4 = i10;
                }
                int i11 = rect.bottom;
                if (i11 > i5) {
                    i5 = i11;
                }
            }
            this.mRecyclerView.mTempRect.set(i6, i4, i3, i5);
            setMeasuredDimension(this.mRecyclerView.mTempRect, i, i2);
        }

        public void setMeasurementCacheEnabled(boolean z) {
            this.mMeasurementCacheEnabled = z;
        }

        public void setRecyclerView(RecyclerView recyclerView) {
            if (recyclerView == null) {
                this.mRecyclerView = null;
                this.mChildHelper = null;
                this.mWidth = 0;
                this.mHeight = 0;
            } else {
                this.mRecyclerView = recyclerView;
                this.mChildHelper = recyclerView.mChildHelper;
                this.mWidth = recyclerView.getWidth();
                this.mHeight = recyclerView.getHeight();
            }
            this.mWidthMode = 1073741824;
            this.mHeightMode = 1073741824;
        }

        public boolean shouldMeasureChild(View view, int i, int i2, p pVar) {
            return (!view.isLayoutRequested() && this.mMeasurementCacheEnabled && l(view.getWidth(), i, ((ViewGroup.MarginLayoutParams) pVar).width) && l(view.getHeight(), i2, ((ViewGroup.MarginLayoutParams) pVar).height)) ? false : true;
        }

        public boolean shouldMeasureTwice() {
            return false;
        }

        public boolean shouldReMeasureChild(View view, int i, int i2, p pVar) {
            return (this.mMeasurementCacheEnabled && l(view.getMeasuredWidth(), i, ((ViewGroup.MarginLayoutParams) pVar).width) && l(view.getMeasuredHeight(), i2, ((ViewGroup.MarginLayoutParams) pVar).height)) ? false : true;
        }

        public void smoothScrollToPosition(RecyclerView recyclerView, ac acVar, int i) {
            Log.e(RecyclerView.TAG, "You must override smoothScrollToPosition to support smooth scrolling");
        }

        @SuppressLint({"UnknownNullness"})
        public void startSmoothScroll(ab abVar) {
            ab abVar2 = this.mSmoothScroller;
            if (abVar2 != null && abVar != abVar2 && abVar2.isRunning()) {
                this.mSmoothScroller.stop();
            }
            this.mSmoothScroller = abVar;
            abVar.start(this.mRecyclerView, this);
        }

        public void stopIgnoringView(@vo6 View view) {
            ag childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
            childViewHolderInt.stopIgnoring();
            childViewHolderInt.resetInternal();
            childViewHolderInt.addFlags(4);
        }

        public void stopSmoothScroller() {
            ab abVar = this.mSmoothScroller;
            if (abVar != null) {
                abVar.stop();
            }
        }

        public boolean supportsPredictiveItemAnimations() {
            return false;
        }

        @SuppressLint({"UnknownNullness"})
        public void addDisappearingView(View view, int i) {
            k(view, i, true);
        }

        @SuppressLint({"UnknownNullness"})
        public void addView(View view, int i) {
            k(view, i, false);
        }

        public void onDetachedFromWindow(RecyclerView recyclerView, w wVar) {
            onDetachedFromWindow(recyclerView);
        }

        public void onInitializeAccessibilityEvent(@vo6 w wVar, @vo6 ac acVar, @vo6 AccessibilityEvent accessibilityEvent) {
            RecyclerView recyclerView = this.mRecyclerView;
            if (recyclerView == null || accessibilityEvent == null) {
                return;
            }
            boolean z = true;
            if (!recyclerView.canScrollVertically(1) && !this.mRecyclerView.canScrollVertically(-1) && !this.mRecyclerView.canScrollHorizontally(-1) && !this.mRecyclerView.canScrollHorizontally(1)) {
                z = false;
            }
            accessibilityEvent.setScrollable(z);
            g gVar = this.mRecyclerView.mAdapter;
            if (gVar != null) {
                accessibilityEvent.setItemCount(gVar.getItemCount());
            }
        }

        public void onInitializeAccessibilityNodeInfo(@vo6 w wVar, @vo6 ac acVar, @vo6 i3 i3Var) {
            if (this.mRecyclerView.canScrollVertically(-1) || this.mRecyclerView.canScrollHorizontally(-1)) {
                i3Var.a(8192);
                i3Var.m(true);
            }
            if (this.mRecyclerView.canScrollVertically(1) || this.mRecyclerView.canScrollHorizontally(1)) {
                i3Var.a(4096);
                i3Var.m(true);
            }
            i3Var.j(i3.g.a(getRowCountForAccessibility(wVar, acVar), getColumnCountForAccessibility(wVar, acVar), getSelectionModeForAccessibility(wVar, acVar), isLayoutHierarchical(wVar, acVar)));
        }

        public void onItemsUpdated(@vo6 RecyclerView recyclerView, int i, int i2, @rq6 Object obj) {
            onItemsUpdated(recyclerView, i, i2);
        }

        public boolean onRequestChildFocus(@vo6 RecyclerView recyclerView, @vo6 ac acVar, @vo6 View view, @rq6 View view2) {
            return onRequestChildFocus(recyclerView, view, view2);
        }

        public boolean performAccessibilityAction(@vo6 w wVar, @vo6 ac acVar, int i, @rq6 Bundle bundle) {
            int paddingTop;
            int paddingLeft;
            int i2;
            int i3;
            if (this.mRecyclerView == null) {
                return false;
            }
            int height = getHeight();
            int width = getWidth();
            Rect rect = new Rect();
            if (this.mRecyclerView.getMatrix().isIdentity() && this.mRecyclerView.getGlobalVisibleRect(rect)) {
                height = rect.height();
                width = rect.width();
            }
            if (i == 4096) {
                paddingTop = this.mRecyclerView.canScrollVertically(1) ? (height - getPaddingTop()) - getPaddingBottom() : 0;
                if (this.mRecyclerView.canScrollHorizontally(1)) {
                    paddingLeft = (width - getPaddingLeft()) - getPaddingRight();
                    i2 = paddingTop;
                    i3 = paddingLeft;
                }
                i2 = paddingTop;
                i3 = 0;
            } else if (i != 8192) {
                i3 = 0;
                i2 = 0;
            } else {
                paddingTop = this.mRecyclerView.canScrollVertically(-1) ? -((height - getPaddingTop()) - getPaddingBottom()) : 0;
                if (this.mRecyclerView.canScrollHorizontally(-1)) {
                    paddingLeft = -((width - getPaddingLeft()) - getPaddingRight());
                    i2 = paddingTop;
                    i3 = paddingLeft;
                }
                i2 = paddingTop;
                i3 = 0;
            }
            if (i2 == 0 && i3 == 0) {
                return false;
            }
            this.mRecyclerView.smoothScrollBy(i3, i2, null, Integer.MIN_VALUE, true);
            return true;
        }

        public boolean performAccessibilityActionForItem(@vo6 View view, int i, @rq6 Bundle bundle) {
            RecyclerView recyclerView = this.mRecyclerView;
            return performAccessibilityActionForItem(recyclerView.mRecycler, recyclerView.mState, view, i, bundle);
        }

        /* JADX WARN: Removed duplicated region for block: B:10:0x001a  */
        /* JADX WARN: Removed duplicated region for block: B:14:0x0022  */
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public static int getChildMeasureSpec(int i, int i2, int i3, int i4, boolean z) {
            int iMax = Math.max(0, i - i3);
            if (z) {
                if (i4 < 0) {
                    if (i4 != -1 || (i2 != Integer.MIN_VALUE && (i2 == 0 || i2 != 1073741824))) {
                        i2 = 0;
                        i4 = 0;
                    } else {
                        i4 = iMax;
                    }
                }
                i2 = 1073741824;
            } else if (i4 >= 0) {
                i2 = 1073741824;
            } else if (i4 != -1) {
                if (i4 == -2) {
                    if (i2 == Integer.MIN_VALUE || i2 == 1073741824) {
                        i4 = iMax;
                        i2 = Integer.MIN_VALUE;
                    } else {
                        i4 = iMax;
                        i2 = 0;
                    }
                }
            }
            return View.MeasureSpec.makeMeasureSpec(i4, i2);
        }

        @SuppressLint({"UnknownNullness"})
        public p generateLayoutParams(Context context, AttributeSet attributeSet) {
            return new p(context, attributeSet);
        }

        public void onInitializeAccessibilityNodeInfoForItem(@vo6 w wVar, @vo6 ac acVar, @vo6 View view, @vo6 i3 i3Var) {
        }

        public void setMeasuredDimension(int i, int i2) {
            this.mRecyclerView.setMeasuredDimension(i, i2);
        }

        public void attachView(@vo6 View view, int i) {
            attachView(view, i, (p) view.getLayoutParams());
        }

        public void attachView(@vo6 View view) {
            attachView(view, -1);
        }

        public boolean requestChildRectangleOnScreen(@vo6 RecyclerView recyclerView, @vo6 View view, @vo6 Rect rect, boolean z) {
            return requestChildRectangleOnScreen(recyclerView, view, rect, z, false);
        }
    }

    public interface q {
        void b(View view);

        void c(View view);
    }

    public static abstract class r {
        public abstract boolean onFling(int i, int i2);
    }

    public interface s {
        boolean a(MotionEvent motionEvent);

        void d(boolean z);

        void e(MotionEvent motionEvent);
    }

    public static abstract class t {
        public void onScrollStateChanged(RecyclerView recyclerView, int i) {
        }

        public void onScrolled(RecyclerView recyclerView, int i, int i2) {
        }
    }

    @m38
    @Retention(RetentionPolicy.SOURCE)
    public @interface u {
    }

    public static class v {
        public final SparseArray a = new SparseArray();
        public int b = 0;
        public final Set c = Collections.newSetFromMap(new IdentityHashMap());

        public static class a {
            public final ArrayList a = new ArrayList();
            public int b = 5;
            public long c = 0;
            public long d = 0;
        }

        public final a a(int i) {
            SparseArray sparseArray = this.a;
            a aVar = (a) sparseArray.get(i);
            if (aVar != null) {
                return aVar;
            }
            a aVar2 = new a();
            sparseArray.put(i, aVar2);
            return aVar2;
        }

        public final void b(int i, int i2) {
            a aVarA = a(i);
            aVarA.b = i2;
            ArrayList arrayList = aVarA.a;
            while (arrayList.size() > i2) {
                arrayList.remove(arrayList.size() - 1);
            }
        }
    }

    public final class w {
        public final ArrayList a;
        public ArrayList b;
        public final ArrayList c;
        public final List d;
        public int e;
        public int f;
        public v g;
        public ae h;

        public w() {
            ArrayList arrayList = new ArrayList();
            this.a = arrayList;
            this.b = null;
            this.c = new ArrayList();
            this.d = Collections.unmodifiableList(arrayList);
            this.e = 2;
            this.f = 2;
        }

        public static void e(ViewGroup viewGroup, boolean z) {
            for (int childCount = viewGroup.getChildCount() - 1; childCount >= 0; childCount--) {
                View childAt = viewGroup.getChildAt(childCount);
                if (childAt instanceof ViewGroup) {
                    e((ViewGroup) childAt, true);
                }
            }
            if (z) {
                if (viewGroup.getVisibility() == 4) {
                    viewGroup.setVisibility(0);
                    viewGroup.setVisibility(4);
                } else {
                    int visibility = viewGroup.getVisibility();
                    viewGroup.setVisibility(4);
                    viewGroup.setVisibility(visibility);
                }
            }
        }

        public final void a(ag agVar, boolean z) {
            RecyclerView.clearNestedRecyclerViewIfNotNested(agVar);
            View view = agVar.itemView;
            RecyclerView recyclerView = RecyclerView.this;
            ao aoVar = recyclerView.mAccessibilityDelegate;
            if (aoVar != null) {
                b3 itemDelegate = aoVar.getItemDelegate();
                sia.z(view, itemDelegate instanceof ao.a ? (b3) ((ao.a) itemDelegate).b.remove(view) : null);
            }
            if (z) {
                x xVar = recyclerView.mRecyclerListener;
                if (xVar != null) {
                    xVar.a(agVar);
                }
                int size = recyclerView.mRecyclerListeners.size();
                for (int i = 0; i < size; i++) {
                    recyclerView.mRecyclerListeners.get(i).a(agVar);
                }
                g gVar = recyclerView.mAdapter;
                if (gVar != null) {
                    gVar.onViewRecycled(agVar);
                }
                if (recyclerView.mState != null) {
                    recyclerView.mViewInfoStore.d(agVar);
                }
                if (RecyclerView.sVerboseLoggingEnabled) {
                    Objects.toString(agVar);
                }
            }
            agVar.mBindingAdapter = null;
            agVar.mOwnerRecyclerView = null;
            v vVarC = c();
            vVarC.getClass();
            int itemViewType = agVar.getItemViewType();
            ArrayList arrayList = vVarC.a(itemViewType).a;
            if (((v.a) vVarC.a.get(itemViewType)).b <= arrayList.size()) {
                rc7.a(agVar.itemView);
            } else {
                if (RecyclerView.sDebugAssertionsEnabled && arrayList.contains(agVar)) {
                    throw new IllegalArgumentException("this scrap item already exists");
                }
                agVar.resetInternal();
                arrayList.add(agVar);
            }
        }

        public final int b(int i) {
            RecyclerView recyclerView = RecyclerView.this;
            if (i >= 0 && i < recyclerView.mState.b()) {
                return !recyclerView.mState.g ? i : recyclerView.mAdapterHelper.f(i, 0);
            }
            StringBuilder sbJ = fi7.j(i, "invalid position ", ". State item count is ");
            sbJ.append(recyclerView.mState.b());
            sbJ.append(recyclerView.exceptionLabel());
            throw new IndexOutOfBoundsException(sbJ.toString());
        }

        public final v c() {
            if (this.g == null) {
                this.g = new v();
                f();
            }
            return this.g;
        }

        public final View d(int i) {
            return m(i, Long.MAX_VALUE).itemView;
        }

        public final void f() {
            if (this.g != null) {
                RecyclerView recyclerView = RecyclerView.this;
                if (recyclerView.mAdapter == null || !recyclerView.isAttachedToWindow()) {
                    return;
                }
                v vVar = this.g;
                vVar.c.add(recyclerView.mAdapter);
            }
        }

        public final void g(g gVar, boolean z) {
            v vVar = this.g;
            if (vVar != null) {
                SparseArray sparseArray = vVar.a;
                Set set = vVar.c;
                set.remove(gVar);
                if (set.size() != 0 || z) {
                    return;
                }
                for (int i = 0; i < sparseArray.size(); i++) {
                    ArrayList arrayList = ((v.a) sparseArray.get(sparseArray.keyAt(i))).a;
                    for (int i2 = 0; i2 < arrayList.size(); i2++) {
                        rc7.a(((ag) arrayList.get(i2)).itemView);
                    }
                }
            }
        }

        public final void h() {
            ArrayList arrayList = this.c;
            for (int size = arrayList.size() - 1; size >= 0; size--) {
                i(size);
            }
            arrayList.clear();
            if (RecyclerView.ALLOW_THREAD_GAP_WORK) {
                w.b bVar = RecyclerView.this.mPrefetchRegistry;
                int[] iArr = bVar.c;
                if (iArr != null) {
                    Arrays.fill(iArr, -1);
                }
                bVar.d = 0;
            }
        }

        public final void i(int i) {
            int i2 = RecyclerView.HORIZONTAL;
            ArrayList arrayList = this.c;
            ag agVar = (ag) arrayList.get(i);
            if (RecyclerView.sVerboseLoggingEnabled) {
                Objects.toString(agVar);
            }
            a(agVar, true);
            arrayList.remove(i);
        }

        public final void j(View view) {
            ag childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
            boolean zIsTmpDetached = childViewHolderInt.isTmpDetached();
            RecyclerView recyclerView = RecyclerView.this;
            if (zIsTmpDetached) {
                recyclerView.removeDetachedView(view, false);
            }
            if (childViewHolderInt.isScrap()) {
                childViewHolderInt.unScrap();
            } else if (childViewHolderInt.wasReturnedFromScrap()) {
                childViewHolderInt.clearReturnedFromScrapFlag();
            }
            k(childViewHolderInt);
            if (recyclerView.mItemAnimator == null || childViewHolderInt.isRecyclable()) {
                return;
            }
            recyclerView.mItemAnimator.i(childViewHolderInt);
        }

        /* JADX WARN: Code restructure failed: missing block: B:60:0x00c0, code lost:
        
            r4 = r4 - 1;
         */
        /* JADX WARN: Removed duplicated region for block: B:54:0x00a5  */
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public final void k(ag agVar) {
            boolean z;
            int i;
            boolean zIsScrap = agVar.isScrap();
            boolean z2 = true;
            RecyclerView recyclerView = RecyclerView.this;
            if (zIsScrap || agVar.itemView.getParent() != null) {
                StringBuilder sb = new StringBuilder("Scrapped or attached views may not be recycled. isScrap:");
                sb.append(agVar.isScrap());
                sb.append(" isAttached:");
                sb.append(agVar.itemView.getParent() != null);
                sb.append(recyclerView.exceptionLabel());
                throw new IllegalArgumentException(sb.toString());
            }
            if (agVar.isTmpDetached()) {
                StringBuilder sb2 = new StringBuilder("Tmp detached view should be removed from RecyclerView before it can be recycled: ");
                sb2.append(agVar);
                throw new IllegalArgumentException(vw2.j(recyclerView, sb2));
            }
            if (agVar.shouldIgnore()) {
                throw new IllegalArgumentException(vw2.j(recyclerView, new StringBuilder("Trying to recycle an ignored view holder. You should first call stopIgnoringView(view) before calling recycle.")));
            }
            boolean zDoesTransientStatePreventRecycling = agVar.doesTransientStatePreventRecycling();
            g gVar = recyclerView.mAdapter;
            boolean z3 = gVar != null && zDoesTransientStatePreventRecycling && gVar.onFailedToRecycleView(agVar);
            boolean z4 = RecyclerView.sDebugAssertionsEnabled;
            ArrayList arrayList = this.c;
            if (z4 && arrayList.contains(agVar)) {
                StringBuilder sb3 = new StringBuilder("cached view received recycle internal? ");
                sb3.append(agVar);
                throw new IllegalArgumentException(vw2.j(recyclerView, sb3));
            }
            if (z3 || agVar.isRecyclable()) {
                if (this.f <= 0 || agVar.hasAnyOfTheFlags(526)) {
                    z = false;
                } else {
                    int size = arrayList.size();
                    if (size >= this.f && size > 0) {
                        i(0);
                        size--;
                    }
                    if (RecyclerView.ALLOW_THREAD_GAP_WORK && size > 0) {
                        w.b bVar = recyclerView.mPrefetchRegistry;
                        int i2 = agVar.mPosition;
                        if (bVar.c != null) {
                            int i3 = bVar.d * 2;
                            for (int i4 = 0; i4 < i3; i4 += 2) {
                                if (bVar.c[i4] == i2) {
                                    break;
                                }
                            }
                            i = size - 1;
                            loop1: while (i >= 0) {
                                int i5 = ((ag) arrayList.get(i)).mPosition;
                                w.b bVar2 = recyclerView.mPrefetchRegistry;
                                if (bVar2.c == null) {
                                    break;
                                }
                                int i6 = bVar2.d * 2;
                                for (int i7 = 0; i7 < i6; i7 += 2) {
                                    if (bVar2.c[i7] == i5) {
                                        break;
                                    }
                                }
                                break loop1;
                            }
                            size = i + 1;
                        } else {
                            i = size - 1;
                            loop1: while (i >= 0) {
                            }
                            size = i + 1;
                        }
                    }
                    arrayList.add(size, agVar);
                    z = true;
                }
                if (z) {
                    z2 = false;
                } else {
                    a(agVar, true);
                }
                z = z;
            } else {
                if (RecyclerView.sVerboseLoggingEnabled) {
                    recyclerView.exceptionLabel();
                }
                z2 = false;
            }
            recyclerView.mViewInfoStore.d(agVar);
            if (z || z2 || !zDoesTransientStatePreventRecycling) {
                return;
            }
            rc7.a(agVar.itemView);
            agVar.mBindingAdapter = null;
            agVar.mOwnerRecyclerView = null;
        }

        public final void l(View view) {
            ag childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
            boolean zHasAnyOfTheFlags = childViewHolderInt.hasAnyOfTheFlags(12);
            RecyclerView recyclerView = RecyclerView.this;
            if (!zHasAnyOfTheFlags && childViewHolderInt.isUpdated() && !recyclerView.canReuseUpdatedViewHolder(childViewHolderInt)) {
                if (this.b == null) {
                    this.b = new ArrayList();
                }
                childViewHolderInt.setScrapContainer(this, true);
                this.b.add(childViewHolderInt);
                return;
            }
            if (childViewHolderInt.isInvalid() && !childViewHolderInt.isRemoved() && !recyclerView.mAdapter.hasStableIds()) {
                throw new IllegalArgumentException(vw2.j(recyclerView, new StringBuilder("Called scrap view with an invalid view. Invalid views cannot be reused from scrap, they should rebound from recycler pool.")));
            }
            childViewHolderInt.setScrapContainer(this, false);
            this.a.add(childViewHolderInt);
        }

        /* JADX WARN: Multi-variable type inference failed */
        /* JADX WARN: Removed duplicated region for block: B:152:0x0296  */
        /* JADX WARN: Removed duplicated region for block: B:215:0x03cd  */
        /* JADX WARN: Removed duplicated region for block: B:217:0x03d0  */
        /* JADX WARN: Removed duplicated region for block: B:247:0x0460  */
        /* JADX WARN: Removed duplicated region for block: B:255:0x0481  */
        /* JADX WARN: Removed duplicated region for block: B:261:0x04a6  */
        /* JADX WARN: Removed duplicated region for block: B:269:0x04be  */
        /* JADX WARN: Removed duplicated region for block: B:278:0x04f3  */
        /* JADX WARN: Removed duplicated region for block: B:284:0x050a  */
        /* JADX WARN: Removed duplicated region for block: B:285:0x051c  */
        /* JADX WARN: Removed duplicated region for block: B:288:0x0524  */
        /* JADX WARN: Removed duplicated region for block: B:292:0x053f  */
        /* JADX WARN: Removed duplicated region for block: B:295:0x054e  */
        /* JADX WARN: Removed duplicated region for block: B:309:0x0581  */
        /* JADX WARN: Removed duplicated region for block: B:312:0x0589  */
        /* JADX WARN: Removed duplicated region for block: B:316:0x0594  */
        /* JADX WARN: Removed duplicated region for block: B:317:0x05a0  */
        /* JADX WARN: Removed duplicated region for block: B:323:0x05b9 A[ADDED_TO_REGION] */
        /* JADX WARN: Removed duplicated region for block: B:325:0x05bd  */
        /* JADX WARN: Removed duplicated region for block: B:37:0x0086  */
        /* JADX WARN: Removed duplicated region for block: B:42:0x0090  */
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public final ag m(int i, long j) {
            ag childViewHolder;
            int i2;
            int i3;
            long j2;
            long j3;
            long j4;
            int i4;
            long j5;
            int i5;
            int i6;
            ViewGroup.LayoutParams layoutParams;
            p pVar;
            RecyclerView recyclerViewFindNestedRecyclerView;
            ag agVar;
            ae aeVar;
            View viewA;
            View view;
            ag agVar2;
            boolean z;
            int size;
            int iF;
            RecyclerView recyclerView = RecyclerView.this;
            if (i < 0 || i >= recyclerView.mState.b()) {
                StringBuilder sbR = vw2.r("Invalid item position ", i, "(", "). Item count:", i);
                sbR.append(recyclerView.mState.b());
                sbR.append(recyclerView.exceptionLabel());
                throw new IndexOutOfBoundsException(sbR.toString());
            }
            int i7 = 1;
            if (recyclerView.mState.g) {
                ArrayList arrayList = this.b;
                if (arrayList == null || (size = arrayList.size()) == 0) {
                    childViewHolder = null;
                    i2 = childViewHolder == null ? 1 : 0;
                } else {
                    int i8 = 0;
                    while (true) {
                        if (i8 < size) {
                            childViewHolder = (ag) this.b.get(i8);
                            if (!childViewHolder.wasReturnedFromScrap() && childViewHolder.getLayoutPosition() == i) {
                                childViewHolder.addFlags(32);
                                break;
                            }
                            i8++;
                        } else if (recyclerView.mAdapter.hasStableIds() && (iF = recyclerView.mAdapterHelper.f(i, 0)) > 0 && iF < recyclerView.mAdapter.getItemCount()) {
                            long itemId = recyclerView.mAdapter.getItemId(iF);
                            for (int i9 = 0; i9 < size; i9++) {
                                ag agVar3 = (ag) this.b.get(i9);
                                if (!agVar3.wasReturnedFromScrap() && agVar3.getItemId() == itemId) {
                                    agVar3.addFlags(32);
                                    childViewHolder = agVar3;
                                    break;
                                }
                            }
                        }
                    }
                    childViewHolder = null;
                    if (childViewHolder == null) {
                    }
                }
                ArrayList arrayList2 = this.a;
                ArrayList arrayList3 = this.c;
                if (childViewHolder == null) {
                    int size2 = arrayList2.size();
                    for (int i10 = 0; i10 < size2; i10++) {
                        agVar2 = (ag) arrayList2.get(i10);
                        if (!agVar2.wasReturnedFromScrap() && agVar2.getLayoutPosition() == i && !agVar2.isInvalid() && (recyclerView.mState.g || !agVar2.isRemoved())) {
                            agVar2.addFlags(32);
                            break;
                        }
                    }
                    ArrayList arrayList4 = recyclerView.mChildHelper.c;
                    int size3 = arrayList4.size();
                    int i11 = 0;
                    while (true) {
                        if (i11 >= size3) {
                            view = null;
                            break;
                        }
                        view = (View) arrayList4.get(i11);
                        ag childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
                        if (childViewHolderInt.getLayoutPosition() == i && !childViewHolderInt.isInvalid() && !childViewHolderInt.isRemoved()) {
                            break;
                        }
                        i11++;
                    }
                    if (view != null) {
                        childViewHolder = RecyclerView.getChildViewHolderInt(view);
                        androidx.recyclerview.widget.h hVar = recyclerView.mChildHelper;
                        h.a aVar = hVar.b;
                        int iIndexOfChild = hVar.a.a.indexOfChild(view);
                        if (iIndexOfChild < 0) {
                            throw new IllegalArgumentException("view is not a child, cannot hide " + view);
                        }
                        if (!aVar.d(iIndexOfChild)) {
                            throw new RuntimeException("trying to unhide a view that was not hidden" + view);
                        }
                        aVar.a(iIndexOfChild);
                        hVar.g(view);
                        int iE = recyclerView.mChildHelper.e(view);
                        if (iE == -1) {
                            StringBuilder sb = new StringBuilder("layout index should not be -1 after unhiding a view:");
                            sb.append(childViewHolder);
                            throw new IllegalStateException(vw2.j(recyclerView, sb));
                        }
                        androidx.recyclerview.widget.h hVar2 = recyclerView.mChildHelper;
                        int iD = hVar2.d(iE);
                        hVar2.b.f(iD);
                        RecyclerView recyclerView2 = hVar2.a.a;
                        View childAt = recyclerView2.getChildAt(iD);
                        if (childAt != null) {
                            ag childViewHolderInt2 = RecyclerView.getChildViewHolderInt(childAt);
                            if (childViewHolderInt2 != null) {
                                if (childViewHolderInt2.isTmpDetached() && !childViewHolderInt2.shouldIgnore()) {
                                    StringBuilder sb2 = new StringBuilder("called detach on an already detached child ");
                                    sb2.append(childViewHolderInt2);
                                    throw new IllegalArgumentException(vw2.j(recyclerView2, sb2));
                                }
                                if (RecyclerView.sVerboseLoggingEnabled) {
                                    childViewHolderInt2.toString();
                                }
                                childViewHolderInt2.addFlags(256);
                            }
                        } else if (RecyclerView.sDebugAssertionsEnabled) {
                            StringBuilder sb3 = new StringBuilder("No view at offset ");
                            sb3.append(iD);
                            throw new IllegalArgumentException(vw2.j(recyclerView2, sb3));
                        }
                        recyclerView2.detachViewFromParent(iD);
                        l(view);
                        childViewHolder.addFlags(8224);
                    } else {
                        int size4 = arrayList3.size();
                        for (int i12 = 0; i12 < size4; i12++) {
                            agVar2 = (ag) arrayList3.get(i12);
                            if (!agVar2.isInvalid() && agVar2.getLayoutPosition() == i && !agVar2.isAttachedToTransitionOverlay()) {
                                arrayList3.remove(i12);
                                if (RecyclerView.sVerboseLoggingEnabled) {
                                    agVar2.toString();
                                }
                                childViewHolder = agVar2;
                            }
                        }
                        childViewHolder = null;
                    }
                    if (childViewHolder != null) {
                        if (!childViewHolder.isRemoved()) {
                            int i13 = childViewHolder.mPosition;
                            if (i13 < 0 || i13 >= recyclerView.mAdapter.getItemCount()) {
                                StringBuilder sb4 = new StringBuilder("Inconsistency detected. Invalid view holder adapter position");
                                sb4.append(childViewHolder);
                                throw new IndexOutOfBoundsException(vw2.j(recyclerView, sb4));
                            }
                            z = (recyclerView.mState.g || recyclerView.mAdapter.getItemViewType(childViewHolder.mPosition) == childViewHolder.getItemViewType()) && (!recyclerView.mAdapter.hasStableIds() || childViewHolder.getItemId() == recyclerView.mAdapter.getItemId(childViewHolder.mPosition));
                        } else {
                            if (RecyclerView.sDebugAssertionsEnabled && !recyclerView.mState.g) {
                                throw new IllegalStateException(vw2.j(recyclerView, new StringBuilder("should not receive a removed view unless it is pre layout")));
                            }
                            z = recyclerView.mState.g;
                        }
                        if (z) {
                            i2 = 1;
                        } else {
                            childViewHolder.addFlags(4);
                            if (childViewHolder.isScrap()) {
                                recyclerView.removeDetachedView(childViewHolder.itemView, false);
                                childViewHolder.unScrap();
                            } else if (childViewHolder.wasReturnedFromScrap()) {
                                childViewHolder.clearReturnedFromScrapFlag();
                            }
                            k(childViewHolder);
                            childViewHolder = null;
                        }
                    }
                }
                if (childViewHolder != null) {
                    j2 = 3;
                    int iF2 = recyclerView.mAdapterHelper.f(i, 0);
                    if (iF2 < 0 || iF2 >= recyclerView.mAdapter.getItemCount()) {
                        StringBuilder sbR2 = vw2.r("Inconsistency detected. Invalid item position ", i, "(offset:", ").state:", iF2);
                        sbR2.append(recyclerView.mState.b());
                        sbR2.append(recyclerView.exceptionLabel());
                        throw new IndexOutOfBoundsException(sbR2.toString());
                    }
                    int itemViewType = recyclerView.mAdapter.getItemViewType(iF2);
                    j3 = 4;
                    if (recyclerView.mAdapter.hasStableIds()) {
                        long itemId2 = recyclerView.mAdapter.getItemId(iF2);
                        int size5 = arrayList2.size() - 1;
                        while (true) {
                            if (size5 >= 0) {
                                j4 = 0;
                                ag agVar4 = (ag) arrayList2.get(size5);
                                if (agVar4.getItemId() != itemId2 || agVar4.wasReturnedFromScrap()) {
                                    i3 = i7;
                                } else {
                                    i3 = i7;
                                    if (itemViewType == agVar4.getItemViewType()) {
                                        agVar4.addFlags(32);
                                        if (agVar4.isRemoved() && !recyclerView.mState.g) {
                                            agVar4.setFlags(2, 14);
                                        }
                                        childViewHolder = agVar4;
                                    } else {
                                        arrayList2.remove(size5);
                                        recyclerView.removeDetachedView(agVar4.itemView, false);
                                        ag childViewHolderInt3 = RecyclerView.getChildViewHolderInt(agVar4.itemView);
                                        childViewHolderInt3.mScrapContainer = null;
                                        childViewHolderInt3.mInChangeScrap = false;
                                        childViewHolderInt3.clearReturnedFromScrapFlag();
                                        k(childViewHolderInt3);
                                    }
                                }
                                size5--;
                                i7 = i3;
                            } else {
                                i3 = i7;
                                j4 = 0;
                                int size6 = arrayList3.size() - 1;
                                while (true) {
                                    if (size6 < 0) {
                                        break;
                                    }
                                    ag agVar5 = (ag) arrayList3.get(size6);
                                    if (agVar5.getItemId() != itemId2 || agVar5.isAttachedToTransitionOverlay()) {
                                        size6--;
                                    } else if (itemViewType == agVar5.getItemViewType()) {
                                        arrayList3.remove(size6);
                                        childViewHolder = agVar5;
                                    } else {
                                        i(size6);
                                    }
                                }
                                childViewHolder = null;
                            }
                        }
                        if (childViewHolder != null) {
                            childViewHolder.mPosition = iF2;
                            i2 = i3;
                        }
                    } else {
                        i3 = 1;
                        j4 = 0;
                    }
                    if (childViewHolder == null && (aeVar = this.h) != null && (viewA = aeVar.a()) != null) {
                        childViewHolder = recyclerView.getChildViewHolder(viewA);
                        if (childViewHolder == null) {
                            throw new IllegalArgumentException(vw2.j(recyclerView, new StringBuilder("getViewForPositionAndType returned a view which does not have a ViewHolder")));
                        }
                        if (childViewHolder.shouldIgnore()) {
                            throw new IllegalArgumentException(vw2.j(recyclerView, new StringBuilder("getViewForPositionAndType returned a view that is ignored. You must call stopIgnoring before returning this view.")));
                        }
                    }
                    if (childViewHolder == null) {
                        int i14 = RecyclerView.HORIZONTAL;
                        v.a aVar2 = (v.a) c().a.get(itemViewType);
                        if (aVar2 != null) {
                            ArrayList arrayList5 = aVar2.a;
                            if (arrayList5.isEmpty()) {
                                agVar = null;
                                if (agVar != null) {
                                }
                                childViewHolder = agVar;
                            } else {
                                for (int size7 = arrayList5.size() - 1; size7 >= 0; size7--) {
                                    if (!((ag) arrayList5.get(size7)).isAttachedToTransitionOverlay()) {
                                        agVar = (ag) arrayList5.remove(size7);
                                        break;
                                    }
                                }
                                agVar = null;
                                if (agVar != null) {
                                    agVar.resetInternal();
                                    if (RecyclerView.FORCE_INVALIDATE_DISPLAY_LIST) {
                                        View view2 = agVar.itemView;
                                        if (view2 instanceof ViewGroup) {
                                            e((ViewGroup) view2, false);
                                        }
                                    }
                                }
                                childViewHolder = agVar;
                            }
                        }
                    }
                    if (childViewHolder == null) {
                        long nanoTime = recyclerView.getNanoTime();
                        if (j != Long.MAX_VALUE) {
                            long j6 = this.g.a(itemViewType).c;
                            if (((j6 == j4 || j6 + nanoTime < j) ? i3 : 0) == 0) {
                                return null;
                            }
                        }
                        ag agVarCreateViewHolder = recyclerView.mAdapter.createViewHolder(recyclerView, itemViewType);
                        if (RecyclerView.ALLOW_THREAD_GAP_WORK && (recyclerViewFindNestedRecyclerView = RecyclerView.findNestedRecyclerView(agVarCreateViewHolder.itemView)) != null) {
                            agVarCreateViewHolder.mNestedRecyclerView = new WeakReference<>(recyclerViewFindNestedRecyclerView);
                        }
                        long nanoTime2 = recyclerView.getNanoTime() - nanoTime;
                        v.a aVarA = this.g.a(itemViewType);
                        long j7 = aVarA.c;
                        if (j7 != j4) {
                            nanoTime2 = (nanoTime2 / 4) + ((j7 / 4) * 3);
                        }
                        aVarA.c = nanoTime2;
                        childViewHolder = agVarCreateViewHolder;
                    }
                } else {
                    i3 = 1;
                    j2 = 3;
                    j3 = 4;
                    j4 = 0;
                }
                if (i2 != 0 && !recyclerView.mState.g && childViewHolder.hasAnyOfTheFlags(8192)) {
                    childViewHolder.setFlags(0, 8192);
                    if (recyclerView.mState.j) {
                        l.e(childViewHolder);
                        l lVar = recyclerView.mItemAnimator;
                        childViewHolder.getUnmodifiedPayloads();
                        lVar.getClass();
                        l.d dVar = new l.d();
                        dVar.a(childViewHolder);
                        recyclerView.recordAnimationInfoIfBouncedHiddenView(childViewHolder, dVar);
                    }
                }
                if (recyclerView.mState.g || !childViewHolder.isBound()) {
                    if (childViewHolder.isBound() || childViewHolder.needsUpdate() || childViewHolder.isInvalid()) {
                        if (!RecyclerView.sDebugAssertionsEnabled && childViewHolder.isRemoved()) {
                            StringBuilder sb5 = new StringBuilder("Removed holder should be bound and it should come here only in pre-layout. Holder: ");
                            sb5.append(childViewHolder);
                            throw new IllegalStateException(vw2.j(recyclerView, sb5));
                        }
                        int iF3 = recyclerView.mAdapterHelper.f(i, 0);
                        childViewHolder.mBindingAdapter = null;
                        childViewHolder.mOwnerRecyclerView = recyclerView;
                        int itemViewType2 = childViewHolder.getItemViewType();
                        long nanoTime3 = recyclerView.getNanoTime();
                        if (j != Long.MAX_VALUE) {
                            long j8 = this.g.a(itemViewType2).d;
                            if (j8 == j4 || j8 + nanoTime3 < j) {
                            }
                        }
                        if (childViewHolder.isTmpDetached()) {
                            i4 = 0;
                        } else {
                            recyclerView.attachViewToParent(childViewHolder.itemView, recyclerView.getChildCount(), childViewHolder.itemView.getLayoutParams());
                            i4 = i3;
                        }
                        recyclerView.mAdapter.bindViewHolder(childViewHolder, iF3);
                        if (i4 != 0) {
                            recyclerView.detachViewFromParent(childViewHolder.itemView);
                        }
                        long nanoTime4 = recyclerView.getNanoTime() - nanoTime3;
                        v.a aVarA2 = this.g.a(childViewHolder.getItemViewType());
                        j5 = aVarA2.d;
                        if (j5 != j4) {
                            nanoTime4 = (nanoTime4 / j3) + ((j5 / j3) * j2);
                        }
                        aVarA2.d = nanoTime4;
                        if (recyclerView.isAccessibilityEnabled()) {
                            i5 = i3;
                        } else {
                            View view3 = childViewHolder.itemView;
                            WeakHashMap weakHashMap = sia.a;
                            if (view3.getImportantForAccessibility() == 0) {
                                i5 = i3;
                                view3.setImportantForAccessibility(i5);
                            } else {
                                i5 = i3;
                            }
                            ao aoVar = recyclerView.mAccessibilityDelegate;
                            if (aoVar != null) {
                                b3 itemDelegate = aoVar.getItemDelegate();
                                if (itemDelegate instanceof ao.a) {
                                    ao.a aVar3 = (ao.a) itemDelegate;
                                    b3 b3VarD = sia.d(view3);
                                    if (b3VarD != null && b3VarD != aVar3) {
                                        aVar3.b.put(view3, b3VarD);
                                    }
                                }
                                sia.z(view3, itemDelegate);
                            }
                        }
                        if (recyclerView.mState.g) {
                            childViewHolder.mPreLayoutPosition = i;
                        }
                        i6 = i5;
                    }
                    layoutParams = childViewHolder.itemView.getLayoutParams();
                    if (layoutParams == null) {
                        pVar = (p) recyclerView.generateDefaultLayoutParams();
                        childViewHolder.itemView.setLayoutParams(pVar);
                    } else if (recyclerView.checkLayoutParams(layoutParams)) {
                        pVar = (p) layoutParams;
                    } else {
                        pVar = (p) recyclerView.generateLayoutParams(layoutParams);
                        childViewHolder.itemView.setLayoutParams(pVar);
                    }
                    pVar.a = childViewHolder;
                    pVar.d = (i2 == 0 || i6 == 0) ? 0 : i5;
                    return childViewHolder;
                }
                childViewHolder.mPreLayoutPosition = i;
                i6 = 0;
                i5 = i3;
                layoutParams = childViewHolder.itemView.getLayoutParams();
                if (layoutParams == null) {
                }
                pVar.a = childViewHolder;
                pVar.d = (i2 == 0 || i6 == 0) ? 0 : i5;
                return childViewHolder;
            }
            childViewHolder = null;
            ArrayList arrayList22 = this.a;
            ArrayList arrayList32 = this.c;
            if (childViewHolder == null) {
            }
            if (childViewHolder != null) {
            }
            if (i2 != 0) {
                childViewHolder.setFlags(0, 8192);
                if (recyclerView.mState.j) {
                }
            }
            if (recyclerView.mState.g) {
                if (childViewHolder.isBound()) {
                    if (!RecyclerView.sDebugAssertionsEnabled) {
                    }
                    int iF32 = recyclerView.mAdapterHelper.f(i, 0);
                    childViewHolder.mBindingAdapter = null;
                    childViewHolder.mOwnerRecyclerView = recyclerView;
                    int itemViewType22 = childViewHolder.getItemViewType();
                    long nanoTime32 = recyclerView.getNanoTime();
                    if (j != Long.MAX_VALUE) {
                    }
                    if (childViewHolder.isTmpDetached()) {
                    }
                    recyclerView.mAdapter.bindViewHolder(childViewHolder, iF32);
                    if (i4 != 0) {
                    }
                    long nanoTime42 = recyclerView.getNanoTime() - nanoTime32;
                    v.a aVarA22 = this.g.a(childViewHolder.getItemViewType());
                    j5 = aVarA22.d;
                    if (j5 != j4) {
                    }
                    aVarA22.d = nanoTime42;
                    if (recyclerView.isAccessibilityEnabled()) {
                    }
                    if (recyclerView.mState.g) {
                    }
                    i6 = i5;
                }
            }
            layoutParams = childViewHolder.itemView.getLayoutParams();
            if (layoutParams == null) {
            }
            pVar.a = childViewHolder;
            pVar.d = (i2 == 0 || i6 == 0) ? 0 : i5;
            return childViewHolder;
        }

        public final void n(ag agVar) {
            if (agVar.mInChangeScrap) {
                this.b.remove(agVar);
            } else {
                this.a.remove(agVar);
            }
            agVar.mScrapContainer = null;
            agVar.mInChangeScrap = false;
            agVar.clearReturnedFromScrapFlag();
        }

        public final void o() {
            o oVar = RecyclerView.this.mLayout;
            this.f = this.e + (oVar != null ? oVar.mPrefetchMaxCountObserved : 0);
            ArrayList arrayList = this.c;
            for (int size = arrayList.size() - 1; size >= 0 && arrayList.size() > this.f; size--) {
                i(size);
            }
        }
    }

    public interface x {
        void a(ag agVar);
    }

    public class y extends i {
        public y() {
        }

        public final void a() {
            boolean z = RecyclerView.POST_UPDATES_ON_ANIMATION;
            RecyclerView recyclerView = RecyclerView.this;
            if (!z || !recyclerView.mHasFixedSize || !recyclerView.mIsAttached) {
                recyclerView.mAdapterUpdateDuringMeasure = true;
                recyclerView.requestLayout();
            } else {
                Runnable runnable = recyclerView.mUpdateChildViewsRunnable;
                WeakHashMap weakHashMap = sia.a;
                recyclerView.postOnAnimation(runnable);
            }
        }

        @Override // androidx.recyclerview.widget.RecyclerView.i
        public final void onChanged() {
            RecyclerView recyclerView = RecyclerView.this;
            recyclerView.assertNotInLayoutOrScroll(null);
            recyclerView.mState.f = true;
            recyclerView.processDataSetCompletelyChanged(true);
            if (recyclerView.mAdapterHelper.g()) {
                return;
            }
            recyclerView.requestLayout();
        }

        @Override // androidx.recyclerview.widget.RecyclerView.i
        public final void onItemRangeChanged(int i, int i2, Object obj) {
            RecyclerView recyclerView = RecyclerView.this;
            recyclerView.assertNotInLayoutOrScroll(null);
            androidx.recyclerview.widget.a aVar = recyclerView.mAdapterHelper;
            ArrayList arrayList = aVar.b;
            if (i2 < 1) {
                return;
            }
            arrayList.add(aVar.h(4, i, i2, obj));
            aVar.f |= 4;
            if (arrayList.size() == 1) {
                a();
            }
        }

        @Override // androidx.recyclerview.widget.RecyclerView.i
        public final void onItemRangeInserted(int i, int i2) {
            RecyclerView recyclerView = RecyclerView.this;
            recyclerView.assertNotInLayoutOrScroll(null);
            androidx.recyclerview.widget.a aVar = recyclerView.mAdapterHelper;
            ArrayList arrayList = aVar.b;
            if (i2 < 1) {
                return;
            }
            arrayList.add(aVar.h(1, i, i2, null));
            aVar.f |= 1;
            if (arrayList.size() == 1) {
                a();
            }
        }

        @Override // androidx.recyclerview.widget.RecyclerView.i
        public final void onItemRangeMoved(int i, int i2, int i3) {
            RecyclerView recyclerView = RecyclerView.this;
            recyclerView.assertNotInLayoutOrScroll(null);
            androidx.recyclerview.widget.a aVar = recyclerView.mAdapterHelper;
            ArrayList arrayList = aVar.b;
            if (i == i2) {
                return;
            }
            arrayList.add(aVar.h(8, i, i2, null));
            aVar.f |= 8;
            if (arrayList.size() == 1) {
                a();
            }
        }

        @Override // androidx.recyclerview.widget.RecyclerView.i
        public final void onItemRangeRemoved(int i, int i2) {
            RecyclerView recyclerView = RecyclerView.this;
            recyclerView.assertNotInLayoutOrScroll(null);
            androidx.recyclerview.widget.a aVar = recyclerView.mAdapterHelper;
            ArrayList arrayList = aVar.b;
            if (i2 < 1) {
                return;
            }
            arrayList.add(aVar.h(2, i, i2, null));
            aVar.f |= 2;
            if (arrayList.size() == 1) {
                a();
            }
        }

        @Override // androidx.recyclerview.widget.RecyclerView.i
        public final void onStateRestorationPolicyChanged() {
            g gVar;
            RecyclerView recyclerView = RecyclerView.this;
            if (recyclerView.mPendingSavedState == null || (gVar = recyclerView.mAdapter) == null || !gVar.canRestoreState()) {
                return;
            }
            recyclerView.requestLayout();
        }
    }

    @m38
    public static class z extends defpackage.ar {
        public static final Parcelable.Creator<z> CREATOR = new a();
        public Parcelable a;

        public class a implements Parcelable.ClassLoaderCreator<z> {
            @Override // android.os.Parcelable.ClassLoaderCreator
            public final z createFromParcel(Parcel parcel, ClassLoader classLoader) {
                return new z(parcel, classLoader);
            }

            @Override // android.os.Parcelable.Creator
            public final Object[] newArray(int i) {
                return new z[i];
            }

            @Override // android.os.Parcelable.Creator
            public final Object createFromParcel(Parcel parcel) {
                return new z(parcel, null);
            }
        }

        public z(Parcel parcel, ClassLoader classLoader) {
            super(parcel, classLoader);
            this.a = parcel.readParcelable(classLoader == null ? o.class.getClassLoader() : classLoader);
        }

        @Override // defpackage.ar, android.os.Parcelable
        public final void writeToParcel(Parcel parcel, int i) {
            super.writeToParcel(parcel, i);
            parcel.writeParcelable(this.a, 0);
        }
    }

    static {
        Class cls = Integer.TYPE;
        LAYOUT_MANAGER_CONSTRUCTOR_SIGNATURE = new Class[]{Context.class, AttributeSet.class, cls, cls};
        sQuinticInterpolator = new c();
        sDefaultEdgeEffectFactory = new ad();
    }

    public RecyclerView(@vo6 Context context, @rq6 AttributeSet attributeSet) {
        this(context, attributeSet, com.strmr.ps.R.attr.recyclerViewStyle);
    }

    public static int b(int i2, EdgeEffect edgeEffect, EdgeEffect edgeEffect2, int i3) {
        if (i2 > 0 && edgeEffect != null && androidx.core.widget.a.a(edgeEffect) != 0.0f) {
            int iRound = Math.round(androidx.core.widget.a.b(edgeEffect, ((-i2) * FLING_DESTRETCH_FACTOR) / i3, 0.5f) * ((-i3) / FLING_DESTRETCH_FACTOR));
            if (iRound != i2) {
                edgeEffect.finish();
            }
            return i2 - iRound;
        }
        if (i2 >= 0 || edgeEffect2 == null || androidx.core.widget.a.a(edgeEffect2) == 0.0f) {
            return i2;
        }
        float f2 = i3;
        int iRound2 = Math.round(androidx.core.widget.a.b(edgeEffect2, (i2 * FLING_DESTRETCH_FACTOR) / f2, 0.5f) * (f2 / FLING_DESTRETCH_FACTOR));
        if (iRound2 != i2) {
            edgeEffect2.finish();
        }
        return i2 - iRound2;
    }

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

    @rq6
    public static RecyclerView findNestedRecyclerView(@vo6 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 i2 = 0; i2 < childCount; i2++) {
            RecyclerView recyclerViewFindNestedRecyclerView = findNestedRecyclerView(viewGroup.getChildAt(i2));
            if (recyclerViewFindNestedRecyclerView != null) {
                return recyclerViewFindNestedRecyclerView;
            }
        }
        return null;
    }

    public static ag getChildViewHolderInt(View view) {
        if (view == null) {
            return null;
        }
        return ((p) view.getLayoutParams()).a;
    }

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

    private ek6 getScrollingChildHelper() {
        if (this.mScrollingChildHelper == null) {
            this.mScrollingChildHelper = new ek6(this);
        }
        return this.mScrollingChildHelper;
    }

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

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

    public final void a(ag agVar) {
        View view = agVar.itemView;
        boolean z2 = view.getParent() == this;
        this.mRecycler.n(getChildViewHolder(view));
        if (agVar.isTmpDetached()) {
            this.mChildHelper.a(view, -1, view.getLayoutParams(), true);
            return;
        }
        if (!z2) {
            androidx.recyclerview.widget.h hVar = this.mChildHelper;
            RecyclerView recyclerView = hVar.a.a;
            int childCount = recyclerView.getChildCount();
            hVar.b.e(childCount, true);
            hVar.c.add(view);
            ag childViewHolderInt = getChildViewHolderInt(view);
            if (childViewHolderInt != null) {
                childViewHolderInt.onEnteredHiddenState(recyclerView);
            }
            recyclerView.addView(view, childCount);
            recyclerView.dispatchChildAttached(view);
            return;
        }
        androidx.recyclerview.widget.h hVar2 = this.mChildHelper;
        int iIndexOfChild = hVar2.a.a.indexOfChild(view);
        if (iIndexOfChild < 0) {
            throw new IllegalArgumentException("view is not a child, cannot hide " + view);
        }
        hVar2.b.h(iIndexOfChild);
        hVar2.c.add(view);
        an anVar = hVar2.a;
        ag childViewHolderInt2 = getChildViewHolderInt(view);
        if (childViewHolderInt2 != null) {
            childViewHolderInt2.onEnteredHiddenState(anVar.a);
        }
    }

    public void absorbGlows(int i2, int i3) {
        if (i2 < 0) {
            ensureLeftGlow();
            if (this.mLeftGlow.isFinished()) {
                this.mLeftGlow.onAbsorb(-i2);
            }
        } else if (i2 > 0) {
            ensureRightGlow();
            if (this.mRightGlow.isFinished()) {
                this.mRightGlow.onAbsorb(i2);
            }
        }
        if (i3 < 0) {
            ensureTopGlow();
            if (this.mTopGlow.isFinished()) {
                this.mTopGlow.onAbsorb(-i3);
            }
        } else if (i3 > 0) {
            ensureBottomGlow();
            if (this.mBottomGlow.isFinished()) {
                this.mBottomGlow.onAbsorb(i3);
            }
        }
        if (i2 == 0 && i3 == 0) {
            return;
        }
        WeakHashMap weakHashMap = sia.a;
        postInvalidateOnAnimation();
    }

    @Override // android.view.ViewGroup, android.view.View
    public void addFocusables(ArrayList<View> arrayList, int i2, int i3) {
        o oVar = this.mLayout;
        if (oVar == null || !oVar.onAddFocusables(this, arrayList, i2, i3)) {
            super.addFocusables(arrayList, i2, i3);
        }
    }

    public void addItemDecoration(@vo6 n nVar, int i2) {
        o oVar = this.mLayout;
        if (oVar != null) {
            oVar.assertNotInLayoutOrScroll("Cannot add item decoration during a scroll  or layout");
        }
        if (this.mItemDecorations.isEmpty()) {
            setWillNotDraw(false);
        }
        if (i2 < 0) {
            this.mItemDecorations.add(nVar);
        } else {
            this.mItemDecorations.add(i2, nVar);
        }
        markItemDecorInsetsDirty();
        requestLayout();
    }

    public void addOnChildAttachStateChangeListener(@vo6 q qVar) {
        if (this.mOnChildAttachStateListeners == null) {
            this.mOnChildAttachStateListeners = new ArrayList();
        }
        this.mOnChildAttachStateListeners.add(qVar);
    }

    public void addOnItemTouchListener(@vo6 s sVar) {
        this.mOnItemTouchListeners.add(sVar);
    }

    public void addOnScrollListener(@vo6 t tVar) {
        if (this.mScrollListeners == null) {
            this.mScrollListeners = new ArrayList();
        }
        this.mScrollListeners.add(tVar);
    }

    public void addRecyclerListener(@vo6 x xVar) {
        kf7.a("'listener' arg cannot be null.", xVar != null);
        this.mRecyclerListeners.add(xVar);
    }

    public void animateAppearance(@vo6 ag agVar, @rq6 l.d dVar, @vo6 l.d dVar2) {
        agVar.setIsRecyclable(false);
        if (this.mItemAnimator.a(agVar, dVar, dVar2)) {
            postAnimationRunner();
        }
    }

    public void animateDisappearance(@vo6 ag agVar, @vo6 l.d dVar, @rq6 l.d dVar2) {
        a(agVar);
        agVar.setIsRecyclable(false);
        if (this.mItemAnimator.c(agVar, dVar, dVar2)) {
            postAnimationRunner();
        }
    }

    public void assertInLayoutOrScroll(String str) {
        if (isComputingLayout()) {
            return;
        }
        if (str != null) {
            throw new IllegalStateException(vw2.j(this, vw2.q(str)));
        }
        throw new IllegalStateException(vw2.j(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(vw2.j(this, new StringBuilder("Cannot call this method while RecyclerView is computing a layout or scrolling")));
        }
        if (this.mDispatchScrollCounter > 0) {
            Log.w(TAG, "Cannot call this method in a scroll callback. Scroll callbacks mightbe run during a measure & layout pass where you cannot change theRecyclerView data. Any method call that might change the structureof the RecyclerView or the adapter contents should be postponed tothe next frame.", new IllegalStateException(vw2.j(this, new StringBuilder(""))));
        }
    }

    public final void c() {
        aw.a aVar;
        this.mState.a(1);
        fillRemainingScrollValues(this.mState);
        this.mState.i = false;
        startInterceptRequestLayout();
        aw awVar = this.mViewInfoStore;
        awVar.a.clear();
        awVar.b.a();
        onEnterLayoutOrScroll();
        j();
        View focusedChild = (this.mPreserveFocusAfterLayout && hasFocus() && this.mAdapter != null) ? getFocusedChild() : null;
        ag agVarFindContainingViewHolder = focusedChild != null ? findContainingViewHolder(focusedChild) : null;
        if (agVarFindContainingViewHolder == null) {
            ac acVar = this.mState;
            acVar.m = -1L;
            acVar.l = -1;
            acVar.n = -1;
        } else {
            this.mState.m = this.mAdapter.hasStableIds() ? agVarFindContainingViewHolder.getItemId() : -1L;
            this.mState.l = this.mDataSetHasChangedAfterLayout ? -1 : agVarFindContainingViewHolder.isRemoved() ? agVarFindContainingViewHolder.mOldPosition : agVarFindContainingViewHolder.getAbsoluteAdapterPosition();
            ac acVar2 = this.mState;
            View focusedChild2 = agVarFindContainingViewHolder.itemView;
            int id = focusedChild2.getId();
            while (!focusedChild2.isFocused() && (focusedChild2 instanceof ViewGroup) && focusedChild2.hasFocus()) {
                focusedChild2 = ((ViewGroup) focusedChild2).getFocusedChild();
                if (focusedChild2.getId() != -1) {
                    id = focusedChild2.getId();
                }
            }
            acVar2.n = id;
        }
        ac acVar3 = this.mState;
        acVar3.h = acVar3.j && this.mItemsChanged;
        this.mItemsChanged = false;
        this.mItemsAddedOrRemoved = false;
        acVar3.g = acVar3.k;
        acVar3.e = this.mAdapter.getItemCount();
        f(this.mMinMaxLayoutPositions);
        if (this.mState.j) {
            int iC = this.mChildHelper.c();
            for (int i2 = 0; i2 < iC; i2++) {
                ag childViewHolderInt = getChildViewHolderInt(this.mChildHelper.b(i2));
                if (!childViewHolderInt.shouldIgnore() && (!childViewHolderInt.isInvalid() || this.mAdapter.hasStableIds())) {
                    l lVar = this.mItemAnimator;
                    l.e(childViewHolderInt);
                    childViewHolderInt.getUnmodifiedPayloads();
                    lVar.getClass();
                    l.d dVar = new l.d();
                    dVar.a(childViewHolderInt);
                    zs8 zs8Var = this.mViewInfoStore.a;
                    aw.a aVarA = (aw.a) zs8Var.get(childViewHolderInt);
                    if (aVarA == null) {
                        aVarA = aw.a.a();
                        zs8Var.put(childViewHolderInt, aVarA);
                    }
                    aVarA.b = dVar;
                    aVarA.a |= 4;
                    if (this.mState.h && childViewHolderInt.isUpdated() && !childViewHolderInt.isRemoved() && !childViewHolderInt.shouldIgnore() && !childViewHolderInt.isInvalid()) {
                        this.mViewInfoStore.b.g(getChangedHolderKey(childViewHolderInt), childViewHolderInt);
                    }
                }
            }
        }
        if (this.mState.k) {
            saveOldPositions();
            ac acVar4 = this.mState;
            boolean z2 = acVar4.f;
            acVar4.f = false;
            this.mLayout.onLayoutChildren(this.mRecycler, acVar4);
            this.mState.f = z2;
            for (int i3 = 0; i3 < this.mChildHelper.c(); i3++) {
                ag childViewHolderInt2 = getChildViewHolderInt(this.mChildHelper.b(i3));
                if (!childViewHolderInt2.shouldIgnore() && ((aVar = (aw.a) this.mViewInfoStore.a.get(childViewHolderInt2)) == null || (aVar.a & 4) == 0)) {
                    l.e(childViewHolderInt2);
                    boolean zHasAnyOfTheFlags = childViewHolderInt2.hasAnyOfTheFlags(8192);
                    l lVar2 = this.mItemAnimator;
                    childViewHolderInt2.getUnmodifiedPayloads();
                    lVar2.getClass();
                    l.d dVar2 = new l.d();
                    dVar2.a(childViewHolderInt2);
                    if (zHasAnyOfTheFlags) {
                        recordAnimationInfoIfBouncedHiddenView(childViewHolderInt2, dVar2);
                    } else {
                        zs8 zs8Var2 = this.mViewInfoStore.a;
                        aw.a aVarA2 = (aw.a) zs8Var2.get(childViewHolderInt2);
                        if (aVarA2 == null) {
                            aVarA2 = aw.a.a();
                            zs8Var2.put(childViewHolderInt2, aVarA2);
                        }
                        aVarA2.a |= 2;
                        aVarA2.b = dVar2;
                    }
                }
            }
            clearOldPositions();
        } else {
            clearOldPositions();
        }
        onExitLayoutOrScroll();
        stopInterceptRequestLayout(false);
        this.mState.d = 2;
    }

    public boolean canReuseUpdatedViewHolder(ag agVar) {
        l lVar = this.mItemAnimator;
        return lVar == null || lVar.g(agVar, agVar.getUnmodifiedPayloads());
    }

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

    public void clearOldPositions() {
        int childCount = this.mChildHelper.a.a.getChildCount();
        for (int i2 = 0; i2 < childCount; i2++) {
            ag childViewHolderInt = getChildViewHolderInt(this.mChildHelper.a.a.getChildAt(i2));
            if (!childViewHolderInt.shouldIgnore()) {
                childViewHolderInt.clearOldPosition();
            }
        }
        w wVar = this.mRecycler;
        ArrayList arrayList = wVar.a;
        ArrayList arrayList2 = wVar.c;
        int size = arrayList2.size();
        for (int i3 = 0; i3 < size; i3++) {
            ((ag) arrayList2.get(i3)).clearOldPosition();
        }
        int size2 = arrayList.size();
        for (int i4 = 0; i4 < size2; i4++) {
            ((ag) arrayList.get(i4)).clearOldPosition();
        }
        ArrayList arrayList3 = wVar.b;
        if (arrayList3 != null) {
            int size3 = arrayList3.size();
            for (int i5 = 0; i5 < size3; i5++) {
                ((ag) wVar.b.get(i5)).clearOldPosition();
            }
        }
    }

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

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

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

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

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

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

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

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

    public void considerReleasingGlowsOnScroll(int i2, int i3) {
        boolean zIsFinished;
        EdgeEffect edgeEffect = this.mLeftGlow;
        if (edgeEffect == null || edgeEffect.isFinished() || i2 <= 0) {
            zIsFinished = false;
        } else {
            this.mLeftGlow.onRelease();
            zIsFinished = this.mLeftGlow.isFinished();
        }
        EdgeEffect edgeEffect2 = this.mRightGlow;
        if (edgeEffect2 != null && !edgeEffect2.isFinished() && i2 < 0) {
            this.mRightGlow.onRelease();
            zIsFinished |= this.mRightGlow.isFinished();
        }
        EdgeEffect edgeEffect3 = this.mTopGlow;
        if (edgeEffect3 != null && !edgeEffect3.isFinished() && i3 > 0) {
            this.mTopGlow.onRelease();
            zIsFinished |= this.mTopGlow.isFinished();
        }
        EdgeEffect edgeEffect4 = this.mBottomGlow;
        if (edgeEffect4 != null && !edgeEffect4.isFinished() && i3 < 0) {
            this.mBottomGlow.onRelease();
            zIsFinished |= this.mBottomGlow.isFinished();
        }
        if (zIsFinished) {
            WeakHashMap weakHashMap = sia.a;
            postInvalidateOnAnimation();
        }
    }

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

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

    public void consumePendingUpdateOperations() {
        if (!this.mFirstLayoutComplete || this.mDataSetHasChangedAfterLayout) {
            int i2 = uq9.a;
            Trace.beginSection(TRACE_ON_DATA_SET_CHANGE_LAYOUT_TAG);
            dispatchLayout();
            Trace.endSection();
            return;
        }
        if (this.mAdapterHelper.g()) {
            androidx.recyclerview.widget.a aVar = this.mAdapterHelper;
            int i3 = aVar.f;
            if ((i3 & 4) == 0 || (i3 & 11) != 0) {
                if (aVar.g()) {
                    int i4 = uq9.a;
                    Trace.beginSection(TRACE_ON_DATA_SET_CHANGE_LAYOUT_TAG);
                    dispatchLayout();
                    Trace.endSection();
                    return;
                }
                return;
            }
            int i5 = uq9.a;
            Trace.beginSection(TRACE_HANDLE_ADAPTER_UPDATES_TAG);
            startInterceptRequestLayout();
            onEnterLayoutOrScroll();
            this.mAdapterHelper.j();
            if (!this.mLayoutWasDefered) {
                int iC = this.mChildHelper.c();
                int i6 = 0;
                while (true) {
                    if (i6 < iC) {
                        ag childViewHolderInt = getChildViewHolderInt(this.mChildHelper.b(i6));
                        if (childViewHolderInt != null && !childViewHolderInt.shouldIgnore() && childViewHolderInt.isUpdated()) {
                            dispatchLayout();
                            break;
                        }
                        i6++;
                    } else {
                        this.mAdapterHelper.b();
                        break;
                    }
                }
            }
            stopInterceptRequestLayout(true);
            onExitLayoutOrScroll();
            Trace.endSection();
        }
    }

    public final void d() {
        startInterceptRequestLayout();
        onEnterLayoutOrScroll();
        this.mState.a(6);
        this.mAdapterHelper.c();
        this.mState.e = this.mAdapter.getItemCount();
        this.mState.c = 0;
        if (this.mPendingSavedState != null && this.mAdapter.canRestoreState()) {
            Parcelable parcelable = this.mPendingSavedState.a;
            if (parcelable != null) {
                this.mLayout.onRestoreInstanceState(parcelable);
            }
            this.mPendingSavedState = null;
        }
        ac acVar = this.mState;
        acVar.g = false;
        this.mLayout.onLayoutChildren(this.mRecycler, acVar);
        ac acVar2 = this.mState;
        acVar2.f = false;
        acVar2.j = acVar2.j && this.mItemAnimator != null;
        acVar2.d = 4;
        onExitLayoutOrScroll();
        stopInterceptRequestLayout(false);
    }

    public void defaultOnMeasure(int i2, int i3) {
        int paddingRight = getPaddingRight() + getPaddingLeft();
        WeakHashMap weakHashMap = sia.a;
        setMeasuredDimension(o.chooseSize(i2, paddingRight, getMinimumWidth()), o.chooseSize(i3, getPaddingBottom() + getPaddingTop(), getMinimumHeight()));
    }

    public void dispatchChildAttached(View view) {
        ag childViewHolderInt = getChildViewHolderInt(view);
        onChildAttachedToWindow(view);
        g gVar = this.mAdapter;
        if (gVar != null && childViewHolderInt != null) {
            gVar.onViewAttachedToWindow(childViewHolderInt);
        }
        List<q> 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) {
        ag childViewHolderInt = getChildViewHolderInt(view);
        onChildDetachedFromWindow(view);
        g gVar = this.mAdapter;
        if (gVar != null && childViewHolderInt != null) {
            gVar.onViewDetachedFromWindow(childViewHolderInt);
        }
        List<q> 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:153:0x0306  */
    /* JADX WARN: Removed duplicated region for block: B:166:0x033a  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public void dispatchLayout() {
        View viewFindViewById;
        if (this.mAdapter == null) {
            Log.w(TAG, "No adapter attached; skipping layout");
            return;
        }
        if (this.mLayout == null) {
            Log.e(TAG, "No layout manager attached; skipping layout");
            return;
        }
        this.mState.i = false;
        boolean z2 = this.mLastAutoMeasureSkippedDueToExact && !(this.mLastAutoMeasureNonExactMeasuredWidth == getWidth() && this.mLastAutoMeasureNonExactMeasuredHeight == getHeight());
        this.mLastAutoMeasureNonExactMeasuredWidth = 0;
        this.mLastAutoMeasureNonExactMeasuredHeight = 0;
        this.mLastAutoMeasureSkippedDueToExact = false;
        if (this.mState.d == 1) {
            c();
            this.mLayout.setExactMeasureSpecsFrom(this);
            d();
        } else {
            androidx.recyclerview.widget.a aVar = this.mAdapterHelper;
            if ((aVar.c.isEmpty() || aVar.b.isEmpty()) && !z2 && this.mLayout.getWidth() == getWidth() && this.mLayout.getHeight() == getHeight()) {
                this.mLayout.setExactMeasureSpecsFrom(this);
            } else {
                this.mLayout.setExactMeasureSpecsFrom(this);
                d();
            }
        }
        this.mState.a(4);
        startInterceptRequestLayout();
        onEnterLayoutOrScroll();
        ac acVar = this.mState;
        acVar.d = 1;
        View view = null;
        if (acVar.j) {
            for (int iC = this.mChildHelper.c() - 1; iC >= 0; iC--) {
                ag childViewHolderInt = getChildViewHolderInt(this.mChildHelper.b(iC));
                if (!childViewHolderInt.shouldIgnore()) {
                    long changedHolderKey = getChangedHolderKey(childViewHolderInt);
                    this.mItemAnimator.getClass();
                    l.d dVar = new l.d();
                    dVar.a(childViewHolderInt);
                    ag agVar = (ag) this.mViewInfoStore.b.c(changedHolderKey);
                    if (agVar == null || agVar.shouldIgnore()) {
                        this.mViewInfoStore.a(childViewHolderInt, dVar);
                    } else {
                        aw.a aVar2 = (aw.a) this.mViewInfoStore.a.get(agVar);
                        boolean z3 = (aVar2 == null || (aVar2.a & 1) == 0) ? false : true;
                        aw.a aVar3 = (aw.a) this.mViewInfoStore.a.get(childViewHolderInt);
                        boolean z4 = (aVar3 == null || (aVar3.a & 1) == 0) ? false : true;
                        if (z3 && agVar == childViewHolderInt) {
                            this.mViewInfoStore.a(childViewHolderInt, dVar);
                        } else {
                            l.d dVarB = this.mViewInfoStore.b(agVar, 4);
                            this.mViewInfoStore.a(childViewHolderInt, dVar);
                            l.d dVarB2 = this.mViewInfoStore.b(childViewHolderInt, 8);
                            if (dVarB == null) {
                                int iC2 = this.mChildHelper.c();
                                for (int i2 = 0; i2 < iC2; i2++) {
                                    ag childViewHolderInt2 = getChildViewHolderInt(this.mChildHelper.b(i2));
                                    if (childViewHolderInt2 != childViewHolderInt && getChangedHolderKey(childViewHolderInt2) == changedHolderKey) {
                                        g gVar = this.mAdapter;
                                        if (gVar == null || !gVar.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(vw2.j(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(vw2.j(this, sb2));
                                    }
                                }
                                Log.e(TAG, "Problem while matching changed view holders with the newones. The pre-layout information for the change holder " + agVar + " cannot be found but it is necessary for " + childViewHolderInt + exceptionLabel());
                            } else {
                                agVar.setIsRecyclable(false);
                                if (z3) {
                                    a(agVar);
                                }
                                if (agVar != childViewHolderInt) {
                                    if (z4) {
                                        a(childViewHolderInt);
                                    }
                                    agVar.mShadowedHolder = childViewHolderInt;
                                    a(agVar);
                                    this.mRecycler.n(agVar);
                                    childViewHolderInt.setIsRecyclable(false);
                                    childViewHolderInt.mShadowingHolder = agVar;
                                }
                                if (this.mItemAnimator.b(agVar, childViewHolderInt, dVarB, dVarB2)) {
                                    postAnimationRunner();
                                }
                            }
                        }
                    }
                }
            }
            aw awVar = this.mViewInfoStore;
            aw.b bVar = this.mViewInfoProcessCallback;
            zs8 zs8Var = awVar.a;
            for (int i3 = zs8Var.c - 1; i3 >= 0; i3--) {
                ag agVar2 = (ag) zs8Var.f(i3);
                aw.a aVar4 = (aw.a) zs8Var.h(i3);
                int i4 = aVar4.a;
                if ((i4 & 3) == 3) {
                    bVar.b(agVar2);
                } else if ((i4 & 1) != 0) {
                    l.d dVar2 = aVar4.b;
                    if (dVar2 == null) {
                        bVar.b(agVar2);
                    } else {
                        bVar.c(agVar2, dVar2, aVar4.c);
                    }
                } else if ((i4 & 14) == 14) {
                    bVar.a(agVar2, aVar4.b, aVar4.c);
                } else if ((i4 & 12) == 12) {
                    bVar.d(agVar2, aVar4.b, aVar4.c);
                } else if ((i4 & 4) != 0) {
                    bVar.c(agVar2, aVar4.b, null);
                } else if ((i4 & 8) != 0) {
                    bVar.a(agVar2, aVar4.b, aVar4.c);
                }
                aVar4.a = 0;
                aVar4.b = null;
                aVar4.c = null;
                aw.a.d.a(aVar4);
            }
        }
        this.mLayout.removeAndRecycleScrapInt(this.mRecycler);
        ac acVar2 = this.mState;
        acVar2.b = acVar2.e;
        this.mDataSetHasChangedAfterLayout = false;
        this.mDispatchItemsChangedEvent = false;
        acVar2.j = false;
        acVar2.k = false;
        this.mLayout.mRequestedSimpleAnimations = false;
        ArrayList arrayList = this.mRecycler.b;
        if (arrayList != null) {
            arrayList.clear();
        }
        o oVar = this.mLayout;
        if (oVar.mPrefetchMaxObservedInInitialPrefetch) {
            oVar.mPrefetchMaxCountObserved = 0;
            oVar.mPrefetchMaxObservedInInitialPrefetch = false;
            this.mRecycler.o();
        }
        this.mLayout.onLayoutCompleted(this.mState);
        onExitLayoutOrScroll();
        stopInterceptRequestLayout(false);
        aw awVar2 = this.mViewInfoStore;
        awVar2.a.clear();
        awVar2.b.a();
        int[] iArr = this.mMinMaxLayoutPositions;
        int i5 = iArr[0];
        int i6 = iArr[1];
        f(iArr);
        int[] iArr2 = this.mMinMaxLayoutPositions;
        if (iArr2[0] != i5 || iArr2[1] != i6) {
            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.c.contains(focusedChild)) {
                        ag agVarFindViewHolderForItemId = (this.mState.m == -1 || !this.mAdapter.hasStableIds()) ? null : findViewHolderForItemId(this.mState.m);
                        if (agVarFindViewHolderForItemId != null) {
                            if (!this.mChildHelper.c.contains(agVarFindViewHolderForItemId.itemView) && agVarFindViewHolderForItemId.itemView.hasFocusable()) {
                                view = agVarFindViewHolderForItemId.itemView;
                            } else if (this.mChildHelper.c() > 0) {
                                ac acVar3 = this.mState;
                                int i7 = acVar3.l;
                                int i8 = i7 != -1 ? i7 : 0;
                                int iB = acVar3.b();
                                for (int i9 = i8; i9 < iB; i9++) {
                                    ag agVarFindViewHolderForAdapterPosition = findViewHolderForAdapterPosition(i9);
                                    if (agVarFindViewHolderForAdapterPosition == null) {
                                        break;
                                    }
                                    if (agVarFindViewHolderForAdapterPosition.itemView.hasFocusable()) {
                                        view = agVarFindViewHolderForAdapterPosition.itemView;
                                        break;
                                    }
                                }
                                int iMin = Math.min(iB, i8) - 1;
                                while (true) {
                                    if (iMin < 0) {
                                        break;
                                    }
                                    ag agVarFindViewHolderForAdapterPosition2 = findViewHolderForAdapterPosition(iMin);
                                    if (agVarFindViewHolderForAdapterPosition2 == null) {
                                        break;
                                    }
                                    if (agVarFindViewHolderForAdapterPosition2.itemView.hasFocusable()) {
                                        view = agVarFindViewHolderForAdapterPosition2.itemView;
                                        break;
                                    }
                                    iMin--;
                                }
                            }
                            if (view != null) {
                                int i10 = this.mState.n;
                                if (i10 != -1 && (viewFindViewById = view.findViewById(i10)) != null && viewFindViewById.isFocusable()) {
                                    view = viewFindViewById;
                                }
                                view.requestFocus();
                            }
                        }
                    }
                } else if (this.mChildHelper.c() == 0) {
                    requestFocus();
                }
            }
        }
        ac acVar4 = this.mState;
        acVar4.m = -1L;
        acVar4.l = -1;
        acVar4.n = -1;
    }

    @Override // android.view.View
    public boolean dispatchNestedFling(float f2, float f3, boolean z2) {
        return getScrollingChildHelper().a(f2, f3, z2);
    }

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

    @Override // android.view.View
    public boolean dispatchNestedPreScroll(int i2, int i3, int[] iArr, int[] iArr2) {
        return getScrollingChildHelper().c(i2, i3, iArr, iArr2, 0);
    }

    @Override // android.view.View
    public boolean dispatchNestedScroll(int i2, int i3, int i4, int i5, int[] iArr) {
        return getScrollingChildHelper().d(i2, i3, i4, i5, iArr, 0, null);
    }

    public void dispatchOnScrollStateChanged(int i2) {
        o oVar = this.mLayout;
        if (oVar != null) {
            oVar.onScrollStateChanged(i2);
        }
        onScrollStateChanged(i2);
        t tVar = this.mScrollListener;
        if (tVar != null) {
            tVar.onScrollStateChanged(this, i2);
        }
        List<t> list = this.mScrollListeners;
        if (list != null) {
            for (int size = list.size() - 1; size >= 0; size--) {
                this.mScrollListeners.get(size).onScrollStateChanged(this, i2);
            }
        }
    }

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

    public void dispatchPendingImportantForAccessibilityChanges() {
        int i2;
        for (int size = this.mPendingAccessibilityImportanceChange.size() - 1; size >= 0; size--) {
            ag agVar = this.mPendingAccessibilityImportanceChange.get(size);
            if (agVar.itemView.getParent() == this && !agVar.shouldIgnore() && (i2 = agVar.mPendingAccessibilityState) != -1) {
                View view = agVar.itemView;
                WeakHashMap weakHashMap = sia.a;
                view.setImportantForAccessibility(i2);
                agVar.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 z2;
        super.draw(canvas);
        int size = this.mItemDecorations.size();
        boolean z3 = false;
        for (int i2 = 0; i2 < size; i2++) {
            this.mItemDecorations.get(i2).onDrawOver(canvas, this, this.mState);
        }
        EdgeEffect edgeEffect = this.mLeftGlow;
        if (edgeEffect == null || edgeEffect.isFinished()) {
            z2 = 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;
            z2 = 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;
            z2 |= 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;
            z2 |= 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)) {
                z3 = true;
            }
            z2 |= z3;
            canvas.restoreToCount(iSave4);
        }
        if ((z2 || this.mItemAnimator == null || this.mItemDecorations.size() <= 0 || !this.mItemAnimator.k()) ? z2 : true) {
            WeakHashMap weakHashMap = sia.a;
            postInvalidateOnAnimation();
        }
    }

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

    public final boolean e(MotionEvent motionEvent) {
        int action = motionEvent.getAction();
        int size = this.mOnItemTouchListeners.size();
        for (int i2 = 0; i2 < size; i2++) {
            s sVar = this.mOnItemTouchListeners.get(i2);
            if (sVar.a(motionEvent) && action != 3) {
                this.mInterceptingOnItemTouchListener = sVar;
                return true;
            }
        }
        return false;
    }

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

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

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

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

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

    public final void f(int[] iArr) {
        int iC = this.mChildHelper.c();
        if (iC == 0) {
            iArr[0] = -1;
            iArr[1] = -1;
            return;
        }
        int i2 = Integer.MAX_VALUE;
        int i3 = Integer.MIN_VALUE;
        for (int i4 = 0; i4 < iC; i4++) {
            ag childViewHolderInt = getChildViewHolderInt(this.mChildHelper.b(i4));
            if (!childViewHolderInt.shouldIgnore()) {
                int layoutPosition = childViewHolderInt.getLayoutPosition();
                if (layoutPosition < i2) {
                    i2 = layoutPosition;
                }
                if (layoutPosition > i3) {
                    i3 = layoutPosition;
                }
            }
        }
        iArr[0] = i2;
        iArr[1] = i3;
    }

    public final void fillRemainingScrollValues(ac acVar) {
        if (getScrollState() != 2) {
            acVar.o = 0;
            acVar.p = 0;
        } else {
            OverScroller overScroller = this.mViewFlinger.c;
            acVar.o = overScroller.getFinalX() - overScroller.getCurrX();
            acVar.p = overScroller.getFinalY() - overScroller.getCurrY();
        }
    }

    @rq6
    public View findChildViewUnder(float f2, float f3) {
        for (int iC = this.mChildHelper.c() - 1; iC >= 0; iC--) {
            View viewB = this.mChildHelper.b(iC);
            float translationX = viewB.getTranslationX();
            float translationY = viewB.getTranslationY();
            if (f2 >= viewB.getLeft() + translationX && f2 <= viewB.getRight() + translationX && f3 >= viewB.getTop() + translationY && f3 <= viewB.getBottom() + translationY) {
                return viewB;
            }
        }
        return null;
    }

    @rq6
    public View findContainingItemView(@vo6 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;
    }

    @rq6
    public ag findContainingViewHolder(@vo6 View view) {
        View viewFindContainingItemView = findContainingItemView(view);
        if (viewFindContainingItemView == null) {
            return null;
        }
        return getChildViewHolder(viewFindContainingItemView);
    }

    @rq6
    public ag findViewHolderForAdapterPosition(int i2) {
        ag agVar = null;
        if (this.mDataSetHasChangedAfterLayout) {
            return null;
        }
        int childCount = this.mChildHelper.a.a.getChildCount();
        for (int i3 = 0; i3 < childCount; i3++) {
            ag childViewHolderInt = getChildViewHolderInt(this.mChildHelper.a.a.getChildAt(i3));
            if (childViewHolderInt != null && !childViewHolderInt.isRemoved() && getAdapterPositionInRecyclerView(childViewHolderInt) == i2) {
                androidx.recyclerview.widget.h hVar = this.mChildHelper;
                if (!hVar.c.contains(childViewHolderInt.itemView)) {
                    return childViewHolderInt;
                }
                agVar = childViewHolderInt;
            }
        }
        return agVar;
    }

    public ag findViewHolderForItemId(long j2) {
        g gVar = this.mAdapter;
        ag agVar = null;
        if (gVar != null && gVar.hasStableIds()) {
            int childCount = this.mChildHelper.a.a.getChildCount();
            for (int i2 = 0; i2 < childCount; i2++) {
                ag childViewHolderInt = getChildViewHolderInt(this.mChildHelper.a.a.getChildAt(i2));
                if (childViewHolderInt != null && !childViewHolderInt.isRemoved() && childViewHolderInt.getItemId() == j2) {
                    androidx.recyclerview.widget.h hVar = this.mChildHelper;
                    if (!hVar.c.contains(childViewHolderInt.itemView)) {
                        return childViewHolderInt;
                    }
                    agVar = childViewHolderInt;
                }
            }
        }
        return agVar;
    }

    @rq6
    public ag findViewHolderForLayoutPosition(int i2) {
        return findViewHolderForPosition(i2, false);
    }

    @rq6
    @Deprecated
    public ag findViewHolderForPosition(int i2) {
        return findViewHolderForPosition(i2, false);
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:41:0x007f  */
    /* JADX WARN: Removed duplicated region for block: B:57:0x00be  */
    /* JADX WARN: Removed duplicated region for block: B:59:0x00c2 A[ADDED_TO_REGION] */
    /* JADX WARN: Removed duplicated region for block: B:60:0x00c4  */
    /* JADX WARN: Removed duplicated region for block: B:69:0x00f1  */
    /* JADX WARN: Type inference failed for: r0v1, types: [boolean] */
    /* JADX WARN: Type inference failed for: r0v6 */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public boolean fling(int i2, int i3) {
        int iMax;
        int i4;
        float f2;
        float f3;
        o oVar = this.mLayout;
        if (oVar == null) {
            Log.e(TAG, "Cannot fling without a LayoutManager set. Call setLayoutManager with a non-null argument.");
            return false;
        }
        if (!this.mLayoutSuppressed) {
            int iCanScrollHorizontally = oVar.canScrollHorizontally();
            boolean zCanScrollVertically = this.mLayout.canScrollVertically();
            if (iCanScrollHorizontally == 0 || Math.abs(i2) < this.mMinFlingVelocity) {
                i2 = 0;
            }
            if (!zCanScrollVertically || Math.abs(i3) < this.mMinFlingVelocity) {
                i3 = 0;
            }
            if (i2 != 0 || i3 != 0) {
                if (i2 == 0) {
                    iMax = 0;
                    if (i3 == 0) {
                        i4 = i3;
                        i3 = 0;
                        if (iMax == 0 || i3 != 0) {
                            int i5 = this.mMaxFlingVelocity;
                            iMax = Math.max(-i5, Math.min(iMax, i5));
                            int i6 = this.mMaxFlingVelocity;
                            i3 = Math.max(-i6, Math.min(i3, i6));
                            this.mViewFlinger.a(iMax, i3);
                        }
                        if (i2 == 0 || i4 != 0) {
                            f2 = i2;
                            f3 = i4;
                            if (!dispatchNestedPreFling(f2, f3)) {
                                boolean z2 = iCanScrollHorizontally != 0 || zCanScrollVertically;
                                dispatchNestedFling(f2, f3, z2);
                                r rVar = this.mOnFlingListener;
                                if (rVar == null || !rVar.onFling(i2, i4)) {
                                    if (z2) {
                                        if (zCanScrollVertically) {
                                            iCanScrollHorizontally = (iCanScrollHorizontally == true ? 1 : 0) | 2;
                                        }
                                        startNestedScroll(iCanScrollHorizontally, 1);
                                        int i7 = this.mMaxFlingVelocity;
                                        int iMax2 = Math.max(-i7, Math.min(i2, i7));
                                        int i8 = this.mMaxFlingVelocity;
                                        this.mViewFlinger.a(iMax2, Math.max(-i8, Math.min(i4, i8)));
                                        return true;
                                    }
                                }
                                return true;
                            }
                        } else if (iMax != 0 || i3 != 0) {
                            return true;
                        }
                    } else {
                        EdgeEffect edgeEffect = this.mTopGlow;
                        if (edgeEffect == null || androidx.core.widget.a.a(edgeEffect) == 0.0f) {
                            EdgeEffect edgeEffect2 = this.mBottomGlow;
                            if (edgeEffect2 != null && androidx.core.widget.a.a(edgeEffect2) != 0.0f) {
                                if (p(this.mBottomGlow, i3, getHeight())) {
                                    this.mBottomGlow.onAbsorb(i3);
                                    i3 = 0;
                                }
                                i4 = 0;
                                if (iMax == 0) {
                                    int i52 = this.mMaxFlingVelocity;
                                    iMax = Math.max(-i52, Math.min(iMax, i52));
                                    int i62 = this.mMaxFlingVelocity;
                                    i3 = Math.max(-i62, Math.min(i3, i62));
                                    this.mViewFlinger.a(iMax, i3);
                                    if (i2 == 0) {
                                    }
                                    f2 = i2;
                                    f3 = i4;
                                    if (!dispatchNestedPreFling(f2, f3)) {
                                    }
                                }
                            }
                            i4 = i3;
                            i3 = 0;
                            if (iMax == 0) {
                            }
                        } else {
                            int i9 = -i3;
                            if (p(this.mTopGlow, i9, getHeight())) {
                                this.mTopGlow.onAbsorb(i9);
                                i3 = 0;
                            }
                            i4 = 0;
                            if (iMax == 0) {
                            }
                        }
                    }
                } else {
                    EdgeEffect edgeEffect3 = this.mLeftGlow;
                    if (edgeEffect3 == null || androidx.core.widget.a.a(edgeEffect3) == 0.0f) {
                        EdgeEffect edgeEffect4 = this.mRightGlow;
                        if (edgeEffect4 != null && androidx.core.widget.a.a(edgeEffect4) != 0.0f) {
                            if (p(this.mRightGlow, i2, getWidth())) {
                                this.mRightGlow.onAbsorb(i2);
                                i2 = 0;
                            }
                            iMax = i2;
                            i2 = 0;
                            if (i3 == 0) {
                            }
                        }
                        iMax = 0;
                        if (i3 == 0) {
                        }
                    } else {
                        int i10 = -i2;
                        if (p(this.mLeftGlow, i10, getWidth())) {
                            this.mLeftGlow.onAbsorb(i10);
                            i2 = 0;
                        }
                        iMax = i2;
                        i2 = 0;
                        if (i3 == 0) {
                        }
                    }
                }
            }
        }
        return false;
    }

    /* JADX WARN: Code restructure failed: missing block: B:126:0x017e, code lost:
    
        if (r16 > 0) goto L145;
     */
    /* JADX WARN: Code restructure failed: missing block: B:130:0x0195, code lost:
    
        if (r5 > 0) goto L145;
     */
    /* JADX WARN: Code restructure failed: missing block: B:132:0x0198, code lost:
    
        if (r16 < 0) goto L145;
     */
    /* JADX WARN: Code restructure failed: missing block: B:134:0x019b, code lost:
    
        if (r5 < 0) goto L145;
     */
    /* JADX WARN: Code restructure failed: missing block: B:139:0x01a3, code lost:
    
        if ((r5 * r6) <= 0) goto L146;
     */
    /* JADX WARN: Code restructure failed: missing block: B:144:0x01ab, code lost:
    
        if ((r5 * r6) >= 0) goto L146;
     */
    /* JADX WARN: Removed duplicated region for block: B:119:0x0170  */
    /* JADX WARN: Removed duplicated region for block: B:141:0x01a6  */
    /* JADX WARN: Removed duplicated region for block: B:90:0x0126  */
    /* JADX WARN: Removed duplicated region for block: B:91:0x0128  */
    @Override // android.view.ViewGroup, android.view.ViewParent
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public View focusSearch(View view, int i2) {
        View viewOnFocusSearchFailed;
        int i3;
        int i4;
        int i5;
        int i6;
        int i7;
        byte b2;
        boolean z2;
        int i8 = i2;
        View viewOnInterceptFocusSearch = this.mLayout.onInterceptFocusSearch(view, i8);
        if (viewOnInterceptFocusSearch != null) {
            return viewOnInterceptFocusSearch;
        }
        boolean z3 = (this.mAdapter == null || this.mLayout == null || isComputingLayout() || this.mLayoutSuppressed) ? false : true;
        FocusFinder focusFinder = FocusFinder.getInstance();
        if (z3 && (i8 == 2 || i8 == 1)) {
            if (this.mLayout.canScrollVertically()) {
                int i9 = i8 == 2 ? TsExtractor.TS_STREAM_TYPE_HDMV_DTS : 33;
                z2 = focusFinder.findNextFocus(this, view, i9) == null;
                if (FORCE_ABS_FOCUS_SEARCH_DIRECTION) {
                    i8 = i9;
                }
            } else {
                z2 = false;
            }
            if (!z2 && this.mLayout.canScrollHorizontally()) {
                int i10 = (this.mLayout.getLayoutDirection() == 1) ^ (i8 == 2) ? 66 : 17;
                z2 = focusFinder.findNextFocus(this, view, i10) == null;
                if (FORCE_ABS_FOCUS_SEARCH_DIRECTION) {
                    i8 = i10;
                }
            }
            if (z2) {
                consumePendingUpdateOperations();
                if (findContainingItemView(view) != null) {
                    startInterceptRequestLayout();
                    this.mLayout.onFocusSearchFailed(view, i8, this.mRecycler, this.mState);
                    stopInterceptRequestLayout(false);
                }
                return null;
            }
            viewOnFocusSearchFailed = focusFinder.findNextFocus(this, view, i8);
            if (viewOnFocusSearchFailed == null) {
            }
            if (viewOnFocusSearchFailed != null) {
                if (view != null) {
                    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);
                    if (this.mLayout.getLayoutDirection() != 1) {
                    }
                    Rect rect = this.mTempRect;
                    i3 = rect.left;
                    Rect rect2 = this.mTempRect2;
                    i4 = rect2.left;
                    if (i3 >= i4) {
                    }
                    i5 = 1;
                    i6 = rect.top;
                    i7 = rect2.top;
                    if (i6 >= i7) {
                    }
                    b2 = 1;
                    if (i8 == 1) {
                    }
                }
                return viewOnFocusSearchFailed;
            }
            return super.focusSearch(view, i8);
        }
        View viewFindNextFocus = focusFinder.findNextFocus(this, view, i8);
        if (viewFindNextFocus == null && z3) {
            consumePendingUpdateOperations();
            if (findContainingItemView(view) != null) {
                startInterceptRequestLayout();
                viewOnFocusSearchFailed = this.mLayout.onFocusSearchFailed(view, i8, this.mRecycler, this.mState);
                stopInterceptRequestLayout(false);
            }
            return null;
        }
        viewOnFocusSearchFailed = viewFindNextFocus;
        if (viewOnFocusSearchFailed == null && !viewOnFocusSearchFailed.hasFocusable()) {
            if (getFocusedChild() == null) {
                return super.focusSearch(view, i8);
            }
            m(viewOnFocusSearchFailed, null);
            return view;
        }
        if (viewOnFocusSearchFailed != null && viewOnFocusSearchFailed != this && viewOnFocusSearchFailed != view && findContainingItemView(viewOnFocusSearchFailed) != null) {
            if (view != null && findContainingItemView(view) != null) {
                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 i11 = this.mLayout.getLayoutDirection() != 1 ? -1 : 1;
                Rect rect3 = this.mTempRect;
                i3 = rect3.left;
                Rect rect22 = this.mTempRect2;
                i4 = rect22.left;
                if ((i3 >= i4 || rect3.right <= i4) && rect3.right < rect22.right) {
                    i5 = 1;
                } else {
                    int i12 = rect3.right;
                    int i13 = rect22.right;
                    i5 = ((i12 > i13 || i3 >= i13) && i3 > i4) ? -1 : 0;
                }
                i6 = rect3.top;
                i7 = rect22.top;
                if ((i6 >= i7 || rect3.bottom <= i7) && rect3.bottom < rect22.bottom) {
                    b2 = 1;
                } else {
                    int i14 = rect3.bottom;
                    int i15 = rect22.bottom;
                    b2 = ((i14 > i15 || i6 >= i15) && i6 > i7) ? (byte) -1 : (byte) 0;
                }
                if (i8 == 1) {
                    if (i8 != 2) {
                        if (i8 != 17) {
                            if (i8 != 33) {
                                if (i8 != 66) {
                                    if (i8 != 130) {
                                        StringBuilder sb = new StringBuilder("Invalid direction: ");
                                        sb.append(i8);
                                        throw new IllegalArgumentException(vw2.j(this, sb));
                                    }
                                }
                            }
                        }
                    } else if (b2 <= 0) {
                        if (b2 == 0) {
                        }
                    }
                } else if (b2 >= 0) {
                    if (b2 == 0) {
                    }
                }
            }
            return viewOnFocusSearchFailed;
        }
        return super.focusSearch(view, i8);
    }

    public boolean g() {
        return isChildrenDrawingOrderEnabled();
    }

    @Override // android.view.ViewGroup
    public ViewGroup.LayoutParams generateDefaultLayoutParams() {
        o oVar = this.mLayout;
        if (oVar != null) {
            return oVar.generateDefaultLayoutParams();
        }
        throw new IllegalStateException(vw2.j(this, new StringBuilder("RecyclerView has no LayoutManager")));
    }

    @Override // android.view.ViewGroup
    public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
        o oVar = this.mLayout;
        if (oVar != null) {
            return oVar.generateLayoutParams(getContext(), attributeSet);
        }
        throw new IllegalStateException(vw2.j(this, new StringBuilder("RecyclerView has no LayoutManager")));
    }

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

    @rq6
    public g getAdapter() {
        return this.mAdapter;
    }

    public int getAdapterPositionInRecyclerView(ag agVar) {
        if (agVar.hasAnyOfTheFlags(524) || !agVar.isBound()) {
            return -1;
        }
        androidx.recyclerview.widget.a aVar = this.mAdapterHelper;
        int i2 = agVar.mPosition;
        ArrayList arrayList = aVar.b;
        int size = arrayList.size();
        for (int i3 = 0; i3 < size; i3++) {
            a.b bVar = (a.b) arrayList.get(i3);
            int i4 = bVar.a;
            if (i4 != 1) {
                if (i4 == 2) {
                    int i5 = bVar.b;
                    if (i5 <= i2) {
                        int i6 = bVar.d;
                        if (i5 + i6 > i2) {
                            return -1;
                        }
                        i2 -= i6;
                    } else {
                        continue;
                    }
                } else if (i4 == 8) {
                    int i7 = bVar.b;
                    if (i7 == i2) {
                        i2 = bVar.d;
                    } else {
                        if (i7 < i2) {
                            i2--;
                        }
                        if (bVar.d <= i2) {
                            i2++;
                        }
                    }
                }
            } else if (bVar.b <= i2) {
                i2 += bVar.d;
            }
        }
        return i2;
    }

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

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

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

    @Override // android.view.ViewGroup
    public int getChildDrawingOrder(int i2, int i3) {
        j jVar = this.mChildDrawingOrderCallback;
        return jVar == null ? super.getChildDrawingOrder(i2, i3) : jVar.a(i2, i3);
    }

    public long getChildItemId(@vo6 View view) {
        ag childViewHolderInt;
        g gVar = this.mAdapter;
        if (gVar == null || !gVar.hasStableIds() || (childViewHolderInt = getChildViewHolderInt(view)) == null) {
            return -1L;
        }
        return childViewHolderInt.getItemId();
    }

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

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

    public ag getChildViewHolder(@vo6 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;
    }

    @rq6
    public ao getCompatAccessibilityDelegate() {
        return this.mAccessibilityDelegate;
    }

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

    @vo6
    public k getEdgeEffectFactory() {
        return this.mEdgeEffectFactory;
    }

    @rq6
    public l getItemAnimator() {
        return this.mItemAnimator;
    }

    public Rect getItemDecorInsetsForChild(View view) {
        p pVar = (p) view.getLayoutParams();
        boolean z2 = pVar.c;
        Rect rect = pVar.b;
        if (!z2 || (this.mState.g && (pVar.a.isUpdated() || pVar.a.isInvalid()))) {
            return rect;
        }
        rect.set(0, 0, 0, 0);
        int size = this.mItemDecorations.size();
        for (int i2 = 0; i2 < size; i2++) {
            this.mTempRect.set(0, 0, 0, 0);
            this.mItemDecorations.get(i2).getItemOffsets(this.mTempRect, view, this, this.mState);
            int i3 = rect.left;
            Rect rect2 = this.mTempRect;
            rect.left = i3 + rect2.left;
            rect.top += rect2.top;
            rect.right += rect2.right;
            rect.bottom += rect2.bottom;
        }
        pVar.c = false;
        return rect;
    }

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

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

    @rq6
    public o 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;
    }

    @rq6
    public r getOnFlingListener() {
        return this.mOnFlingListener;
    }

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

    @vo6
    public v getRecycledViewPool() {
        return this.mRecycler.c();
    }

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

    public final void h(int i2, int i3, MotionEvent motionEvent) {
        o oVar = this.mLayout;
        if (oVar == null) {
            Log.e(TAG, "Cannot scroll without a LayoutManager set. Call setLayoutManager with a non-null argument.");
            return;
        }
        if (this.mLayoutSuppressed) {
            return;
        }
        int[] iArr = this.mReusableIntPair;
        iArr[0] = 0;
        iArr[1] = 0;
        boolean zCanScrollHorizontally = oVar.canScrollHorizontally();
        boolean zCanScrollVertically = this.mLayout.canScrollVertically();
        int i4 = 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 iK = i2 - k(height, i2);
        int iL = i3 - l(width, i3);
        startNestedScroll(i4, 1);
        if (dispatchNestedPreScroll(zCanScrollHorizontally ? iK : 0, zCanScrollVertically ? iL : 0, this.mReusableIntPair, this.mScrollOffset, 1)) {
            int[] iArr2 = this.mReusableIntPair;
            iK -= iArr2[0];
            iL -= iArr2[1];
        }
        scrollByInternal(zCanScrollHorizontally ? iK : 0, zCanScrollVertically ? iL : 0, motionEvent, 1);
        androidx.recyclerview.widget.w wVar = this.mGapWorker;
        if (wVar != null && (iK != 0 || iL != 0)) {
            wVar.a(this, iK, iL);
        }
        stopNestedScroll(1);
    }

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

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

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

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

    public void initAdapterManager() {
        this.mAdapterHelper = new androidx.recyclerview.widget.a(new e());
    }

    @sma
    public void initFastScroller(StateListDrawable stateListDrawable, Drawable drawable, StateListDrawable stateListDrawable2, Drawable drawable2) {
        if (stateListDrawable == null || drawable == null || stateListDrawable2 == null || drawable2 == null) {
            throw new IllegalArgumentException(vw2.j(this, new StringBuilder("Trying to set fast scroller without both required drawables.")));
        }
        Resources resources = getContext().getResources();
        new androidx.recyclerview.widget.v(this, stateListDrawable, drawable, stateListDrawable2, drawable2, resources.getDimensionPixelSize(com.strmr.ps.R.dimen.fastscroll_default_thickness), resources.getDimensionPixelSize(com.strmr.ps.R.dimen.fastscroll_minimum_range), resources.getDimensionPixelOffset(com.strmr.ps.R.dimen.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;
        }
        o oVar = this.mLayout;
        if (oVar != null) {
            oVar.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() {
        l lVar = this.mItemAnimator;
        return lVar != null && lVar.k();
    }

    @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().d;
    }

    public final void j() {
        boolean z2;
        boolean z3 = false;
        if (this.mDataSetHasChangedAfterLayout) {
            androidx.recyclerview.widget.a aVar = this.mAdapterHelper;
            aVar.k(aVar.b);
            aVar.k(aVar.c);
            aVar.f = 0;
            if (this.mDispatchItemsChangedEvent) {
                this.mLayout.onItemsChanged(this);
            }
        }
        if (this.mItemAnimator == null || !this.mLayout.supportsPredictiveItemAnimations()) {
            this.mAdapterHelper.c();
        } else {
            this.mAdapterHelper.j();
        }
        boolean z4 = this.mItemsAddedOrRemoved || this.mItemsChanged;
        this.mState.j = this.mFirstLayoutComplete && this.mItemAnimator != null && ((z2 = this.mDataSetHasChangedAfterLayout) || z4 || this.mLayout.mRequestedSimpleAnimations) && (!z2 || this.mAdapter.hasStableIds());
        ac acVar = this.mState;
        if (acVar.j && z4 && !this.mDataSetHasChangedAfterLayout && this.mItemAnimator != null && this.mLayout.supportsPredictiveItemAnimations()) {
            z3 = true;
        }
        acVar.k = z3;
    }

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

    public final int k(float f2, int i2) {
        float height = f2 / getHeight();
        float width = i2 / getWidth();
        EdgeEffect edgeEffect = this.mLeftGlow;
        float f3 = 0.0f;
        if (edgeEffect == null || androidx.core.widget.a.a(edgeEffect) == 0.0f) {
            EdgeEffect edgeEffect2 = this.mRightGlow;
            if (edgeEffect2 != null && androidx.core.widget.a.a(edgeEffect2) != 0.0f) {
                if (canScrollHorizontally(1)) {
                    this.mRightGlow.onRelease();
                } else {
                    float fB = androidx.core.widget.a.b(this.mRightGlow, width, height);
                    if (androidx.core.widget.a.a(this.mRightGlow) == 0.0f) {
                        this.mRightGlow.onRelease();
                    }
                    f3 = fB;
                }
                invalidate();
            }
        } else {
            if (canScrollHorizontally(-1)) {
                this.mLeftGlow.onRelease();
            } else {
                float f4 = -androidx.core.widget.a.b(this.mLeftGlow, -width, 1.0f - height);
                if (androidx.core.widget.a.a(this.mLeftGlow) == 0.0f) {
                    this.mLeftGlow.onRelease();
                }
                f3 = f4;
            }
            invalidate();
        }
        return Math.round(f3 * getWidth());
    }

    public final int l(float f2, int i2) {
        float width = f2 / getWidth();
        float height = i2 / getHeight();
        EdgeEffect edgeEffect = this.mTopGlow;
        float f3 = 0.0f;
        if (edgeEffect == null || androidx.core.widget.a.a(edgeEffect) == 0.0f) {
            EdgeEffect edgeEffect2 = this.mBottomGlow;
            if (edgeEffect2 != null && androidx.core.widget.a.a(edgeEffect2) != 0.0f) {
                if (canScrollVertically(1)) {
                    this.mBottomGlow.onRelease();
                } else {
                    float fB = androidx.core.widget.a.b(this.mBottomGlow, height, 1.0f - width);
                    if (androidx.core.widget.a.a(this.mBottomGlow) == 0.0f) {
                        this.mBottomGlow.onRelease();
                    }
                    f3 = fB;
                }
                invalidate();
            }
        } else {
            if (canScrollVertically(-1)) {
                this.mTopGlow.onRelease();
            } else {
                float f4 = -androidx.core.widget.a.b(this.mTopGlow, -height, width);
                if (androidx.core.widget.a.a(this.mTopGlow) == 0.0f) {
                    this.mTopGlow.onRelease();
                }
                f3 = f4;
            }
            invalidate();
        }
        return Math.round(f3 * getHeight());
    }

    public final void m(View view, 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 p) {
            p pVar = (p) layoutParams;
            if (!pVar.c) {
                Rect rect = pVar.b;
                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);
    }

    public void markItemDecorInsetsDirty() {
        int childCount = this.mChildHelper.a.a.getChildCount();
        for (int i2 = 0; i2 < childCount; i2++) {
            ((p) this.mChildHelper.a.a.getChildAt(i2).getLayoutParams()).c = true;
        }
        ArrayList arrayList = this.mRecycler.c;
        int size = arrayList.size();
        for (int i3 = 0; i3 < size; i3++) {
            p pVar = (p) ((ag) arrayList.get(i3)).itemView.getLayoutParams();
            if (pVar != null) {
                pVar.c = true;
            }
        }
    }

    public void markKnownViewsInvalid() {
        int childCount = this.mChildHelper.a.a.getChildCount();
        for (int i2 = 0; i2 < childCount; i2++) {
            ag childViewHolderInt = getChildViewHolderInt(this.mChildHelper.a.a.getChildAt(i2));
            if (childViewHolderInt != null && !childViewHolderInt.shouldIgnore()) {
                childViewHolderInt.addFlags(6);
            }
        }
        markItemDecorInsetsDirty();
        w wVar = this.mRecycler;
        ArrayList arrayList = wVar.c;
        int size = arrayList.size();
        for (int i3 = 0; i3 < size; i3++) {
            ag agVar = (ag) arrayList.get(i3);
            if (agVar != null) {
                agVar.addFlags(6);
                agVar.addChangePayload(null);
            }
        }
        g gVar = RecyclerView.this.mAdapter;
        if (gVar == null || !gVar.hasStableIds()) {
            wVar.h();
        }
    }

    public final void n() {
        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 = sia.a;
            postInvalidateOnAnimation();
        }
    }

    public void nestedScrollBy(int i2, int i3) {
        h(i2, i3, null);
    }

    public final void o(g gVar, boolean z2, boolean z3) {
        g gVar2 = this.mAdapter;
        if (gVar2 != null) {
            gVar2.unregisterAdapterDataObserver(this.mObserver);
            this.mAdapter.onDetachedFromRecyclerView(this);
        }
        if (!z2 || z3) {
            removeAndRecycleViews();
        }
        androidx.recyclerview.widget.a aVar = this.mAdapterHelper;
        aVar.k(aVar.b);
        aVar.k(aVar.c);
        aVar.f = 0;
        g gVar3 = this.mAdapter;
        this.mAdapter = gVar;
        if (gVar != null) {
            gVar.registerAdapterDataObserver(this.mObserver);
            gVar.onAttachedToRecyclerView(this);
        }
        o oVar = this.mLayout;
        if (oVar != null) {
            oVar.onAdapterChanged(gVar3, this.mAdapter);
        }
        w wVar = this.mRecycler;
        g gVar4 = this.mAdapter;
        wVar.a.clear();
        wVar.h();
        wVar.g(gVar3, true);
        v vVarC = wVar.c();
        if (gVar3 != null) {
            vVarC.b--;
        }
        if (!z2 && vVarC.b == 0) {
            SparseArray sparseArray = vVarC.a;
            for (int i2 = 0; i2 < sparseArray.size(); i2++) {
                v.a aVar2 = (v.a) sparseArray.valueAt(i2);
                Iterator it = aVar2.a.iterator();
                while (it.hasNext()) {
                    rc7.a(((ag) it.next()).itemView);
                }
                aVar2.a.clear();
            }
        }
        if (gVar4 != null) {
            vVarC.b++;
        } else {
            vVarC.getClass();
        }
        wVar.f();
        this.mState.f = true;
    }

    public void offsetChildrenHorizontal(@cm7 int i2) {
        int iC = this.mChildHelper.c();
        for (int i3 = 0; i3 < iC; i3++) {
            this.mChildHelper.b(i3).offsetLeftAndRight(i2);
        }
    }

    public void offsetChildrenVertical(@cm7 int i2) {
        int iC = this.mChildHelper.c();
        for (int i3 = 0; i3 < iC; i3++) {
            this.mChildHelper.b(i3).offsetTopAndBottom(i2);
        }
    }

    public void offsetPositionRecordsForInsert(int i2, int i3) {
        int childCount = this.mChildHelper.a.a.getChildCount();
        for (int i4 = 0; i4 < childCount; i4++) {
            ag childViewHolderInt = getChildViewHolderInt(this.mChildHelper.a.a.getChildAt(i4));
            if (childViewHolderInt != null && !childViewHolderInt.shouldIgnore() && childViewHolderInt.mPosition >= i2) {
                if (sVerboseLoggingEnabled) {
                    childViewHolderInt.toString();
                }
                childViewHolderInt.offsetPosition(i3, false);
                this.mState.f = true;
            }
        }
        ArrayList arrayList = this.mRecycler.c;
        int size = arrayList.size();
        for (int i5 = 0; i5 < size; i5++) {
            ag agVar = (ag) arrayList.get(i5);
            if (agVar != null && agVar.mPosition >= i2) {
                if (sVerboseLoggingEnabled) {
                    agVar.toString();
                }
                agVar.offsetPosition(i3, false);
            }
        }
        requestLayout();
    }

    public void offsetPositionRecordsForMove(int i2, int i3) {
        int i4;
        int i5;
        int i6;
        int i7;
        int i8;
        int i9;
        int i10;
        int childCount = this.mChildHelper.a.a.getChildCount();
        int i11 = -1;
        if (i2 < i3) {
            i5 = i2;
            i4 = i3;
            i6 = -1;
        } else {
            i4 = i2;
            i5 = i3;
            i6 = 1;
        }
        for (int i12 = 0; i12 < childCount; i12++) {
            ag childViewHolderInt = getChildViewHolderInt(this.mChildHelper.a.a.getChildAt(i12));
            if (childViewHolderInt != null && (i10 = childViewHolderInt.mPosition) >= i5 && i10 <= i4) {
                if (sVerboseLoggingEnabled) {
                    childViewHolderInt.toString();
                }
                if (childViewHolderInt.mPosition == i2) {
                    childViewHolderInt.offsetPosition(i3 - i2, false);
                } else {
                    childViewHolderInt.offsetPosition(i6, false);
                }
                this.mState.f = true;
            }
        }
        ArrayList arrayList = this.mRecycler.c;
        if (i2 < i3) {
            i8 = i2;
            i7 = i3;
        } else {
            i7 = i2;
            i11 = 1;
            i8 = i3;
        }
        int size = arrayList.size();
        for (int i13 = 0; i13 < size; i13++) {
            ag agVar = (ag) arrayList.get(i13);
            if (agVar != null && (i9 = agVar.mPosition) >= i8 && i9 <= i7) {
                if (i9 == i2) {
                    agVar.offsetPosition(i3 - i2, false);
                } else {
                    agVar.offsetPosition(i11, false);
                }
                if (sVerboseLoggingEnabled) {
                    agVar.toString();
                }
            }
        }
        requestLayout();
    }

    public void offsetPositionRecordsForRemove(int i2, int i3, boolean z2) {
        int i4 = i2 + i3;
        int childCount = this.mChildHelper.a.a.getChildCount();
        for (int i5 = 0; i5 < childCount; i5++) {
            ag childViewHolderInt = getChildViewHolderInt(this.mChildHelper.a.a.getChildAt(i5));
            if (childViewHolderInt != null && !childViewHolderInt.shouldIgnore()) {
                int i6 = childViewHolderInt.mPosition;
                if (i6 >= i4) {
                    if (sVerboseLoggingEnabled) {
                        childViewHolderInt.toString();
                    }
                    childViewHolderInt.offsetPosition(-i3, z2);
                    this.mState.f = true;
                } else if (i6 >= i2) {
                    if (sVerboseLoggingEnabled) {
                        childViewHolderInt.toString();
                    }
                    childViewHolderInt.flagRemovedAndOffsetPosition(i2 - 1, -i3, z2);
                    this.mState.f = true;
                }
            }
        }
        w wVar = this.mRecycler;
        ArrayList arrayList = wVar.c;
        for (int size = arrayList.size() - 1; size >= 0; size--) {
            ag agVar = (ag) arrayList.get(size);
            if (agVar != null) {
                int i7 = agVar.mPosition;
                if (i7 >= i4) {
                    if (sVerboseLoggingEnabled) {
                        agVar.toString();
                    }
                    agVar.offsetPosition(-i3, z2);
                } else if (i7 >= i2) {
                    agVar.addFlags(8);
                    wVar.i(size);
                }
            }
        }
        requestLayout();
    }

    /* JADX WARN: Removed duplicated region for block: B:21:0x0063  */
    @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();
        o oVar = this.mLayout;
        if (oVar != null) {
            oVar.dispatchAttachedToWindow(this);
        }
        this.mPostedAnimatorRunner = false;
        if (ALLOW_THREAD_GAP_WORK) {
            ThreadLocal threadLocal = androidx.recyclerview.widget.w.e;
            androidx.recyclerview.widget.w wVar = (androidx.recyclerview.widget.w) threadLocal.get();
            this.mGapWorker = wVar;
            if (wVar == null) {
                androidx.recyclerview.widget.w wVar2 = new androidx.recyclerview.widget.w();
                wVar2.a = new ArrayList();
                wVar2.d = new ArrayList();
                this.mGapWorker = wVar2;
                WeakHashMap weakHashMap = sia.a;
                Display display = getDisplay();
                if (isInEditMode() || display == null) {
                    refreshRate = 60.0f;
                    androidx.recyclerview.widget.w wVar3 = this.mGapWorker;
                    wVar3.c = (long) (1.0E9f / refreshRate);
                    threadLocal.set(wVar3);
                } else {
                    refreshRate = display.getRefreshRate();
                    if (refreshRate < 30.0f) {
                    }
                    androidx.recyclerview.widget.w wVar32 = this.mGapWorker;
                    wVar32.c = (long) (1.0E9f / refreshRate);
                    threadLocal.set(wVar32);
                }
            }
            ArrayList arrayList = this.mGapWorker.a;
            if (sDebugAssertionsEnabled && arrayList.contains(this)) {
                throw new IllegalStateException("RecyclerView already present in worker list!");
            }
            arrayList.add(this);
        }
    }

    public void onChildAttachedToWindow(@vo6 View view) {
    }

    public void onChildDetachedFromWindow(@vo6 View view) {
    }

    @Override // android.view.ViewGroup, android.view.View
    public void onDetachedFromWindow() {
        androidx.recyclerview.widget.w wVar;
        super.onDetachedFromWindow();
        l lVar = this.mItemAnimator;
        if (lVar != null) {
            lVar.j();
        }
        stopScroll();
        this.mIsAttached = false;
        o oVar = this.mLayout;
        if (oVar != null) {
            oVar.dispatchDetachedFromWindow(this, this.mRecycler);
        }
        this.mPendingAccessibilityImportanceChange.clear();
        removeCallbacks(this.mItemAnimatorRunner);
        this.mViewInfoStore.getClass();
        while (aw.a.d.acquire() != null) {
        }
        w wVar2 = this.mRecycler;
        ArrayList arrayList = wVar2.c;
        for (int i2 = 0; i2 < arrayList.size(); i2++) {
            rc7.a(((ag) arrayList.get(i2)).itemView);
        }
        wVar2.g(RecyclerView.this.mAdapter, false);
        rc7.b(this);
        if (!ALLOW_THREAD_GAP_WORK || (wVar = this.mGapWorker) == null) {
            return;
        }
        boolean zRemove = wVar.a.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 i2 = 0; i2 < size; i2++) {
            this.mItemDecorations.get(i2).onDraw(canvas, this, this.mState);
        }
    }

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

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

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

    /* JADX WARN: Multi-variable type inference failed */
    @Override // android.view.ViewGroup
    public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
        boolean z2;
        boolean z3;
        if (!this.mLayoutSuppressed) {
            this.mInterceptingOnItemTouchListener = null;
            if (e(motionEvent)) {
                n();
                setScrollState(0);
                return true;
            }
            o oVar = this.mLayout;
            if (oVar != null) {
                boolean zCanScrollHorizontally = oVar.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 x2 = (int) (motionEvent.getX() + 0.5f);
                    this.mLastTouchX = x2;
                    this.mInitialTouchX = x2;
                    int y2 = (int) (motionEvent.getY() + 0.5f);
                    this.mLastTouchY = y2;
                    this.mInitialTouchY = y2;
                    EdgeEffect edgeEffect = this.mLeftGlow;
                    if (edgeEffect == null || androidx.core.widget.a.a(edgeEffect) == 0.0f || canScrollHorizontally(-1)) {
                        z2 = false;
                    } else {
                        androidx.core.widget.a.b(this.mLeftGlow, 0.0f, 1.0f - (motionEvent.getY() / getHeight()));
                        z2 = true;
                    }
                    EdgeEffect edgeEffect2 = this.mRightGlow;
                    boolean z4 = z2;
                    if (edgeEffect2 != null) {
                        z4 = z2;
                        if (androidx.core.widget.a.a(edgeEffect2) != 0.0f) {
                            z4 = z2;
                            if (!canScrollHorizontally(1)) {
                                androidx.core.widget.a.b(this.mRightGlow, 0.0f, motionEvent.getY() / getHeight());
                                z4 = true;
                            }
                        }
                    }
                    EdgeEffect edgeEffect3 = this.mTopGlow;
                    boolean z5 = z4;
                    if (edgeEffect3 != null) {
                        z5 = z4;
                        if (androidx.core.widget.a.a(edgeEffect3) != 0.0f) {
                            z5 = z4;
                            if (!canScrollVertically(-1)) {
                                androidx.core.widget.a.b(this.mTopGlow, 0.0f, motionEvent.getX() / getWidth());
                                z5 = true;
                            }
                        }
                    }
                    EdgeEffect edgeEffect4 = this.mBottomGlow;
                    boolean z6 = z5;
                    if (edgeEffect4 != null) {
                        z6 = z5;
                        if (androidx.core.widget.a.a(edgeEffect4) != 0.0f) {
                            z6 = z5;
                            if (!canScrollVertically(1)) {
                                androidx.core.widget.a.b(this.mBottomGlow, 0.0f, 1.0f - (motionEvent.getX() / getWidth()));
                                z6 = true;
                            }
                        }
                    }
                    if (z6 || this.mScrollState == 2) {
                        getParent().requestDisallowInterceptTouchEvent(true);
                        setScrollState(1);
                        stopNestedScroll(1);
                    }
                    int[] iArr = this.mNestedOffsets;
                    iArr[1] = 0;
                    iArr[0] = 0;
                    int i2 = zCanScrollHorizontally;
                    if (zCanScrollVertically) {
                        i2 = (zCanScrollHorizontally ? 1 : 0) | 2;
                    }
                    startNestedScroll(i2, 0);
                } else if (actionMasked == 1) {
                    this.mVelocityTracker.clear();
                    stopNestedScroll(0);
                } else if (actionMasked == 2) {
                    int iFindPointerIndex = motionEvent.findPointerIndex(this.mScrollPointerId);
                    if (iFindPointerIndex < 0) {
                        Log.e(TAG, "Error processing scroll; pointer index for id " + this.mScrollPointerId + " not found. Did any MotionEvents get skipped?");
                        return false;
                    }
                    int x3 = (int) (motionEvent.getX(iFindPointerIndex) + 0.5f);
                    int y3 = (int) (motionEvent.getY(iFindPointerIndex) + 0.5f);
                    if (this.mScrollState != 1) {
                        int i3 = x3 - this.mInitialTouchX;
                        int i4 = y3 - this.mInitialTouchY;
                        if (!zCanScrollHorizontally || Math.abs(i3) <= this.mTouchSlop) {
                            z3 = false;
                        } else {
                            this.mLastTouchX = x3;
                            z3 = true;
                        }
                        if (zCanScrollVertically && Math.abs(i4) > this.mTouchSlop) {
                            this.mLastTouchY = y3;
                            z3 = true;
                        }
                        if (z3) {
                            setScrollState(1);
                        }
                    }
                } else if (actionMasked == 3) {
                    n();
                    setScrollState(0);
                } else if (actionMasked == 5) {
                    this.mScrollPointerId = motionEvent.getPointerId(actionIndex);
                    int x4 = (int) (motionEvent.getX(actionIndex) + 0.5f);
                    this.mLastTouchX = x4;
                    this.mInitialTouchX = x4;
                    int y4 = (int) (motionEvent.getY(actionIndex) + 0.5f);
                    this.mLastTouchY = y4;
                    this.mInitialTouchY = y4;
                } else if (actionMasked == 6) {
                    i(motionEvent);
                }
                if (this.mScrollState == 1) {
                    return true;
                }
            }
        }
        return false;
    }

    @Override // android.view.ViewGroup, android.view.View
    public void onLayout(boolean z2, int i2, int i3, int i4, int i5) {
        int i6 = uq9.a;
        Trace.beginSection(TRACE_ON_LAYOUT_TAG);
        dispatchLayout();
        Trace.endSection();
        this.mFirstLayoutComplete = true;
    }

    @Override // android.view.View
    public void onMeasure(int i2, int i3) {
        o oVar = this.mLayout;
        if (oVar == null) {
            defaultOnMeasure(i2, i3);
            return;
        }
        boolean z2 = false;
        if (oVar.isAutoMeasureEnabled()) {
            int mode = View.MeasureSpec.getMode(i2);
            int mode2 = View.MeasureSpec.getMode(i3);
            this.mLayout.onMeasure(this.mRecycler, this.mState, i2, i3);
            if (mode == 1073741824 && mode2 == 1073741824) {
                z2 = true;
            }
            this.mLastAutoMeasureSkippedDueToExact = z2;
            if (z2 || this.mAdapter == null) {
                return;
            }
            if (this.mState.d == 1) {
                c();
            }
            this.mLayout.setMeasureSpecs(i2, i3);
            this.mState.i = true;
            d();
            this.mLayout.setMeasuredDimensionFromChildren(i2, i3);
            if (this.mLayout.shouldMeasureTwice()) {
                this.mLayout.setMeasureSpecs(View.MeasureSpec.makeMeasureSpec(getMeasuredWidth(), 1073741824), View.MeasureSpec.makeMeasureSpec(getMeasuredHeight(), 1073741824));
                this.mState.i = true;
                d();
                this.mLayout.setMeasuredDimensionFromChildren(i2, i3);
            }
            this.mLastAutoMeasureNonExactMeasuredWidth = getMeasuredWidth();
            this.mLastAutoMeasureNonExactMeasuredHeight = getMeasuredHeight();
            return;
        }
        if (this.mHasFixedSize) {
            this.mLayout.onMeasure(this.mRecycler, this.mState, i2, i3);
            return;
        }
        if (this.mAdapterUpdateDuringMeasure) {
            startInterceptRequestLayout();
            onEnterLayoutOrScroll();
            j();
            onExitLayoutOrScroll();
            ac acVar = this.mState;
            if (acVar.k) {
                acVar.g = true;
            } else {
                this.mAdapterHelper.c();
                this.mState.g = false;
            }
            this.mAdapterUpdateDuringMeasure = false;
            stopInterceptRequestLayout(false);
        } else if (this.mState.k) {
            setMeasuredDimension(getMeasuredWidth(), getMeasuredHeight());
            return;
        }
        g gVar = this.mAdapter;
        if (gVar != null) {
            this.mState.e = gVar.getItemCount();
        } else {
            this.mState.e = 0;
        }
        startInterceptRequestLayout();
        this.mLayout.onMeasure(this.mRecycler, this.mState, i2, i3);
        stopInterceptRequestLayout(false);
        this.mState.g = false;
    }

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

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

    @Override // android.view.View
    public Parcelable onSaveInstanceState() {
        z zVar = new z(super.onSaveInstanceState());
        z zVar2 = this.mPendingSavedState;
        if (zVar2 != null) {
            zVar.a = zVar2.a;
            return zVar;
        }
        o oVar = this.mLayout;
        if (oVar != null) {
            zVar.a = oVar.onSaveInstanceState();
            return zVar;
        }
        zVar.a = null;
        return zVar;
    }

    public void onScrollStateChanged(int i2) {
    }

    public void onScrolled(@cm7 int i2, @cm7 int i3) {
    }

    @Override // android.view.View
    public void onSizeChanged(int i2, int i3, int i4, int i5) {
        super.onSizeChanged(i2, i3, i4, i5);
        if (i2 == i4 && i3 == i5) {
            return;
        }
        invalidateGlows();
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:56:0x00ff A[PHI: r1
      0x00ff: PHI (r1v50 int) = (r1v30 int), (r1v54 int) binds: [B:50:0x00e8, B:54:0x00fb] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:58:0x0102  */
    /* JADX WARN: Removed duplicated region for block: B:64:0x0118  */
    @Override // android.view.View
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public boolean onTouchEvent(MotionEvent motionEvent) {
        boolean zE;
        boolean z2;
        if (!this.mLayoutSuppressed && !this.mIgnoreMotionEventTillDown) {
            s sVar = this.mInterceptingOnItemTouchListener;
            if (sVar == null) {
                zE = motionEvent.getAction() == 0 ? false : e(motionEvent);
            } else {
                sVar.e(motionEvent);
                int action = motionEvent.getAction();
                if (action == 3 || action == 1) {
                    this.mInterceptingOnItemTouchListener = null;
                }
                zE = true;
            }
            if (zE) {
                n();
                setScrollState(0);
                return true;
            }
            o oVar = this.mLayout;
            if (oVar != null) {
                boolean zCanScrollHorizontally = oVar.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 x2 = (int) (motionEvent.getX() + 0.5f);
                    this.mLastTouchX = x2;
                    this.mInitialTouchX = x2;
                    int y2 = (int) (motionEvent.getY() + 0.5f);
                    this.mLastTouchY = y2;
                    this.mInitialTouchY = y2;
                    int i2 = zCanScrollHorizontally;
                    if (zCanScrollVertically) {
                        i2 = (zCanScrollHorizontally ? 1 : 0) | 2;
                    }
                    startNestedScroll(i2, 0);
                } else {
                    if (actionMasked == 1) {
                        this.mVelocityTracker.addMovement(motionEventObtain);
                        this.mVelocityTracker.computeCurrentVelocity(1000, this.mMaxFlingVelocity);
                        float f2 = zCanScrollHorizontally ? -this.mVelocityTracker.getXVelocity(this.mScrollPointerId) : 0.0f;
                        float f3 = zCanScrollVertically ? -this.mVelocityTracker.getYVelocity(this.mScrollPointerId) : 0.0f;
                        if ((f2 == 0.0f && f3 == 0.0f) || !fling((int) f2, (int) f3)) {
                            setScrollState(0);
                        }
                        n();
                        motionEventObtain.recycle();
                        return true;
                    }
                    if (actionMasked == 2) {
                        int iFindPointerIndex = motionEvent.findPointerIndex(this.mScrollPointerId);
                        if (iFindPointerIndex < 0) {
                            Log.e(TAG, "Error processing scroll; pointer index for id " + this.mScrollPointerId + " not found. Did any MotionEvents get skipped?");
                            return false;
                        }
                        int x3 = (int) (motionEvent.getX(iFindPointerIndex) + 0.5f);
                        int y3 = (int) (motionEvent.getY(iFindPointerIndex) + 0.5f);
                        int iMax = this.mLastTouchX - x3;
                        int iMax2 = this.mLastTouchY - y3;
                        if (this.mScrollState != 1) {
                            if (zCanScrollHorizontally) {
                                iMax = iMax > 0 ? Math.max(0, iMax - this.mTouchSlop) : Math.min(0, iMax + this.mTouchSlop);
                                if (iMax != 0) {
                                    z2 = true;
                                }
                                if (zCanScrollVertically) {
                                }
                                if (z2) {
                                }
                            } else {
                                z2 = false;
                                if (zCanScrollVertically) {
                                    iMax2 = iMax2 > 0 ? Math.max(0, iMax2 - this.mTouchSlop) : Math.min(0, iMax2 + this.mTouchSlop);
                                    if (iMax2 != 0) {
                                        z2 = true;
                                    }
                                }
                                if (z2) {
                                    setScrollState(1);
                                }
                            }
                            motionEventObtain.recycle();
                            return true;
                        }
                        if (this.mScrollState == 1) {
                            int[] iArr3 = this.mReusableIntPair;
                            iArr3[0] = 0;
                            iArr3[1] = 0;
                            int iK = iMax - k(motionEvent.getY(), iMax);
                            int iL = iMax2 - l(motionEvent.getX(), iMax2);
                            if (dispatchNestedPreScroll(zCanScrollHorizontally ? iK : 0, zCanScrollVertically ? iL : 0, this.mReusableIntPair, this.mScrollOffset, 0)) {
                                int[] iArr4 = this.mReusableIntPair;
                                iK -= iArr4[0];
                                iL -= iArr4[1];
                                int[] iArr5 = this.mNestedOffsets;
                                int i3 = iArr5[0];
                                int[] iArr6 = this.mScrollOffset;
                                iArr5[0] = i3 + iArr6[0];
                                iArr5[1] = iArr5[1] + iArr6[1];
                                getParent().requestDisallowInterceptTouchEvent(true);
                            }
                            int[] iArr7 = this.mScrollOffset;
                            this.mLastTouchX = x3 - iArr7[0];
                            this.mLastTouchY = y3 - iArr7[1];
                            if (scrollByInternal(zCanScrollHorizontally ? iK : 0, zCanScrollVertically ? iL : 0, motionEvent, 0)) {
                                getParent().requestDisallowInterceptTouchEvent(true);
                            }
                            androidx.recyclerview.widget.w wVar = this.mGapWorker;
                            if (wVar != null && (iK != 0 || iL != 0)) {
                                wVar.a(this, iK, iL);
                            }
                        }
                    } else if (actionMasked == 3) {
                        n();
                        setScrollState(0);
                    } else if (actionMasked == 5) {
                        this.mScrollPointerId = motionEvent.getPointerId(actionIndex);
                        int x4 = (int) (motionEvent.getX(actionIndex) + 0.5f);
                        this.mLastTouchX = x4;
                        this.mInitialTouchX = x4;
                        int y4 = (int) (motionEvent.getY(actionIndex) + 0.5f);
                        this.mLastTouchY = y4;
                        this.mInitialTouchY = y4;
                    } else if (actionMasked == 6) {
                        i(motionEvent);
                    }
                }
                this.mVelocityTracker.addMovement(motionEventObtain);
                motionEventObtain.recycle();
                return true;
            }
        }
        return false;
    }

    public final boolean p(EdgeEffect edgeEffect, int i2, int i3) {
        if (i2 > 0) {
            return true;
        }
        float fA = androidx.core.widget.a.a(edgeEffect) * i3;
        double dLog = Math.log((Math.abs(-i2) * INFLEXION) / (this.mPhysicalCoef * SCROLL_FRICTION));
        double d2 = DECELERATION_RATE;
        return ((float) (Math.exp((d2 / (d2 - 1.0d)) * dLog) * ((double) (this.mPhysicalCoef * SCROLL_FRICTION)))) < fA;
    }

    public void postAnimationRunner() {
        if (this.mPostedAnimatorRunner || !this.mIsAttached) {
            return;
        }
        Runnable runnable = this.mItemAnimatorRunner;
        WeakHashMap weakHashMap = sia.a;
        postOnAnimation(runnable);
        this.mPostedAnimatorRunner = true;
    }

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

    public void recordAnimationInfoIfBouncedHiddenView(ag agVar, l.d dVar) {
        agVar.setFlags(0, 8192);
        if (this.mState.h && agVar.isUpdated() && !agVar.isRemoved() && !agVar.shouldIgnore()) {
            this.mViewInfoStore.b.g(getChangedHolderKey(agVar), agVar);
        }
        zs8 zs8Var = this.mViewInfoStore.a;
        aw.a aVarA = (aw.a) zs8Var.get(agVar);
        if (aVarA == null) {
            aVarA = aw.a.a();
            zs8Var.put(agVar, aVarA);
        }
        aVarA.b = dVar;
        aVarA.a |= 4;
    }

    public void removeAndRecycleViews() {
        l lVar = this.mItemAnimator;
        if (lVar != null) {
            lVar.j();
        }
        o oVar = this.mLayout;
        if (oVar != null) {
            oVar.removeAndRecycleAllViews(this.mRecycler);
            this.mLayout.removeAndRecycleScrapInt(this.mRecycler);
        }
        w wVar = this.mRecycler;
        wVar.a.clear();
        wVar.h();
    }

    public boolean removeAnimatingView(View view) {
        startInterceptRequestLayout();
        androidx.recyclerview.widget.h hVar = this.mChildHelper;
        h.a aVar = hVar.b;
        an anVar = hVar.a;
        int i2 = hVar.d;
        boolean z2 = false;
        z2 = false;
        if (i2 == 1) {
            if (hVar.e != view) {
                throw new IllegalStateException("Cannot call removeViewIfHidden within removeView(At) for a different view");
            }
        } else {
            if (i2 == 2) {
                throw new IllegalStateException("Cannot call removeViewIfHidden within removeViewIfHidden");
            }
            try {
                hVar.d = 2;
                int iIndexOfChild = anVar.a.indexOfChild(view);
                if (iIndexOfChild == -1) {
                    hVar.g(view);
                } else if (aVar.d(iIndexOfChild)) {
                    aVar.f(iIndexOfChild);
                    hVar.g(view);
                    anVar.b(iIndexOfChild);
                }
                hVar.d = 0;
                z2 = true;
            } finally {
                hVar.d = 0;
            }
        }
        if (z2) {
            ag childViewHolderInt = getChildViewHolderInt(view);
            this.mRecycler.n(childViewHolderInt);
            this.mRecycler.k(childViewHolderInt);
            if (sVerboseLoggingEnabled) {
                Objects.toString(view);
                toString();
            }
        }
        stopInterceptRequestLayout(!z2);
        return z2;
    }

    @Override // android.view.ViewGroup
    public void removeDetachedView(View view, boolean z2) {
        ag 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(vw2.j(this, sb));
            }
        } else if (sDebugAssertionsEnabled) {
            StringBuilder sb2 = new StringBuilder("No ViewHolder found for child: ");
            sb2.append(view);
            throw new IllegalArgumentException(vw2.j(this, sb2));
        }
        view.clearAnimation();
        dispatchChildDetached(view);
        super.removeDetachedView(view, z2);
    }

    public void removeItemDecoration(@vo6 n nVar) {
        o oVar = this.mLayout;
        if (oVar != null) {
            oVar.assertNotInLayoutOrScroll("Cannot remove item decoration during a scroll  or layout");
        }
        this.mItemDecorations.remove(nVar);
        if (this.mItemDecorations.isEmpty()) {
            setWillNotDraw(getOverScrollMode() == 2);
        }
        markItemDecorInsetsDirty();
        requestLayout();
    }

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

    public void removeOnChildAttachStateChangeListener(@vo6 q qVar) {
        List<q> list = this.mOnChildAttachStateListeners;
        if (list == null) {
            return;
        }
        list.remove(qVar);
    }

    public void removeOnItemTouchListener(@vo6 s sVar) {
        this.mOnItemTouchListeners.remove(sVar);
        if (this.mInterceptingOnItemTouchListener == sVar) {
            this.mInterceptingOnItemTouchListener = null;
        }
    }

    public void removeOnScrollListener(@vo6 t tVar) {
        List<t> list = this.mScrollListeners;
        if (list != null) {
            list.remove(tVar);
        }
    }

    public void removeRecyclerListener(@vo6 x xVar) {
        this.mRecyclerListeners.remove(xVar);
    }

    public void repositionShadowingViews() {
        ag agVar;
        int iC = this.mChildHelper.c();
        for (int i2 = 0; i2 < iC; i2++) {
            View viewB = this.mChildHelper.b(i2);
            ag childViewHolder = getChildViewHolder(viewB);
            if (childViewHolder != null && (agVar = childViewHolder.mShadowingHolder) != null) {
                View view = agVar.itemView;
                int left = viewB.getLeft();
                int top = viewB.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) {
            m(view, view2);
        }
        super.requestChildFocus(view, view2);
    }

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

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

    @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 childCount = this.mChildHelper.a.a.getChildCount();
        for (int i2 = 0; i2 < childCount; i2++) {
            ag childViewHolderInt = getChildViewHolderInt(this.mChildHelper.a.a.getChildAt(i2));
            if (sDebugAssertionsEnabled && childViewHolderInt.mPosition == -1 && !childViewHolderInt.isRemoved()) {
                throw new IllegalStateException(vw2.j(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 i2, int i3) {
        o oVar = this.mLayout;
        if (oVar == null) {
            Log.e(TAG, "Cannot scroll without a LayoutManager set. Call setLayoutManager with a non-null argument.");
            return;
        }
        if (this.mLayoutSuppressed) {
            return;
        }
        boolean zCanScrollHorizontally = oVar.canScrollHorizontally();
        boolean zCanScrollVertically = this.mLayout.canScrollVertically();
        if (zCanScrollHorizontally || zCanScrollVertically) {
            if (!zCanScrollHorizontally) {
                i2 = 0;
            }
            if (!zCanScrollVertically) {
                i3 = 0;
            }
            scrollByInternal(i2, i3, null, 0);
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:31:0x00d4  */
    /* JADX WARN: Removed duplicated region for block: B:33:0x00ec  */
    /* JADX WARN: Removed duplicated region for block: B:37:0x0109  */
    /* JADX WARN: Removed duplicated region for block: B:41:0x0111  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public boolean scrollByInternal(int i2, int i3, MotionEvent motionEvent, int i4) {
        int i5;
        int i6;
        int i7;
        int i8;
        boolean z2;
        boolean z3;
        consumePendingUpdateOperations();
        if (this.mAdapter != null) {
            int[] iArr = this.mReusableIntPair;
            iArr[0] = 0;
            iArr[1] = 0;
            scrollStep(i2, i3, iArr);
            int[] iArr2 = this.mReusableIntPair;
            int i9 = iArr2[0];
            int i10 = iArr2[1];
            i7 = i2 - i9;
            i8 = i3 - i10;
            i6 = i10;
            i5 = i9;
        } else {
            i5 = 0;
            i6 = 0;
            i7 = 0;
            i8 = 0;
        }
        if (!this.mItemDecorations.isEmpty()) {
            invalidate();
        }
        int[] iArr3 = this.mReusableIntPair;
        iArr3[0] = 0;
        iArr3[1] = 0;
        dispatchNestedScroll(i5, i6, i7, i8, this.mScrollOffset, i4, iArr3);
        int[] iArr4 = this.mReusableIntPair;
        int i11 = iArr4[0];
        int i12 = i7 - i11;
        int i13 = iArr4[1];
        int i14 = i8 - i13;
        boolean z4 = (i11 == 0 && i13 == 0) ? false : true;
        int i15 = this.mLastTouchX;
        int[] iArr5 = this.mScrollOffset;
        int i16 = iArr5[0];
        this.mLastTouchX = i15 - i16;
        int i17 = this.mLastTouchY;
        int i18 = iArr5[1];
        this.mLastTouchY = i17 - i18;
        int[] iArr6 = this.mNestedOffsets;
        iArr6[0] = iArr6[0] + i16;
        iArr6[1] = iArr6[1] + i18;
        if (getOverScrollMode() != 2) {
            if (motionEvent == null || (motionEvent.getSource() & 8194) == 8194) {
                z2 = true;
            } else {
                float x2 = motionEvent.getX();
                float f2 = i12;
                float y2 = motionEvent.getY();
                float f3 = i14;
                if (f2 < 0.0f) {
                    ensureLeftGlow();
                    z2 = true;
                    androidx.core.widget.a.b(this.mLeftGlow, (-f2) / getWidth(), 1.0f - (y2 / getHeight()));
                } else {
                    z2 = true;
                    if (f2 > 0.0f) {
                        ensureRightGlow();
                        androidx.core.widget.a.b(this.mRightGlow, f2 / getWidth(), y2 / getHeight());
                    } else {
                        z3 = false;
                        if (f3 >= 0.0f) {
                            ensureTopGlow();
                            androidx.core.widget.a.b(this.mTopGlow, (-f3) / getHeight(), x2 / getWidth());
                        } else {
                            if (f3 > 0.0f) {
                                ensureBottomGlow();
                                androidx.core.widget.a.b(this.mBottomGlow, f3 / getHeight(), 1.0f - (x2 / getWidth()));
                            }
                            if (z3 || f2 != 0.0f || f3 != 0.0f) {
                                WeakHashMap weakHashMap = sia.a;
                                postInvalidateOnAnimation();
                            }
                        }
                        z3 = z2;
                        if (z3) {
                            WeakHashMap weakHashMap2 = sia.a;
                            postInvalidateOnAnimation();
                        }
                    }
                }
                z3 = z2;
                if (f3 >= 0.0f) {
                }
                z3 = z2;
                if (z3) {
                }
            }
            considerReleasingGlowsOnScroll(i2, i3);
        } else {
            z2 = true;
        }
        if (i5 != 0 || i6 != 0) {
            dispatchOnScrolled(i5, i6);
        }
        if (!awakenScrollBars()) {
            invalidate();
        }
        if (!z4 && i5 == 0 && i6 == 0) {
            return false;
        }
        return z2;
    }

    public void scrollStep(int i2, int i3, @rq6 int[] iArr) {
        startInterceptRequestLayout();
        onEnterLayoutOrScroll();
        int i4 = uq9.a;
        Trace.beginSection(TRACE_SCROLL_TAG);
        fillRemainingScrollValues(this.mState);
        int iScrollHorizontallyBy = i2 != 0 ? this.mLayout.scrollHorizontallyBy(i2, this.mRecycler, this.mState) : 0;
        int iScrollVerticallyBy = i3 != 0 ? this.mLayout.scrollVerticallyBy(i3, 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 i2, int i3) {
        Log.w(TAG, "RecyclerView does not support scrolling to an absolute position. Use scrollToPosition instead");
    }

    public void scrollToPosition(int i2) {
        if (this.mLayoutSuppressed) {
            return;
        }
        stopScroll();
        o oVar = this.mLayout;
        if (oVar == null) {
            Log.e(TAG, "Cannot scroll to position a LayoutManager set. Call setLayoutManager with a non-null argument.");
        } else {
            oVar.scrollToPosition(i2);
            awakenScrollBars();
        }
    }

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

    public void setAccessibilityDelegateCompat(@rq6 ao aoVar) {
        this.mAccessibilityDelegate = aoVar;
        sia.z(this, aoVar);
    }

    public void setAdapter(@rq6 g gVar) {
        setLayoutFrozen(false);
        o(gVar, false, true);
        processDataSetCompletelyChanged(false);
        requestLayout();
    }

    public void setChildDrawingOrderCallback(@rq6 j jVar) {
        if (jVar == this.mChildDrawingOrderCallback) {
            return;
        }
        this.mChildDrawingOrderCallback = jVar;
        setChildrenDrawingOrderEnabled(jVar != null);
    }

    @sma
    public boolean setChildImportantForAccessibilityInternal(ag agVar, int i2) {
        if (isComputingLayout()) {
            agVar.mPendingAccessibilityState = i2;
            this.mPendingAccessibilityImportanceChange.add(agVar);
            return false;
        }
        View view = agVar.itemView;
        WeakHashMap weakHashMap = sia.a;
        view.setImportantForAccessibility(i2);
        return true;
    }

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

    public void setEdgeEffectFactory(@vo6 k kVar) {
        kVar.getClass();
        this.mEdgeEffectFactory = kVar;
        invalidateGlows();
    }

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

    public void setItemAnimator(@rq6 l lVar) {
        l lVar2 = this.mItemAnimator;
        if (lVar2 != null) {
            lVar2.j();
            this.mItemAnimator.a = null;
        }
        this.mItemAnimator = lVar;
        if (lVar != null) {
            lVar.a = this.mItemAnimatorListener;
        }
    }

    public void setItemViewCacheSize(int i2) {
        w wVar = this.mRecycler;
        wVar.e = i2;
        wVar.o();
    }

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

    public void setLayoutManager(@rq6 o oVar) {
        if (oVar == this.mLayout) {
            return;
        }
        stopScroll();
        if (this.mLayout != null) {
            l lVar = this.mItemAnimator;
            if (lVar != null) {
                lVar.j();
            }
            this.mLayout.removeAndRecycleAllViews(this.mRecycler);
            this.mLayout.removeAndRecycleScrapInt(this.mRecycler);
            w wVar = this.mRecycler;
            wVar.a.clear();
            wVar.h();
            if (this.mIsAttached) {
                this.mLayout.dispatchDetachedFromWindow(this, this.mRecycler);
            }
            this.mLayout.setRecyclerView(null);
            this.mLayout = null;
        } else {
            w wVar2 = this.mRecycler;
            wVar2.a.clear();
            wVar2.h();
        }
        androidx.recyclerview.widget.h hVar = this.mChildHelper;
        an anVar = hVar.a;
        hVar.b.g();
        ArrayList arrayList = hVar.c;
        for (int size = arrayList.size() - 1; size >= 0; size--) {
            anVar.a((View) arrayList.get(size));
            arrayList.remove(size);
        }
        RecyclerView recyclerView = anVar.a;
        int childCount = recyclerView.getChildCount();
        for (int i2 = 0; i2 < childCount; i2++) {
            View childAt = recyclerView.getChildAt(i2);
            recyclerView.dispatchChildDetached(childAt);
            childAt.clearAnimation();
        }
        recyclerView.removeAllViews();
        this.mLayout = oVar;
        if (oVar != null) {
            if (oVar.mRecyclerView != null) {
                StringBuilder sb = new StringBuilder("LayoutManager ");
                sb.append(oVar);
                sb.append(" is already attached to a RecyclerView:");
                throw new IllegalArgumentException(vw2.j(oVar.mRecyclerView, sb));
            }
            oVar.setRecyclerView(this);
            if (this.mIsAttached) {
                this.mLayout.dispatchAttachedToWindow(this);
            }
        }
        this.mRecycler.o();
        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 z2) {
        getScrollingChildHelper().g(z2);
    }

    public void setOnFlingListener(@rq6 r rVar) {
        this.mOnFlingListener = rVar;
    }

    @Deprecated
    public void setOnScrollListener(@rq6 t tVar) {
        this.mScrollListener = tVar;
    }

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

    public void setRecycledViewPool(@rq6 v vVar) {
        w wVar = this.mRecycler;
        RecyclerView recyclerView = RecyclerView.this;
        wVar.g(recyclerView.mAdapter, false);
        if (wVar.g != null) {
            r2.b--;
        }
        wVar.g = vVar;
        if (vVar != null && recyclerView.getAdapter() != null) {
            wVar.g.b++;
        }
        wVar.f();
    }

    @Deprecated
    public void setRecyclerListener(@rq6 x xVar) {
        this.mRecyclerListener = xVar;
    }

    public void setScrollState(int i2) {
        if (i2 == this.mScrollState) {
            return;
        }
        if (sVerboseLoggingEnabled) {
            new Exception();
        }
        this.mScrollState = i2;
        if (i2 != 2) {
            af afVar = this.mViewFlinger;
            RecyclerView.this.removeCallbacks(afVar);
            afVar.c.abortAnimation();
            o oVar = this.mLayout;
            if (oVar != null) {
                oVar.stopSmoothScroller();
            }
        }
        dispatchOnScrollStateChanged(i2);
    }

    public void setScrollingTouchSlop(int i2) {
        ViewConfiguration viewConfiguration = ViewConfiguration.get(getContext());
        if (i2 != 0) {
            if (i2 == 1) {
                this.mTouchSlop = viewConfiguration.getScaledPagingTouchSlop();
                return;
            }
            Log.w(TAG, "setScrollingTouchSlop(): bad argument constant " + i2 + "; using default value");
        }
        this.mTouchSlop = viewConfiguration.getScaledTouchSlop();
    }

    public void setViewCacheExtension(@rq6 ae aeVar) {
        this.mRecycler.h = aeVar;
    }

    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(@cm7 int i2, @cm7 int i3) {
        smoothScrollBy(i2, i3, null);
    }

    public void smoothScrollToPosition(int i2) {
        if (this.mLayoutSuppressed) {
            return;
        }
        o oVar = this.mLayout;
        if (oVar == null) {
            Log.e(TAG, "Cannot smooth scroll without a LayoutManager set. Call setLayoutManager with a non-null argument.");
        } else {
            oVar.smoothScrollToPosition(this, this.mState, i2);
        }
    }

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

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

    public void stopInterceptRequestLayout(boolean z2) {
        if (this.mInterceptRequestLayoutDepth < 1) {
            if (sDebugAssertionsEnabled) {
                throw new IllegalStateException(vw2.j(this, new StringBuilder("stopInterceptRequestLayout was called more times than startInterceptRequestLayout.")));
            }
            this.mInterceptRequestLayoutDepth = 1;
        }
        if (!z2 && !this.mLayoutSuppressed) {
            this.mLayoutWasDefered = false;
        }
        if (this.mInterceptRequestLayoutDepth == 1) {
            if (z2 && 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().i(0);
    }

    public void stopScroll() {
        setScrollState(0);
        af afVar = this.mViewFlinger;
        RecyclerView.this.removeCallbacks(afVar);
        afVar.c.abortAnimation();
        o oVar = this.mLayout;
        if (oVar != null) {
            oVar.stopSmoothScroller();
        }
    }

    @Override // android.view.ViewGroup
    public final void suppressLayout(boolean z2) {
        if (z2 != this.mLayoutSuppressed) {
            assertNotInLayoutOrScroll("Do not suppressLayout in layout or scroll");
            if (z2) {
                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(@rq6 g gVar, boolean z2) {
        setLayoutFrozen(false);
        o(gVar, true, z2);
        processDataSetCompletelyChanged(true);
        requestLayout();
    }

    public void viewRangeUpdate(int i2, int i3, Object obj) {
        int i4;
        int i5;
        int childCount = this.mChildHelper.a.a.getChildCount();
        int i6 = i3 + i2;
        for (int i7 = 0; i7 < childCount; i7++) {
            View childAt = this.mChildHelper.a.a.getChildAt(i7);
            ag childViewHolderInt = getChildViewHolderInt(childAt);
            if (childViewHolderInt != null && !childViewHolderInt.shouldIgnore() && (i5 = childViewHolderInt.mPosition) >= i2 && i5 < i6) {
                childViewHolderInt.addFlags(2);
                childViewHolderInt.addChangePayload(obj);
                ((p) childAt.getLayoutParams()).c = true;
            }
        }
        w wVar = this.mRecycler;
        ArrayList arrayList = wVar.c;
        for (int size = arrayList.size() - 1; size >= 0; size--) {
            ag agVar = (ag) arrayList.get(size);
            if (agVar != null && (i4 = agVar.mPosition) >= i2 && i4 < i6) {
                agVar.addFlags(2);
                wVar.i(size);
            }
        }
    }

    public static abstract class g<VH extends ag> {
        private final h mObservable = new h();
        private boolean mHasStableIds = false;
        private a mStateRestorationPolicy = a.a;

        /* JADX WARN: Failed to restore enum class, 'enum' modifier and super class removed */
        /* JADX WARN: Unknown enum class pattern. Please report as an issue! */
        public static final class a {
            public static final a a;
            public static final a b;
            public static final a c;
            public static final /* synthetic */ a[] d;

            static {
                a aVar = new a("ALLOW", 0);
                a = aVar;
                a aVar2 = new a("PREVENT_WHEN_EMPTY", 1);
                b = aVar2;
                a aVar3 = new a("PREVENT", 2);
                c = aVar3;
                d = new a[]{aVar, aVar2, aVar3};
            }

            public static a valueOf(String str) {
                return (a) Enum.valueOf(a.class, str);
            }

            public static a[] values() {
                return (a[]) d.clone();
            }
        }

        /* JADX WARN: Multi-variable type inference failed */
        public final void bindViewHolder(@vo6 VH vh, int i) {
            boolean z = vh.mBindingAdapter == null;
            if (z) {
                vh.mPosition = i;
                if (hasStableIds()) {
                    vh.mItemId = getItemId(i);
                }
                vh.setFlags(1, 519);
                int i2 = uq9.a;
                Trace.beginSection(RecyclerView.TRACE_BIND_VIEW_TAG);
            }
            vh.mBindingAdapter = this;
            if (RecyclerView.sDebugAssertionsEnabled) {
                if (vh.itemView.getParent() == null) {
                    View view = vh.itemView;
                    WeakHashMap weakHashMap = sia.a;
                    if (view.isAttachedToWindow() != vh.isTmpDetached()) {
                        throw new IllegalStateException("Temp-detached state out of sync with reality. holder.isTmpDetached(): " + vh.isTmpDetached() + ", attached to window: " + vh.itemView.isAttachedToWindow() + ", holder: " + vh);
                    }
                }
                if (vh.itemView.getParent() == null) {
                    View view2 = vh.itemView;
                    WeakHashMap weakHashMap2 = sia.a;
                    if (view2.isAttachedToWindow()) {
                        throw new IllegalStateException("Attempting to bind attached holder with no parent (AKA temp detached): " + vh);
                    }
                }
            }
            onBindViewHolder(vh, i, vh.getUnmodifiedPayloads());
            if (z) {
                vh.clearPayload();
                ViewGroup.LayoutParams layoutParams = vh.itemView.getLayoutParams();
                if (layoutParams instanceof p) {
                    ((p) layoutParams).c = true;
                }
                int i3 = uq9.a;
                Trace.endSection();
            }
        }

        public boolean canRestoreState() {
            int iOrdinal = this.mStateRestorationPolicy.ordinal();
            if (iOrdinal != 1) {
                if (iOrdinal == 2) {
                    return false;
                }
            } else if (getItemCount() <= 0) {
                return false;
            }
            return true;
        }

        @vo6
        public final VH createViewHolder(@vo6 ViewGroup viewGroup, int i) {
            try {
                int i2 = uq9.a;
                Trace.beginSection(RecyclerView.TRACE_CREATE_VIEW_TAG);
                VH vh = (VH) onCreateViewHolder(viewGroup, i);
                if (vh.itemView.getParent() != null) {
                    throw new IllegalStateException("ViewHolder views must not be attached when created. Ensure that you are not passing 'true' to the attachToRoot parameter of LayoutInflater.inflate(..., boolean attachToRoot)");
                }
                vh.mItemViewType = i;
                Trace.endSection();
                return vh;
            } catch (Throwable th) {
                int i3 = uq9.a;
                Trace.endSection();
                throw th;
            }
        }

        public int findRelativeAdapterPositionIn(@vo6 g<? extends ag> gVar, @vo6 ag agVar, int i) {
            if (gVar == this) {
                return i;
            }
            return -1;
        }

        public abstract int getItemCount();

        public long getItemId(int i) {
            return -1L;
        }

        public int getItemViewType(int i) {
            return 0;
        }

        @vo6
        public final a getStateRestorationPolicy() {
            return this.mStateRestorationPolicy;
        }

        public final boolean hasObservers() {
            return this.mObservable.a();
        }

        public final boolean hasStableIds() {
            return this.mHasStableIds;
        }

        public final void notifyDataSetChanged() {
            this.mObservable.b();
        }

        public final void notifyItemChanged(int i) {
            this.mObservable.d(i, 1, null);
        }

        public final void notifyItemInserted(int i) {
            this.mObservable.e(i, 1);
        }

        public final void notifyItemMoved(int i, int i2) {
            this.mObservable.c(i, i2);
        }

        public final void notifyItemRangeChanged(int i, int i2) {
            this.mObservable.d(i, i2, null);
        }

        public final void notifyItemRangeInserted(int i, int i2) {
            this.mObservable.e(i, i2);
        }

        public final void notifyItemRangeRemoved(int i, int i2) {
            this.mObservable.f(i, i2);
        }

        public final void notifyItemRemoved(int i) {
            this.mObservable.f(i, 1);
        }

        public void onAttachedToRecyclerView(@vo6 RecyclerView recyclerView) {
        }

        public abstract void onBindViewHolder(ag agVar, int i);

        public void onBindViewHolder(@vo6 VH vh, int i, @vo6 List<Object> list) {
            onBindViewHolder(vh, i);
        }

        public abstract ag onCreateViewHolder(ViewGroup viewGroup, int i);

        public void onDetachedFromRecyclerView(@vo6 RecyclerView recyclerView) {
        }

        public boolean onFailedToRecycleView(@vo6 VH vh) {
            return false;
        }

        public void onViewAttachedToWindow(@vo6 VH vh) {
        }

        public void onViewDetachedFromWindow(@vo6 VH vh) {
        }

        public void onViewRecycled(@vo6 VH vh) {
        }

        public void registerAdapterDataObserver(@vo6 i iVar) {
            this.mObservable.registerObserver(iVar);
        }

        public void setHasStableIds(boolean z) {
            if (hasObservers()) {
                throw new IllegalStateException("Cannot change whether this adapter has stable IDs while the adapter has registered observers.");
            }
            this.mHasStableIds = z;
        }

        public void setStateRestorationPolicy(@vo6 a aVar) {
            this.mStateRestorationPolicy = aVar;
            this.mObservable.g();
        }

        public void unregisterAdapterDataObserver(@vo6 i iVar) {
            this.mObservable.unregisterObserver(iVar);
        }

        public final void notifyItemChanged(int i, @rq6 Object obj) {
            this.mObservable.d(i, 1, obj);
        }

        public final void notifyItemRangeChanged(int i, int i2, @rq6 Object obj) {
            this.mObservable.d(i, i2, obj);
        }
    }

    public RecyclerView(Context context, AttributeSet attributeSet, int i2) {
        Constructor constructor;
        super(context, attributeSet, i2);
        this.mObserver = new y();
        this.mRecycler = new w();
        this.mViewInfoStore = new aw();
        this.mUpdateChildViewsRunnable = new a();
        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;
        androidx.recyclerview.widget.s sVar = new androidx.recyclerview.widget.s();
        Object[] objArr = null;
        sVar.a = null;
        sVar.b = new ArrayList();
        sVar.c = 120L;
        sVar.d = 120L;
        sVar.e = 250L;
        sVar.f = 250L;
        sVar.g = true;
        sVar.h = new ArrayList();
        sVar.i = new ArrayList();
        sVar.j = new ArrayList();
        sVar.k = new ArrayList();
        sVar.l = new ArrayList();
        sVar.m = new ArrayList();
        sVar.n = new ArrayList();
        sVar.o = new ArrayList();
        sVar.p = new ArrayList();
        sVar.q = new ArrayList();
        sVar.r = new ArrayList();
        this.mItemAnimator = sVar;
        this.mScrollState = 0;
        this.mScrollPointerId = -1;
        this.mScaledHorizontalScrollFactor = Float.MIN_VALUE;
        this.mScaledVerticalScrollFactor = Float.MIN_VALUE;
        this.mPreserveFocusAfterLayout = true;
        this.mViewFlinger = new af();
        this.mPrefetchRegistry = ALLOW_THREAD_GAP_WORK ? new w.b() : null;
        ac acVar = new ac();
        acVar.a = -1;
        acVar.b = 0;
        acVar.c = 0;
        acVar.d = 1;
        acVar.e = 0;
        acVar.f = false;
        acVar.g = false;
        acVar.h = false;
        acVar.i = false;
        acVar.j = false;
        acVar.k = false;
        this.mState = acVar;
        this.mItemsAddedOrRemoved = false;
        this.mItemsChanged = false;
        this.mItemAnimatorListener = new m();
        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 b();
        this.mLastAutoMeasureNonExactMeasuredWidth = 0;
        this.mLastAutoMeasureNonExactMeasuredHeight = 0;
        this.mViewInfoProcessCallback = new d();
        setScrollContainer(true);
        setFocusableInTouchMode(true);
        ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
        this.mTouchSlop = viewConfiguration.getScaledTouchSlop();
        this.mScaledHorizontalScrollFactor = viewConfiguration.getScaledHorizontalScrollFactor();
        this.mScaledVerticalScrollFactor = viewConfiguration.getScaledVerticalScrollFactor();
        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.a = this.mItemAnimatorListener;
        initAdapterManager();
        this.mChildHelper = new androidx.recyclerview.widget.h(new an(this));
        if (sia.j(this) == 0) {
            sia.ae(this, 8);
        }
        if (getImportantForAccessibility() == 0) {
            setImportantForAccessibility(1);
        }
        this.mAccessibilityManager = (AccessibilityManager) getContext().getSystemService("accessibility");
        setAccessibilityDelegateCompat(new ao(this));
        int[] iArr = gp7.d.a;
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, iArr, i2, 0);
        sia.y(this, context, iArr, attributeSet, typedArrayObtainStyledAttributes, i2, 0);
        String string = typedArrayObtainStyledAttributes.getString(8);
        if (typedArrayObtainStyledAttributes.getInt(2, -1) == -1) {
            setDescendantFocusability(MediaUtils.TRANSACTION_SIZE_LIMIT_IN_BYTES);
        }
        this.mClipToPadding = typedArrayObtainStyledAttributes.getBoolean(1, true);
        boolean z2 = typedArrayObtainStyledAttributes.getBoolean(3, false);
        this.mEnableFastScroller = z2;
        if (z2) {
            initFastScroller((StateListDrawable) typedArrayObtainStyledAttributes.getDrawable(6), typedArrayObtainStyledAttributes.getDrawable(7), (StateListDrawable) typedArrayObtainStyledAttributes.getDrawable(4), typedArrayObtainStyledAttributes.getDrawable(5));
        }
        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;
                }
                try {
                    Class<? extends U> clsAsSubclass = Class.forName(strTrim, false, isInEditMode() ? getClass().getClassLoader() : context.getClassLoader()).asSubclass(o.class);
                    try {
                        constructor = clsAsSubclass.getConstructor(LAYOUT_MANAGER_CONSTRUCTOR_SIGNATURE);
                        objArr = new Object[]{context, attributeSet, Integer.valueOf(i2), 0};
                    } catch (NoSuchMethodException e2) {
                        try {
                            constructor = clsAsSubclass.getConstructor(null);
                        } catch (NoSuchMethodException e3) {
                            e3.initCause(e2);
                            throw new IllegalStateException(attributeSet.getPositionDescription() + ": Error creating LayoutManager " + strTrim, e3);
                        }
                    }
                    constructor.setAccessible(true);
                    setLayoutManager((o) constructor.newInstance(objArr));
                } catch (ClassCastException e4) {
                    throw new IllegalStateException(attributeSet.getPositionDescription() + ": Class is not a LayoutManager " + strTrim, e4);
                } catch (ClassNotFoundException e5) {
                    throw new IllegalStateException(attributeSet.getPositionDescription() + ": Unable to find LayoutManager " + strTrim, e5);
                } catch (IllegalAccessException e6) {
                    throw new IllegalStateException(attributeSet.getPositionDescription() + ": Cannot access non-public constructor " + strTrim, e6);
                } catch (InstantiationException e7) {
                    throw new IllegalStateException(attributeSet.getPositionDescription() + ": Could not instantiate the LayoutManager: " + strTrim, e7);
                } catch (InvocationTargetException e8) {
                    throw new IllegalStateException(attributeSet.getPositionDescription() + ": Could not instantiate the LayoutManager: " + strTrim, e8);
                }
            }
        }
        int[] iArr2 = NESTED_SCROLLING_ATTRS;
        TypedArray typedArrayObtainStyledAttributes2 = context.obtainStyledAttributes(attributeSet, iArr2, i2, 0);
        sia.y(this, context, iArr2, attributeSet, typedArrayObtainStyledAttributes2, i2, 0);
        boolean z3 = typedArrayObtainStyledAttributes2.getBoolean(0, true);
        typedArrayObtainStyledAttributes2.recycle();
        setNestedScrollingEnabled(z3);
        setTag(com.strmr.ps.R.id.is_pooling_container_tag, Boolean.TRUE);
    }

    /* JADX WARN: Removed duplicated region for block: B:15:0x0032  */
    @rq6
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public ag findViewHolderForPosition(int i2, boolean z2) {
        int childCount = this.mChildHelper.a.a.getChildCount();
        ag agVar = null;
        for (int i3 = 0; i3 < childCount; i3++) {
            ag childViewHolderInt = getChildViewHolderInt(this.mChildHelper.a.a.getChildAt(i3));
            if (childViewHolderInt != null && !childViewHolderInt.isRemoved()) {
                if (z2) {
                    if (childViewHolderInt.mPosition != i2) {
                        continue;
                    } else {
                        androidx.recyclerview.widget.h hVar = this.mChildHelper;
                        if (!hVar.c.contains(childViewHolderInt.itemView)) {
                            return childViewHolderInt;
                        }
                        agVar = childViewHolderInt;
                    }
                } else if (childViewHolderInt.getLayoutPosition() != i2) {
                    continue;
                }
            }
        }
        return agVar;
    }

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

    public void smoothScrollBy(@cm7 int i2, @cm7 int i3, @rq6 Interpolator interpolator) {
        smoothScrollBy(i2, i3, interpolator, Integer.MIN_VALUE);
    }

    public boolean dispatchNestedPreScroll(int i2, int i3, int[] iArr, int[] iArr2, int i4) {
        return getScrollingChildHelper().c(i2, i3, iArr, iArr2, i4);
    }

    public boolean dispatchNestedScroll(int i2, int i3, int i4, int i5, int[] iArr, int i6) {
        return getScrollingChildHelper().d(i2, i3, i4, i5, iArr, i6, null);
    }

    public boolean hasNestedScrollingParent(int i2) {
        return getScrollingChildHelper().f(i2);
    }

    public void smoothScrollBy(@cm7 int i2, @cm7 int i3, @rq6 Interpolator interpolator, int i4) {
        smoothScrollBy(i2, i3, interpolator, i4, false);
    }

    public boolean startNestedScroll(int i2, int i3) {
        return getScrollingChildHelper().h(i2, i3);
    }

    public void stopNestedScroll(int i2) {
        getScrollingChildHelper().i(i2);
    }

    public static class p extends ViewGroup.MarginLayoutParams {
        public ag a;
        public final Rect b;
        public boolean c;
        public boolean d;

        public p(Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
            this.b = new Rect();
            this.c = true;
            this.d = false;
        }

        public p(int i, int i2) {
            super(i, i2);
            this.b = new Rect();
            this.c = true;
            this.d = false;
        }

        public p(ViewGroup.MarginLayoutParams marginLayoutParams) {
            super(marginLayoutParams);
            this.b = new Rect();
            this.c = true;
            this.d = false;
        }

        public p(ViewGroup.LayoutParams layoutParams) {
            super(layoutParams);
            this.b = new Rect();
            this.c = true;
            this.d = false;
        }

        public p(p pVar) {
            super((ViewGroup.LayoutParams) pVar);
            this.b = new Rect();
            this.c = true;
            this.d = false;
        }
    }

    public void smoothScrollBy(@cm7 int i2, @cm7 int i3, @rq6 Interpolator interpolator, int i4, boolean z2) {
        o oVar = this.mLayout;
        if (oVar == null) {
            Log.e(TAG, "Cannot smooth scroll without a LayoutManager set. Call setLayoutManager with a non-null argument.");
            return;
        }
        if (this.mLayoutSuppressed) {
            return;
        }
        if (!oVar.canScrollHorizontally()) {
            i2 = 0;
        }
        if (!this.mLayout.canScrollVertically()) {
            i3 = 0;
        }
        if (i2 == 0 && i3 == 0) {
            return;
        }
        if (i4 != Integer.MIN_VALUE && i4 <= 0) {
            scrollBy(i2, i3);
            return;
        }
        if (z2) {
            int i5 = i2 != 0 ? 1 : 0;
            if (i3 != 0) {
                i5 |= 2;
            }
            startNestedScroll(i5, 1);
        }
        this.mViewFlinger.c(i2, i3, interpolator, i4);
    }

    public final void dispatchNestedScroll(int i2, int i3, int i4, int i5, int[] iArr, int i6, @vo6 int[] iArr2) {
        getScrollingChildHelper().d(i2, i3, i4, i5, iArr, i6, iArr2);
    }

    public void addItemDecoration(@vo6 n nVar) {
        addItemDecoration(nVar, -1);
    }

    @Override // android.view.ViewGroup
    public ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
        o oVar = this.mLayout;
        if (oVar != null) {
            return oVar.generateLayoutParams(layoutParams);
        }
        throw new IllegalStateException(vw2.j(this, new StringBuilder("RecyclerView has no LayoutManager")));
    }
}
