Files
rr3-apk/decompiled/sources/androidx/recyclerview/widget/RecyclerView.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

7178 lines
288 KiB
Java

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.util.AttributeSet;
import android.util.Log;
import android.util.SparseArray;
import android.view.FocusFinder;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.animation.Interpolator;
import android.widget.EdgeEffect;
import android.widget.OverScroller;
import androidx.annotation.CallSuper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.Px;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
import androidx.core.os.TraceCompat;
import androidx.core.util.Preconditions;
import androidx.core.view.AccessibilityDelegateCompat;
import androidx.core.view.MotionEventCompat;
import androidx.core.view.NestedScrollingChild2;
import androidx.core.view.NestedScrollingChild3;
import androidx.core.view.NestedScrollingChildHelper;
import androidx.core.view.ScrollingView;
import androidx.core.view.ViewCompat;
import androidx.core.view.ViewConfigurationCompat;
import androidx.core.view.accessibility.AccessibilityEventCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
import androidx.core.widget.EdgeEffectCompat;
import androidx.customview.view.AbsSavedState;
import androidx.recyclerview.widget.AdapterHelper;
import androidx.recyclerview.widget.ChildHelper;
import androidx.recyclerview.widget.GapWorker;
import androidx.recyclerview.widget.RecyclerViewAccessibilityDelegate;
import androidx.recyclerview.widget.ViewBoundsCheck;
import androidx.recyclerview.widget.ViewInfoStore;
import com.ironsource.mediationsdk.logger.IronSourceError;
import csdk.gluads.Consts;
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.Collections;
import java.util.List;
/* loaded from: classes.dex */
public class RecyclerView extends ViewGroup implements ScrollingView, NestedScrollingChild2, NestedScrollingChild3 {
static final boolean DEBUG = false;
static final int DEFAULT_ORIENTATION = 1;
static final boolean DISPATCH_TEMP_DETACH = false;
static final long FOREVER_NS = Long.MAX_VALUE;
public static final int HORIZONTAL = 0;
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;
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 final Interpolator sQuinticInterpolator;
RecyclerViewAccessibilityDelegate mAccessibilityDelegate;
private final AccessibilityManager mAccessibilityManager;
Adapter mAdapter;
AdapterHelper mAdapterHelper;
boolean mAdapterUpdateDuringMeasure;
private EdgeEffect mBottomGlow;
private ChildDrawingOrderCallback mChildDrawingOrderCallback;
ChildHelper mChildHelper;
boolean mClipToPadding;
boolean mDataSetHasChangedAfterLayout;
boolean mDispatchItemsChangedEvent;
private int mDispatchScrollCounter;
private int mEatenAccessibilityChangeFlags;
@NonNull
private EdgeEffectFactory mEdgeEffectFactory;
boolean mEnableFastScroller;
@VisibleForTesting
boolean mFirstLayoutComplete;
GapWorker mGapWorker;
boolean mHasFixedSize;
private boolean mIgnoreMotionEventTillDown;
private int mInitialTouchX;
private int mInitialTouchY;
private int mInterceptRequestLayoutDepth;
private OnItemTouchListener mInterceptingOnItemTouchListener;
boolean mIsAttached;
ItemAnimator mItemAnimator;
private ItemAnimator.ItemAnimatorListener mItemAnimatorListener;
private Runnable mItemAnimatorRunner;
final ArrayList<ItemDecoration> mItemDecorations;
boolean mItemsAddedOrRemoved;
boolean mItemsChanged;
private int mLastAutoMeasureNonExactMeasuredHeight;
private int mLastAutoMeasureNonExactMeasuredWidth;
private boolean mLastAutoMeasureSkippedDueToExact;
private int mLastTouchX;
private int mLastTouchY;
@VisibleForTesting
LayoutManager 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 RecyclerViewDataObserver mObserver;
private List<OnChildAttachStateChangeListener> mOnChildAttachStateListeners;
private OnFlingListener mOnFlingListener;
private final ArrayList<OnItemTouchListener> mOnItemTouchListeners;
@VisibleForTesting
final List<ViewHolder> mPendingAccessibilityImportanceChange;
SavedState mPendingSavedState;
boolean mPostedAnimatorRunner;
GapWorker.LayoutPrefetchRegistryImpl mPrefetchRegistry;
private boolean mPreserveFocusAfterLayout;
final Recycler mRecycler;
RecyclerListener mRecyclerListener;
final List<RecyclerListener> mRecyclerListeners;
final int[] mReusableIntPair;
private EdgeEffect mRightGlow;
private float mScaledHorizontalScrollFactor;
private float mScaledVerticalScrollFactor;
private OnScrollListener mScrollListener;
private List<OnScrollListener> mScrollListeners;
private final int[] mScrollOffset;
private int mScrollPointerId;
private int mScrollState;
private NestedScrollingChildHelper mScrollingChildHelper;
final State mState;
final Rect mTempRect;
private final Rect mTempRect2;
final RectF mTempRectF;
private EdgeEffect mTopGlow;
private int mTouchSlop;
final Runnable mUpdateChildViewsRunnable;
private VelocityTracker mVelocityTracker;
final ViewFlinger mViewFlinger;
private final ViewInfoStore.ProcessCallback mViewInfoProcessCallback;
final ViewInfoStore mViewInfoStore;
private static final int[] NESTED_SCROLLING_ATTRS = {R.attr.nestedScrollingEnabled};
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 interface ChildDrawingOrderCallback {
int onGetChildDrawingOrder(int i, int i2);
}
public interface OnChildAttachStateChangeListener {
void onChildViewAttachedToWindow(@NonNull View view);
void onChildViewDetachedFromWindow(@NonNull View view);
}
public static abstract class OnFlingListener {
public abstract boolean onFling(int i, int i2);
}
public interface OnItemTouchListener {
boolean onInterceptTouchEvent(@NonNull RecyclerView recyclerView, @NonNull MotionEvent motionEvent);
void onRequestDisallowInterceptTouchEvent(boolean z);
void onTouchEvent(@NonNull RecyclerView recyclerView, @NonNull MotionEvent motionEvent);
}
public static abstract class OnScrollListener {
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int i) {
}
public void onScrolled(@NonNull RecyclerView recyclerView, int i, int i2) {
}
}
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public @interface Orientation {
}
public interface RecyclerListener {
void onViewRecycled(@NonNull ViewHolder viewHolder);
}
public static class SimpleOnItemTouchListener implements OnItemTouchListener {
@Override // androidx.recyclerview.widget.RecyclerView.OnItemTouchListener
public boolean onInterceptTouchEvent(@NonNull RecyclerView recyclerView, @NonNull MotionEvent motionEvent) {
return false;
}
@Override // androidx.recyclerview.widget.RecyclerView.OnItemTouchListener
public void onRequestDisallowInterceptTouchEvent(boolean z) {
}
@Override // androidx.recyclerview.widget.RecyclerView.OnItemTouchListener
public void onTouchEvent(@NonNull RecyclerView recyclerView, @NonNull MotionEvent motionEvent) {
}
}
public static abstract class ViewCacheExtension {
@Nullable
public abstract View getViewForPositionAndType(@NonNull Recycler recycler, int i, int i2);
}
@Override // android.view.ViewGroup, android.view.View
public CharSequence getAccessibilityClassName() {
return "androidx.recyclerview.widget.RecyclerView";
}
@Nullable
public Adapter getAdapter() {
return this.mAdapter;
}
@Override // android.view.ViewGroup
public boolean getClipToPadding() {
return this.mClipToPadding;
}
@Nullable
public RecyclerViewAccessibilityDelegate getCompatAccessibilityDelegate() {
return this.mAccessibilityDelegate;
}
@NonNull
public EdgeEffectFactory getEdgeEffectFactory() {
return this.mEdgeEffectFactory;
}
@Nullable
public ItemAnimator getItemAnimator() {
return this.mItemAnimator;
}
@Nullable
public LayoutManager getLayoutManager() {
return this.mLayout;
}
public int getMaxFlingVelocity() {
return this.mMaxFlingVelocity;
}
public int getMinFlingVelocity() {
return this.mMinFlingVelocity;
}
@Nullable
public OnFlingListener getOnFlingListener() {
return this.mOnFlingListener;
}
public boolean getPreserveFocusAfterLayout() {
return this.mPreserveFocusAfterLayout;
}
public int getScrollState() {
return this.mScrollState;
}
public boolean hasFixedSize() {
return this.mHasFixedSize;
}
public void invalidateGlows() {
this.mBottomGlow = null;
this.mTopGlow = null;
this.mRightGlow = null;
this.mLeftGlow = null;
}
@Override // android.view.View
public boolean isAttachedToWindow() {
return this.mIsAttached;
}
public boolean isComputingLayout() {
return this.mLayoutOrScrollCounter > 0;
}
@Override // android.view.ViewGroup
public final boolean isLayoutSuppressed() {
return this.mLayoutSuppressed;
}
public void onChildAttachedToWindow(@NonNull View view) {
}
public void onChildDetachedFromWindow(@NonNull View view) {
}
public void onEnterLayoutOrScroll() {
this.mLayoutOrScrollCounter++;
}
public void onScrollStateChanged(int i) {
}
public void onScrolled(@Px int i, @Px int i2) {
}
public void setHasFixedSize(boolean z) {
this.mHasFixedSize = z;
}
public void setOnFlingListener(@Nullable OnFlingListener onFlingListener) {
this.mOnFlingListener = onFlingListener;
}
@Deprecated
public void setOnScrollListener(@Nullable OnScrollListener onScrollListener) {
this.mScrollListener = onScrollListener;
}
public void setPreserveFocusAfterLayout(boolean z) {
this.mPreserveFocusAfterLayout = z;
}
@Deprecated
public void setRecyclerListener(@Nullable RecyclerListener recyclerListener) {
this.mRecyclerListener = recyclerListener;
}
public void startInterceptRequestLayout() {
int i = this.mInterceptRequestLayoutDepth + 1;
this.mInterceptRequestLayoutDepth = i;
if (i != 1 || this.mLayoutSuppressed) {
return;
}
this.mLayoutWasDefered = false;
}
static {
Class<?> cls = Integer.TYPE;
LAYOUT_MANAGER_CONSTRUCTOR_SIGNATURE = new Class[]{Context.class, AttributeSet.class, cls, cls};
sQuinticInterpolator = new Interpolator() { // from class: androidx.recyclerview.widget.RecyclerView.3
@Override // android.animation.TimeInterpolator
public float getInterpolation(float f) {
float f2 = f - 1.0f;
return (f2 * f2 * f2 * f2 * f2) + 1.0f;
}
};
}
public RecyclerView(@NonNull Context context) {
this(context, null);
}
public RecyclerView(@NonNull Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, androidx.recyclerview.R.attr.recyclerViewStyle);
}
public RecyclerView(@NonNull Context context, @Nullable AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.mObserver = new RecyclerViewDataObserver();
this.mRecycler = new Recycler();
this.mViewInfoStore = new ViewInfoStore();
this.mUpdateChildViewsRunnable = new Runnable() { // from class: androidx.recyclerview.widget.RecyclerView.1
@Override // java.lang.Runnable
public void run() {
RecyclerView recyclerView = RecyclerView.this;
if (!recyclerView.mFirstLayoutComplete || recyclerView.isLayoutRequested()) {
return;
}
RecyclerView recyclerView2 = RecyclerView.this;
if (!recyclerView2.mIsAttached) {
recyclerView2.requestLayout();
} else if (recyclerView2.mLayoutSuppressed) {
recyclerView2.mLayoutWasDefered = true;
} else {
recyclerView2.consumePendingUpdateOperations();
}
}
};
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 = new EdgeEffectFactory();
this.mItemAnimator = new DefaultItemAnimator();
this.mScrollState = 0;
this.mScrollPointerId = -1;
this.mScaledHorizontalScrollFactor = Float.MIN_VALUE;
this.mScaledVerticalScrollFactor = Float.MIN_VALUE;
this.mPreserveFocusAfterLayout = true;
this.mViewFlinger = new ViewFlinger();
this.mPrefetchRegistry = ALLOW_THREAD_GAP_WORK ? new GapWorker.LayoutPrefetchRegistryImpl() : null;
this.mState = new State();
this.mItemsAddedOrRemoved = false;
this.mItemsChanged = false;
this.mItemAnimatorListener = new ItemAnimatorRestoreListener();
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 Runnable() { // from class: androidx.recyclerview.widget.RecyclerView.2
@Override // java.lang.Runnable
public void run() {
ItemAnimator itemAnimator = RecyclerView.this.mItemAnimator;
if (itemAnimator != null) {
itemAnimator.runPendingAnimations();
}
RecyclerView.this.mPostedAnimatorRunner = false;
}
};
this.mLastAutoMeasureNonExactMeasuredWidth = 0;
this.mLastAutoMeasureNonExactMeasuredHeight = 0;
this.mViewInfoProcessCallback = new ViewInfoStore.ProcessCallback() { // from class: androidx.recyclerview.widget.RecyclerView.4
@Override // androidx.recyclerview.widget.ViewInfoStore.ProcessCallback
public void processDisappeared(ViewHolder viewHolder, @NonNull ItemAnimator.ItemHolderInfo itemHolderInfo, @Nullable ItemAnimator.ItemHolderInfo itemHolderInfo2) {
RecyclerView.this.mRecycler.unscrapView(viewHolder);
RecyclerView.this.animateDisappearance(viewHolder, itemHolderInfo, itemHolderInfo2);
}
@Override // androidx.recyclerview.widget.ViewInfoStore.ProcessCallback
public void processAppeared(ViewHolder viewHolder, ItemAnimator.ItemHolderInfo itemHolderInfo, ItemAnimator.ItemHolderInfo itemHolderInfo2) {
RecyclerView.this.animateAppearance(viewHolder, itemHolderInfo, itemHolderInfo2);
}
@Override // androidx.recyclerview.widget.ViewInfoStore.ProcessCallback
public void processPersistent(ViewHolder viewHolder, @NonNull ItemAnimator.ItemHolderInfo itemHolderInfo, @NonNull ItemAnimator.ItemHolderInfo itemHolderInfo2) {
viewHolder.setIsRecyclable(false);
RecyclerView recyclerView = RecyclerView.this;
if (recyclerView.mDataSetHasChangedAfterLayout) {
if (recyclerView.mItemAnimator.animateChange(viewHolder, viewHolder, itemHolderInfo, itemHolderInfo2)) {
RecyclerView.this.postAnimationRunner();
}
} else if (recyclerView.mItemAnimator.animatePersistence(viewHolder, itemHolderInfo, itemHolderInfo2)) {
RecyclerView.this.postAnimationRunner();
}
}
@Override // androidx.recyclerview.widget.ViewInfoStore.ProcessCallback
public void unused(ViewHolder viewHolder) {
RecyclerView recyclerView = RecyclerView.this;
recyclerView.mLayout.removeAndRecycleView(viewHolder.itemView, recyclerView.mRecycler);
}
};
setScrollContainer(true);
setFocusableInTouchMode(true);
ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
this.mTouchSlop = viewConfiguration.getScaledTouchSlop();
this.mScaledHorizontalScrollFactor = ViewConfigurationCompat.getScaledHorizontalScrollFactor(viewConfiguration, context);
this.mScaledVerticalScrollFactor = ViewConfigurationCompat.getScaledVerticalScrollFactor(viewConfiguration, context);
this.mMinFlingVelocity = viewConfiguration.getScaledMinimumFlingVelocity();
this.mMaxFlingVelocity = viewConfiguration.getScaledMaximumFlingVelocity();
setWillNotDraw(getOverScrollMode() == 2);
this.mItemAnimator.setListener(this.mItemAnimatorListener);
initAdapterManager();
initChildrenHelper();
initAutofill();
if (ViewCompat.getImportantForAccessibility(this) == 0) {
ViewCompat.setImportantForAccessibility(this, 1);
}
this.mAccessibilityManager = (AccessibilityManager) getContext().getSystemService("accessibility");
setAccessibilityDelegateCompat(new RecyclerViewAccessibilityDelegate(this));
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, androidx.recyclerview.R.styleable.RecyclerView, i, 0);
ViewCompat.saveAttributeDataForStyleable(this, context, androidx.recyclerview.R.styleable.RecyclerView, attributeSet, obtainStyledAttributes, i, 0);
String string = obtainStyledAttributes.getString(androidx.recyclerview.R.styleable.RecyclerView_layoutManager);
if (obtainStyledAttributes.getInt(androidx.recyclerview.R.styleable.RecyclerView_android_descendantFocusability, -1) == -1) {
setDescendantFocusability(262144);
}
this.mClipToPadding = obtainStyledAttributes.getBoolean(androidx.recyclerview.R.styleable.RecyclerView_android_clipToPadding, true);
boolean z = obtainStyledAttributes.getBoolean(androidx.recyclerview.R.styleable.RecyclerView_fastScrollEnabled, false);
this.mEnableFastScroller = z;
if (z) {
initFastScroller((StateListDrawable) obtainStyledAttributes.getDrawable(androidx.recyclerview.R.styleable.RecyclerView_fastScrollVerticalThumbDrawable), obtainStyledAttributes.getDrawable(androidx.recyclerview.R.styleable.RecyclerView_fastScrollVerticalTrackDrawable), (StateListDrawable) obtainStyledAttributes.getDrawable(androidx.recyclerview.R.styleable.RecyclerView_fastScrollHorizontalThumbDrawable), obtainStyledAttributes.getDrawable(androidx.recyclerview.R.styleable.RecyclerView_fastScrollHorizontalTrackDrawable));
}
obtainStyledAttributes.recycle();
createLayoutManager(context, string, attributeSet, i, 0);
int[] iArr = NESTED_SCROLLING_ATTRS;
TypedArray obtainStyledAttributes2 = context.obtainStyledAttributes(attributeSet, iArr, i, 0);
ViewCompat.saveAttributeDataForStyleable(this, context, iArr, attributeSet, obtainStyledAttributes2, i, 0);
boolean z2 = obtainStyledAttributes2.getBoolean(0, true);
obtainStyledAttributes2.recycle();
setNestedScrollingEnabled(z2);
}
public String exceptionLabel() {
return " " + super.toString() + ", adapter:" + this.mAdapter + ", layout:" + this.mLayout + ", context:" + getContext();
}
@SuppressLint({"InlinedApi"})
private void initAutofill() {
if (ViewCompat.getImportantForAutofill(this) == 0) {
ViewCompat.setImportantForAutofill(this, 8);
}
}
public void setAccessibilityDelegateCompat(@Nullable RecyclerViewAccessibilityDelegate recyclerViewAccessibilityDelegate) {
this.mAccessibilityDelegate = recyclerViewAccessibilityDelegate;
ViewCompat.setAccessibilityDelegate(this, recyclerViewAccessibilityDelegate);
}
private void createLayoutManager(Context context, String str, AttributeSet attributeSet, int i, int i2) {
ClassLoader classLoader;
Constructor constructor;
Object[] objArr;
if (str != null) {
String trim = str.trim();
if (trim.isEmpty()) {
return;
}
String fullClassName = getFullClassName(context, trim);
try {
if (isInEditMode()) {
classLoader = getClass().getClassLoader();
} else {
classLoader = context.getClassLoader();
}
Class<? extends U> asSubclass = Class.forName(fullClassName, false, classLoader).asSubclass(LayoutManager.class);
try {
constructor = asSubclass.getConstructor(LAYOUT_MANAGER_CONSTRUCTOR_SIGNATURE);
objArr = new Object[]{context, attributeSet, Integer.valueOf(i), Integer.valueOf(i2)};
} catch (NoSuchMethodException e) {
try {
constructor = asSubclass.getConstructor(new Class[0]);
objArr = null;
} catch (NoSuchMethodException e2) {
e2.initCause(e);
throw new IllegalStateException(attributeSet.getPositionDescription() + ": Error creating LayoutManager " + fullClassName, e2);
}
}
constructor.setAccessible(true);
setLayoutManager((LayoutManager) constructor.newInstance(objArr));
} catch (ClassCastException e3) {
throw new IllegalStateException(attributeSet.getPositionDescription() + ": Class is not a LayoutManager " + fullClassName, e3);
} catch (ClassNotFoundException e4) {
throw new IllegalStateException(attributeSet.getPositionDescription() + ": Unable to find LayoutManager " + fullClassName, e4);
} catch (IllegalAccessException e5) {
throw new IllegalStateException(attributeSet.getPositionDescription() + ": Cannot access non-public constructor " + fullClassName, e5);
} catch (InstantiationException e6) {
throw new IllegalStateException(attributeSet.getPositionDescription() + ": Could not instantiate the LayoutManager: " + fullClassName, e6);
} catch (InvocationTargetException e7) {
throw new IllegalStateException(attributeSet.getPositionDescription() + ": Could not instantiate the LayoutManager: " + fullClassName, e7);
}
}
}
private String getFullClassName(Context context, String str) {
if (str.charAt(0) == '.') {
return context.getPackageName() + str;
}
if (str.contains(Consts.STRING_PERIOD)) {
return str;
}
return RecyclerView.class.getPackage().getName() + '.' + str;
}
private void initChildrenHelper() {
this.mChildHelper = new ChildHelper(new ChildHelper.Callback() { // from class: androidx.recyclerview.widget.RecyclerView.5
@Override // androidx.recyclerview.widget.ChildHelper.Callback
public int getChildCount() {
return RecyclerView.this.getChildCount();
}
@Override // androidx.recyclerview.widget.ChildHelper.Callback
public void addView(View view, int i) {
RecyclerView.this.addView(view, i);
RecyclerView.this.dispatchChildAttached(view);
}
@Override // androidx.recyclerview.widget.ChildHelper.Callback
public int indexOfChild(View view) {
return RecyclerView.this.indexOfChild(view);
}
@Override // androidx.recyclerview.widget.ChildHelper.Callback
public void removeViewAt(int i) {
View childAt = RecyclerView.this.getChildAt(i);
if (childAt != null) {
RecyclerView.this.dispatchChildDetached(childAt);
childAt.clearAnimation();
}
RecyclerView.this.removeViewAt(i);
}
@Override // androidx.recyclerview.widget.ChildHelper.Callback
public View getChildAt(int i) {
return RecyclerView.this.getChildAt(i);
}
@Override // androidx.recyclerview.widget.ChildHelper.Callback
public void removeAllViews() {
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
View childAt = getChildAt(i);
RecyclerView.this.dispatchChildDetached(childAt);
childAt.clearAnimation();
}
RecyclerView.this.removeAllViews();
}
@Override // androidx.recyclerview.widget.ChildHelper.Callback
public ViewHolder getChildViewHolder(View view) {
return RecyclerView.getChildViewHolderInt(view);
}
@Override // androidx.recyclerview.widget.ChildHelper.Callback
public void attachViewToParent(View view, int i, ViewGroup.LayoutParams layoutParams) {
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
if (childViewHolderInt != null) {
if (!childViewHolderInt.isTmpDetached() && !childViewHolderInt.shouldIgnore()) {
throw new IllegalArgumentException("Called attach on a child which is not detached: " + childViewHolderInt + RecyclerView.this.exceptionLabel());
}
childViewHolderInt.clearTmpDetachFlag();
}
RecyclerView.this.attachViewToParent(view, i, layoutParams);
}
@Override // androidx.recyclerview.widget.ChildHelper.Callback
public void detachViewFromParent(int i) {
ViewHolder childViewHolderInt;
View childAt = getChildAt(i);
if (childAt != null && (childViewHolderInt = RecyclerView.getChildViewHolderInt(childAt)) != null) {
if (childViewHolderInt.isTmpDetached() && !childViewHolderInt.shouldIgnore()) {
throw new IllegalArgumentException("called detach on an already detached child " + childViewHolderInt + RecyclerView.this.exceptionLabel());
}
childViewHolderInt.addFlags(256);
}
RecyclerView.this.detachViewFromParent(i);
}
@Override // androidx.recyclerview.widget.ChildHelper.Callback
public void onEnteredHiddenState(View view) {
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
if (childViewHolderInt != null) {
childViewHolderInt.onEnteredHiddenState(RecyclerView.this);
}
}
@Override // androidx.recyclerview.widget.ChildHelper.Callback
public void onLeftHiddenState(View view) {
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
if (childViewHolderInt != null) {
childViewHolderInt.onLeftHiddenState(RecyclerView.this);
}
}
});
}
public void initAdapterManager() {
this.mAdapterHelper = new AdapterHelper(new AdapterHelper.Callback() { // from class: androidx.recyclerview.widget.RecyclerView.6
@Override // androidx.recyclerview.widget.AdapterHelper.Callback
public ViewHolder findViewHolder(int i) {
ViewHolder findViewHolderForPosition = RecyclerView.this.findViewHolderForPosition(i, true);
if (findViewHolderForPosition == null || RecyclerView.this.mChildHelper.isHidden(findViewHolderForPosition.itemView)) {
return null;
}
return findViewHolderForPosition;
}
@Override // androidx.recyclerview.widget.AdapterHelper.Callback
public void offsetPositionsForRemovingInvisible(int i, int i2) {
RecyclerView.this.offsetPositionRecordsForRemove(i, i2, true);
RecyclerView recyclerView = RecyclerView.this;
recyclerView.mItemsAddedOrRemoved = true;
recyclerView.mState.mDeletedInvisibleItemCountSincePreviousLayout += i2;
}
@Override // androidx.recyclerview.widget.AdapterHelper.Callback
public void offsetPositionsForRemovingLaidOutOrNewView(int i, int i2) {
RecyclerView.this.offsetPositionRecordsForRemove(i, i2, false);
RecyclerView.this.mItemsAddedOrRemoved = true;
}
@Override // androidx.recyclerview.widget.AdapterHelper.Callback
public void markViewHoldersUpdated(int i, int i2, Object obj) {
RecyclerView.this.viewRangeUpdate(i, i2, obj);
RecyclerView.this.mItemsChanged = true;
}
@Override // androidx.recyclerview.widget.AdapterHelper.Callback
public void onDispatchFirstPass(AdapterHelper.UpdateOp updateOp) {
dispatchUpdate(updateOp);
}
public void dispatchUpdate(AdapterHelper.UpdateOp updateOp) {
int i = updateOp.cmd;
if (i == 1) {
RecyclerView recyclerView = RecyclerView.this;
recyclerView.mLayout.onItemsAdded(recyclerView, updateOp.positionStart, updateOp.itemCount);
return;
}
if (i == 2) {
RecyclerView recyclerView2 = RecyclerView.this;
recyclerView2.mLayout.onItemsRemoved(recyclerView2, updateOp.positionStart, updateOp.itemCount);
} else if (i == 4) {
RecyclerView recyclerView3 = RecyclerView.this;
recyclerView3.mLayout.onItemsUpdated(recyclerView3, updateOp.positionStart, updateOp.itemCount, updateOp.payload);
} else {
if (i != 8) {
return;
}
RecyclerView recyclerView4 = RecyclerView.this;
recyclerView4.mLayout.onItemsMoved(recyclerView4, updateOp.positionStart, updateOp.itemCount, 1);
}
}
@Override // androidx.recyclerview.widget.AdapterHelper.Callback
public void onDispatchSecondPass(AdapterHelper.UpdateOp updateOp) {
dispatchUpdate(updateOp);
}
@Override // androidx.recyclerview.widget.AdapterHelper.Callback
public void offsetPositionsForAdd(int i, int i2) {
RecyclerView.this.offsetPositionRecordsForInsert(i, i2);
RecyclerView.this.mItemsAddedOrRemoved = true;
}
@Override // androidx.recyclerview.widget.AdapterHelper.Callback
public void offsetPositionsForMove(int i, int i2) {
RecyclerView.this.offsetPositionRecordsForMove(i, i2);
RecyclerView.this.mItemsAddedOrRemoved = true;
}
});
}
@Override // android.view.ViewGroup
public void setClipToPadding(boolean z) {
if (z != this.mClipToPadding) {
invalidateGlows();
}
this.mClipToPadding = z;
super.setClipToPadding(z);
if (this.mFirstLayoutComplete) {
requestLayout();
}
}
public void setScrollingTouchSlop(int i) {
ViewConfiguration viewConfiguration = ViewConfiguration.get(getContext());
if (i != 0) {
if (i != 1) {
Log.w(TAG, "setScrollingTouchSlop(): bad argument constant " + i + "; using default value");
} else {
this.mTouchSlop = viewConfiguration.getScaledPagingTouchSlop();
return;
}
}
this.mTouchSlop = viewConfiguration.getScaledTouchSlop();
}
public void swapAdapter(@Nullable Adapter adapter, boolean z) {
setLayoutFrozen(false);
setAdapterInternal(adapter, true, z);
processDataSetCompletelyChanged(true);
requestLayout();
}
public void setAdapter(@Nullable Adapter adapter) {
setLayoutFrozen(false);
setAdapterInternal(adapter, false, true);
processDataSetCompletelyChanged(false);
requestLayout();
}
public void removeAndRecycleViews() {
ItemAnimator itemAnimator = this.mItemAnimator;
if (itemAnimator != null) {
itemAnimator.endAnimations();
}
LayoutManager layoutManager = this.mLayout;
if (layoutManager != null) {
layoutManager.removeAndRecycleAllViews(this.mRecycler);
this.mLayout.removeAndRecycleScrapInt(this.mRecycler);
}
this.mRecycler.clear();
}
private void setAdapterInternal(@Nullable Adapter adapter, boolean z, boolean z2) {
Adapter adapter2 = this.mAdapter;
if (adapter2 != null) {
adapter2.unregisterAdapterDataObserver(this.mObserver);
this.mAdapter.onDetachedFromRecyclerView(this);
}
if (!z || z2) {
removeAndRecycleViews();
}
this.mAdapterHelper.reset();
Adapter adapter3 = this.mAdapter;
this.mAdapter = adapter;
if (adapter != null) {
adapter.registerAdapterDataObserver(this.mObserver);
adapter.onAttachedToRecyclerView(this);
}
LayoutManager layoutManager = this.mLayout;
if (layoutManager != null) {
layoutManager.onAdapterChanged(adapter3, this.mAdapter);
}
this.mRecycler.onAdapterChanged(adapter3, this.mAdapter, z);
this.mState.mStructureChanged = true;
}
public void addRecyclerListener(@NonNull RecyclerListener recyclerListener) {
Preconditions.checkArgument(recyclerListener != null, "'listener' arg cannot be null.");
this.mRecyclerListeners.add(recyclerListener);
}
public void removeRecyclerListener(@NonNull RecyclerListener recyclerListener) {
this.mRecyclerListeners.remove(recyclerListener);
}
@Override // android.view.View
public int getBaseline() {
LayoutManager layoutManager = this.mLayout;
if (layoutManager != null) {
return layoutManager.getBaseline();
}
return super.getBaseline();
}
public void addOnChildAttachStateChangeListener(@NonNull OnChildAttachStateChangeListener onChildAttachStateChangeListener) {
if (this.mOnChildAttachStateListeners == null) {
this.mOnChildAttachStateListeners = new ArrayList();
}
this.mOnChildAttachStateListeners.add(onChildAttachStateChangeListener);
}
public void removeOnChildAttachStateChangeListener(@NonNull OnChildAttachStateChangeListener onChildAttachStateChangeListener) {
List<OnChildAttachStateChangeListener> list = this.mOnChildAttachStateListeners;
if (list == null) {
return;
}
list.remove(onChildAttachStateChangeListener);
}
public void clearOnChildAttachStateChangeListeners() {
List<OnChildAttachStateChangeListener> list = this.mOnChildAttachStateListeners;
if (list != null) {
list.clear();
}
}
public void setLayoutManager(@Nullable LayoutManager layoutManager) {
if (layoutManager == this.mLayout) {
return;
}
stopScroll();
if (this.mLayout != null) {
ItemAnimator itemAnimator = this.mItemAnimator;
if (itemAnimator != null) {
itemAnimator.endAnimations();
}
this.mLayout.removeAndRecycleAllViews(this.mRecycler);
this.mLayout.removeAndRecycleScrapInt(this.mRecycler);
this.mRecycler.clear();
if (this.mIsAttached) {
this.mLayout.dispatchDetachedFromWindow(this, this.mRecycler);
}
this.mLayout.setRecyclerView(null);
this.mLayout = null;
} else {
this.mRecycler.clear();
}
this.mChildHelper.removeAllViewsUnfiltered();
this.mLayout = layoutManager;
if (layoutManager != null) {
if (layoutManager.mRecyclerView != null) {
throw new IllegalArgumentException("LayoutManager " + layoutManager + " is already attached to a RecyclerView:" + layoutManager.mRecyclerView.exceptionLabel());
}
layoutManager.setRecyclerView(this);
if (this.mIsAttached) {
this.mLayout.dispatchAttachedToWindow(this);
}
}
this.mRecycler.updateViewCacheSize();
requestLayout();
}
@Override // android.view.View
public Parcelable onSaveInstanceState() {
SavedState savedState = new SavedState(super.onSaveInstanceState());
SavedState savedState2 = this.mPendingSavedState;
if (savedState2 != null) {
savedState.copyFrom(savedState2);
} else {
LayoutManager layoutManager = this.mLayout;
if (layoutManager != null) {
savedState.mLayoutState = layoutManager.onSaveInstanceState();
} else {
savedState.mLayoutState = null;
}
}
return savedState;
}
@Override // android.view.View
public void onRestoreInstanceState(Parcelable parcelable) {
if (!(parcelable instanceof SavedState)) {
super.onRestoreInstanceState(parcelable);
return;
}
SavedState savedState = (SavedState) parcelable;
this.mPendingSavedState = savedState;
super.onRestoreInstanceState(savedState.getSuperState());
requestLayout();
}
@Override // android.view.ViewGroup, android.view.View
public void dispatchSaveInstanceState(SparseArray<Parcelable> sparseArray) {
dispatchFreezeSelfOnly(sparseArray);
}
@Override // android.view.ViewGroup, android.view.View
public void dispatchRestoreInstanceState(SparseArray<Parcelable> sparseArray) {
dispatchThawSelfOnly(sparseArray);
}
private void addAnimatingView(ViewHolder viewHolder) {
View view = viewHolder.itemView;
boolean z = view.getParent() == this;
this.mRecycler.unscrapView(getChildViewHolder(view));
if (viewHolder.isTmpDetached()) {
this.mChildHelper.attachViewToParent(view, -1, view.getLayoutParams(), true);
} else if (!z) {
this.mChildHelper.addView(view, true);
} else {
this.mChildHelper.hide(view);
}
}
public boolean removeAnimatingView(View view) {
startInterceptRequestLayout();
boolean removeViewIfHidden = this.mChildHelper.removeViewIfHidden(view);
if (removeViewIfHidden) {
ViewHolder childViewHolderInt = getChildViewHolderInt(view);
this.mRecycler.unscrapView(childViewHolderInt);
this.mRecycler.recycleViewHolderInternal(childViewHolderInt);
}
stopInterceptRequestLayout(!removeViewIfHidden);
return removeViewIfHidden;
}
@NonNull
public RecycledViewPool getRecycledViewPool() {
return this.mRecycler.getRecycledViewPool();
}
public void setRecycledViewPool(@Nullable RecycledViewPool recycledViewPool) {
this.mRecycler.setRecycledViewPool(recycledViewPool);
}
public void setViewCacheExtension(@Nullable ViewCacheExtension viewCacheExtension) {
this.mRecycler.setViewCacheExtension(viewCacheExtension);
}
public void setItemViewCacheSize(int i) {
this.mRecycler.setViewCacheSize(i);
}
public void setScrollState(int i) {
if (i == this.mScrollState) {
return;
}
this.mScrollState = i;
if (i != 2) {
stopScrollersInternal();
}
dispatchOnScrollStateChanged(i);
}
public void addItemDecoration(@NonNull ItemDecoration itemDecoration, int i) {
LayoutManager layoutManager = this.mLayout;
if (layoutManager != null) {
layoutManager.assertNotInLayoutOrScroll("Cannot add item decoration during a scroll or layout");
}
if (this.mItemDecorations.isEmpty()) {
setWillNotDraw(false);
}
if (i < 0) {
this.mItemDecorations.add(itemDecoration);
} else {
this.mItemDecorations.add(i, itemDecoration);
}
markItemDecorInsetsDirty();
requestLayout();
}
public void addItemDecoration(@NonNull ItemDecoration itemDecoration) {
addItemDecoration(itemDecoration, -1);
}
@NonNull
public ItemDecoration getItemDecorationAt(int i) {
int itemDecorationCount = getItemDecorationCount();
if (i < 0 || i >= itemDecorationCount) {
throw new IndexOutOfBoundsException(i + " is an invalid index for size " + itemDecorationCount);
}
return this.mItemDecorations.get(i);
}
public int getItemDecorationCount() {
return this.mItemDecorations.size();
}
public void removeItemDecorationAt(int i) {
int itemDecorationCount = getItemDecorationCount();
if (i < 0 || i >= itemDecorationCount) {
throw new IndexOutOfBoundsException(i + " is an invalid index for size " + itemDecorationCount);
}
removeItemDecoration(getItemDecorationAt(i));
}
public void removeItemDecoration(@NonNull ItemDecoration itemDecoration) {
LayoutManager layoutManager = this.mLayout;
if (layoutManager != null) {
layoutManager.assertNotInLayoutOrScroll("Cannot remove item decoration during a scroll or layout");
}
this.mItemDecorations.remove(itemDecoration);
if (this.mItemDecorations.isEmpty()) {
setWillNotDraw(getOverScrollMode() == 2);
}
markItemDecorInsetsDirty();
requestLayout();
}
public void setChildDrawingOrderCallback(@Nullable ChildDrawingOrderCallback childDrawingOrderCallback) {
if (childDrawingOrderCallback == this.mChildDrawingOrderCallback) {
return;
}
this.mChildDrawingOrderCallback = childDrawingOrderCallback;
setChildrenDrawingOrderEnabled(childDrawingOrderCallback != null);
}
public void addOnScrollListener(@NonNull OnScrollListener onScrollListener) {
if (this.mScrollListeners == null) {
this.mScrollListeners = new ArrayList();
}
this.mScrollListeners.add(onScrollListener);
}
public void removeOnScrollListener(@NonNull OnScrollListener onScrollListener) {
List<OnScrollListener> list = this.mScrollListeners;
if (list != null) {
list.remove(onScrollListener);
}
}
public void clearOnScrollListeners() {
List<OnScrollListener> list = this.mScrollListeners;
if (list != null) {
list.clear();
}
}
public void scrollToPosition(int i) {
if (this.mLayoutSuppressed) {
return;
}
stopScroll();
LayoutManager layoutManager = this.mLayout;
if (layoutManager == null) {
Log.e(TAG, "Cannot scroll to position a LayoutManager set. Call setLayoutManager with a non-null argument.");
} else {
layoutManager.scrollToPosition(i);
awakenScrollBars();
}
}
public void jumpToPositionForSmoothScroller(int i) {
if (this.mLayout == null) {
return;
}
setScrollState(2);
this.mLayout.scrollToPosition(i);
awakenScrollBars();
}
public void smoothScrollToPosition(int i) {
if (this.mLayoutSuppressed) {
return;
}
LayoutManager layoutManager = this.mLayout;
if (layoutManager == null) {
Log.e(TAG, "Cannot smooth scroll without a LayoutManager set. Call setLayoutManager with a non-null argument.");
} else {
layoutManager.smoothScrollToPosition(this, this.mState, i);
}
}
@Override // android.view.View
public void scrollTo(int i, int i2) {
Log.w(TAG, "RecyclerView does not support scrolling to an absolute position. Use scrollToPosition instead");
}
@Override // android.view.View
public void scrollBy(int i, int i2) {
LayoutManager layoutManager = this.mLayout;
if (layoutManager == null) {
Log.e(TAG, "Cannot scroll without a LayoutManager set. Call setLayoutManager with a non-null argument.");
return;
}
if (this.mLayoutSuppressed) {
return;
}
boolean canScrollHorizontally = layoutManager.canScrollHorizontally();
boolean canScrollVertically = this.mLayout.canScrollVertically();
if (canScrollHorizontally || canScrollVertically) {
if (!canScrollHorizontally) {
i = 0;
}
if (!canScrollVertically) {
i2 = 0;
}
scrollByInternal(i, i2, null, 0);
}
}
public void nestedScrollBy(int i, int i2) {
nestedScrollByInternal(i, i2, null, 1);
}
private void nestedScrollByInternal(int i, int i2, @Nullable MotionEvent motionEvent, int i3) {
LayoutManager layoutManager = this.mLayout;
if (layoutManager == 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 canScrollHorizontally = layoutManager.canScrollHorizontally();
boolean canScrollVertically = this.mLayout.canScrollVertically();
startNestedScroll(canScrollVertically ? (canScrollHorizontally ? 1 : 0) | 2 : canScrollHorizontally ? 1 : 0, i3);
if (dispatchNestedPreScroll(canScrollHorizontally ? i : 0, canScrollVertically ? i2 : 0, this.mReusableIntPair, this.mScrollOffset, i3)) {
int[] iArr2 = this.mReusableIntPair;
i -= iArr2[0];
i2 -= iArr2[1];
}
scrollByInternal(canScrollHorizontally ? i : 0, canScrollVertically ? i2 : 0, motionEvent, i3);
GapWorker gapWorker = this.mGapWorker;
if (gapWorker != null && (i != 0 || i2 != 0)) {
gapWorker.postFromTraversal(this, i, i2);
}
stopNestedScroll(i3);
}
public void scrollStep(int i, int i2, @Nullable int[] iArr) {
startInterceptRequestLayout();
onEnterLayoutOrScroll();
TraceCompat.beginSection(TRACE_SCROLL_TAG);
fillRemainingScrollValues(this.mState);
int scrollHorizontallyBy = i != 0 ? this.mLayout.scrollHorizontallyBy(i, this.mRecycler, this.mState) : 0;
int scrollVerticallyBy = i2 != 0 ? this.mLayout.scrollVerticallyBy(i2, this.mRecycler, this.mState) : 0;
TraceCompat.endSection();
repositionShadowingViews();
onExitLayoutOrScroll();
stopInterceptRequestLayout(false);
if (iArr != null) {
iArr[0] = scrollHorizontallyBy;
iArr[1] = scrollVerticallyBy;
}
}
public void consumePendingUpdateOperations() {
if (!this.mFirstLayoutComplete || this.mDataSetHasChangedAfterLayout) {
TraceCompat.beginSection(TRACE_ON_DATA_SET_CHANGE_LAYOUT_TAG);
dispatchLayout();
TraceCompat.endSection();
return;
}
if (this.mAdapterHelper.hasPendingUpdates()) {
if (this.mAdapterHelper.hasAnyUpdateTypes(4) && !this.mAdapterHelper.hasAnyUpdateTypes(11)) {
TraceCompat.beginSection(TRACE_HANDLE_ADAPTER_UPDATES_TAG);
startInterceptRequestLayout();
onEnterLayoutOrScroll();
this.mAdapterHelper.preProcess();
if (!this.mLayoutWasDefered) {
if (hasUpdatedView()) {
dispatchLayout();
} else {
this.mAdapterHelper.consumePostponedUpdates();
}
}
stopInterceptRequestLayout(true);
onExitLayoutOrScroll();
TraceCompat.endSection();
return;
}
if (this.mAdapterHelper.hasPendingUpdates()) {
TraceCompat.beginSection(TRACE_ON_DATA_SET_CHANGE_LAYOUT_TAG);
dispatchLayout();
TraceCompat.endSection();
}
}
}
private boolean hasUpdatedView() {
int childCount = this.mChildHelper.getChildCount();
for (int i = 0; i < childCount; i++) {
ViewHolder childViewHolderInt = getChildViewHolderInt(this.mChildHelper.getChildAt(i));
if (childViewHolderInt != null && !childViewHolderInt.shouldIgnore() && childViewHolderInt.isUpdated()) {
return true;
}
}
return false;
}
public boolean scrollByInternal(int i, int i2, MotionEvent motionEvent, int i3) {
int i4;
int i5;
int i6;
int i7;
consumePendingUpdateOperations();
if (this.mAdapter != null) {
int[] iArr = this.mReusableIntPair;
iArr[0] = 0;
iArr[1] = 0;
scrollStep(i, i2, iArr);
int[] iArr2 = this.mReusableIntPair;
int i8 = iArr2[0];
int i9 = iArr2[1];
i4 = i9;
i5 = i8;
i6 = i - i8;
i7 = i2 - i9;
} else {
i4 = 0;
i5 = 0;
i6 = 0;
i7 = 0;
}
if (!this.mItemDecorations.isEmpty()) {
invalidate();
}
int[] iArr3 = this.mReusableIntPair;
iArr3[0] = 0;
iArr3[1] = 0;
dispatchNestedScroll(i5, i4, i6, i7, this.mScrollOffset, i3, iArr3);
int[] iArr4 = this.mReusableIntPair;
int i10 = iArr4[0];
int i11 = i6 - i10;
int i12 = iArr4[1];
int i13 = i7 - i12;
boolean z = (i10 == 0 && i12 == 0) ? false : true;
int i14 = this.mLastTouchX;
int[] iArr5 = this.mScrollOffset;
int i15 = iArr5[0];
this.mLastTouchX = i14 - i15;
int i16 = this.mLastTouchY;
int i17 = iArr5[1];
this.mLastTouchY = i16 - i17;
int[] iArr6 = this.mNestedOffsets;
iArr6[0] = iArr6[0] + i15;
iArr6[1] = iArr6[1] + i17;
if (getOverScrollMode() != 2) {
if (motionEvent != null && !MotionEventCompat.isFromSource(motionEvent, 8194)) {
pullGlows(motionEvent.getX(), i11, motionEvent.getY(), i13);
}
considerReleasingGlowsOnScroll(i, i2);
}
if (i5 != 0 || i4 != 0) {
dispatchOnScrolled(i5, i4);
}
if (!awakenScrollBars()) {
invalidate();
}
return (!z && i5 == 0 && i4 == 0) ? false : true;
}
@Override // android.view.View, androidx.core.view.ScrollingView
public int computeHorizontalScrollOffset() {
LayoutManager layoutManager = this.mLayout;
if (layoutManager != null && layoutManager.canScrollHorizontally()) {
return this.mLayout.computeHorizontalScrollOffset(this.mState);
}
return 0;
}
@Override // android.view.View, androidx.core.view.ScrollingView
public int computeHorizontalScrollExtent() {
LayoutManager layoutManager = this.mLayout;
if (layoutManager != null && layoutManager.canScrollHorizontally()) {
return this.mLayout.computeHorizontalScrollExtent(this.mState);
}
return 0;
}
@Override // android.view.View, androidx.core.view.ScrollingView
public int computeHorizontalScrollRange() {
LayoutManager layoutManager = this.mLayout;
if (layoutManager != null && layoutManager.canScrollHorizontally()) {
return this.mLayout.computeHorizontalScrollRange(this.mState);
}
return 0;
}
@Override // android.view.View, androidx.core.view.ScrollingView
public int computeVerticalScrollOffset() {
LayoutManager layoutManager = this.mLayout;
if (layoutManager != null && layoutManager.canScrollVertically()) {
return this.mLayout.computeVerticalScrollOffset(this.mState);
}
return 0;
}
@Override // android.view.View, androidx.core.view.ScrollingView
public int computeVerticalScrollExtent() {
LayoutManager layoutManager = this.mLayout;
if (layoutManager != null && layoutManager.canScrollVertically()) {
return this.mLayout.computeVerticalScrollExtent(this.mState);
}
return 0;
}
@Override // android.view.View, androidx.core.view.ScrollingView
public int computeVerticalScrollRange() {
LayoutManager layoutManager = this.mLayout;
if (layoutManager != null && layoutManager.canScrollVertically()) {
return this.mLayout.computeVerticalScrollRange(this.mState);
}
return 0;
}
public void stopInterceptRequestLayout(boolean z) {
if (this.mInterceptRequestLayoutDepth < 1) {
this.mInterceptRequestLayoutDepth = 1;
}
if (!z && !this.mLayoutSuppressed) {
this.mLayoutWasDefered = false;
}
if (this.mInterceptRequestLayoutDepth == 1) {
if (z && this.mLayoutWasDefered && !this.mLayoutSuppressed && this.mLayout != null && this.mAdapter != null) {
dispatchLayout();
}
if (!this.mLayoutSuppressed) {
this.mLayoutWasDefered = false;
}
}
this.mInterceptRequestLayoutDepth--;
}
@Override // android.view.ViewGroup
public final void suppressLayout(boolean z) {
if (z != this.mLayoutSuppressed) {
assertNotInLayoutOrScroll("Do not suppressLayout in layout or scroll");
if (z) {
long uptimeMillis = SystemClock.uptimeMillis();
onTouchEvent(MotionEvent.obtain(uptimeMillis, uptimeMillis, 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;
}
}
@Deprecated
public void setLayoutFrozen(boolean z) {
suppressLayout(z);
}
@Deprecated
public boolean isLayoutFrozen() {
return isLayoutSuppressed();
}
@Override // android.view.ViewGroup
@Deprecated
public void setLayoutTransition(LayoutTransition layoutTransition) {
if (layoutTransition == null) {
super.setLayoutTransition(null);
return;
}
throw new IllegalArgumentException("Providing a LayoutTransition into RecyclerView is not supported. Please use setItemAnimator() instead for animating changes to the items in this RecyclerView");
}
public void smoothScrollBy(@Px int i, @Px int i2) {
smoothScrollBy(i, i2, null);
}
public void smoothScrollBy(@Px int i, @Px int i2, @Nullable Interpolator interpolator) {
smoothScrollBy(i, i2, interpolator, Integer.MIN_VALUE);
}
public void smoothScrollBy(@Px int i, @Px int i2, @Nullable Interpolator interpolator, int i3) {
smoothScrollBy(i, i2, interpolator, i3, false);
}
public void smoothScrollBy(@Px int i, @Px int i2, @Nullable Interpolator interpolator, int i3, boolean z) {
LayoutManager layoutManager = this.mLayout;
if (layoutManager == null) {
Log.e(TAG, "Cannot smooth scroll without a LayoutManager set. Call setLayoutManager with a non-null argument.");
return;
}
if (this.mLayoutSuppressed) {
return;
}
if (!layoutManager.canScrollHorizontally()) {
i = 0;
}
if (!this.mLayout.canScrollVertically()) {
i2 = 0;
}
if (i == 0 && i2 == 0) {
return;
}
if (i3 == Integer.MIN_VALUE || i3 > 0) {
if (z) {
int i4 = i != 0 ? 1 : 0;
if (i2 != 0) {
i4 |= 2;
}
startNestedScroll(i4, 1);
}
this.mViewFlinger.smoothScrollBy(i, i2, i3, interpolator);
return;
}
scrollBy(i, i2);
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r0v1, types: [boolean] */
/* JADX WARN: Type inference failed for: r0v6 */
public boolean fling(int i, int i2) {
LayoutManager layoutManager = this.mLayout;
if (layoutManager == null) {
Log.e(TAG, "Cannot fling without a LayoutManager set. Call setLayoutManager with a non-null argument.");
return false;
}
if (this.mLayoutSuppressed) {
return false;
}
int canScrollHorizontally = layoutManager.canScrollHorizontally();
boolean canScrollVertically = this.mLayout.canScrollVertically();
if (canScrollHorizontally == 0 || Math.abs(i) < this.mMinFlingVelocity) {
i = 0;
}
if (!canScrollVertically || Math.abs(i2) < this.mMinFlingVelocity) {
i2 = 0;
}
if (i == 0 && i2 == 0) {
return false;
}
float f = i;
float f2 = i2;
if (!dispatchNestedPreFling(f, f2)) {
boolean z = canScrollHorizontally != 0 || canScrollVertically;
dispatchNestedFling(f, f2, z);
OnFlingListener onFlingListener = this.mOnFlingListener;
if (onFlingListener != null && onFlingListener.onFling(i, i2)) {
return true;
}
if (z) {
if (canScrollVertically) {
canScrollHorizontally = (canScrollHorizontally == true ? 1 : 0) | 2;
}
startNestedScroll(canScrollHorizontally, 1);
int i3 = this.mMaxFlingVelocity;
int max = Math.max(-i3, Math.min(i, i3));
int i4 = this.mMaxFlingVelocity;
this.mViewFlinger.fling(max, Math.max(-i4, Math.min(i2, i4)));
return true;
}
}
return false;
}
public void stopScroll() {
setScrollState(0);
stopScrollersInternal();
}
private void stopScrollersInternal() {
this.mViewFlinger.stop();
LayoutManager layoutManager = this.mLayout;
if (layoutManager != null) {
layoutManager.stopSmoothScroller();
}
}
private void pullGlows(float f, float f2, float f3, float f4) {
boolean z = true;
if (f2 < 0.0f) {
ensureLeftGlow();
EdgeEffectCompat.onPull(this.mLeftGlow, (-f2) / getWidth(), 1.0f - (f3 / getHeight()));
} else if (f2 > 0.0f) {
ensureRightGlow();
EdgeEffectCompat.onPull(this.mRightGlow, f2 / getWidth(), f3 / getHeight());
} else {
z = false;
}
if (f4 < 0.0f) {
ensureTopGlow();
EdgeEffectCompat.onPull(this.mTopGlow, (-f4) / getHeight(), f / getWidth());
} else if (f4 > 0.0f) {
ensureBottomGlow();
EdgeEffectCompat.onPull(this.mBottomGlow, f4 / getHeight(), 1.0f - (f / getWidth()));
} else if (!z && f2 == 0.0f && f4 == 0.0f) {
return;
}
ViewCompat.postInvalidateOnAnimation(this);
}
private void releaseGlows() {
boolean z;
EdgeEffect edgeEffect = this.mLeftGlow;
if (edgeEffect != null) {
edgeEffect.onRelease();
z = this.mLeftGlow.isFinished();
} else {
z = false;
}
EdgeEffect edgeEffect2 = this.mTopGlow;
if (edgeEffect2 != null) {
edgeEffect2.onRelease();
z |= this.mTopGlow.isFinished();
}
EdgeEffect edgeEffect3 = this.mRightGlow;
if (edgeEffect3 != null) {
edgeEffect3.onRelease();
z |= this.mRightGlow.isFinished();
}
EdgeEffect edgeEffect4 = this.mBottomGlow;
if (edgeEffect4 != null) {
edgeEffect4.onRelease();
z |= this.mBottomGlow.isFinished();
}
if (z) {
ViewCompat.postInvalidateOnAnimation(this);
}
}
public void considerReleasingGlowsOnScroll(int i, int i2) {
boolean z;
EdgeEffect edgeEffect = this.mLeftGlow;
if (edgeEffect == null || edgeEffect.isFinished() || i <= 0) {
z = false;
} else {
this.mLeftGlow.onRelease();
z = this.mLeftGlow.isFinished();
}
EdgeEffect edgeEffect2 = this.mRightGlow;
if (edgeEffect2 != null && !edgeEffect2.isFinished() && i < 0) {
this.mRightGlow.onRelease();
z |= this.mRightGlow.isFinished();
}
EdgeEffect edgeEffect3 = this.mTopGlow;
if (edgeEffect3 != null && !edgeEffect3.isFinished() && i2 > 0) {
this.mTopGlow.onRelease();
z |= this.mTopGlow.isFinished();
}
EdgeEffect edgeEffect4 = this.mBottomGlow;
if (edgeEffect4 != null && !edgeEffect4.isFinished() && i2 < 0) {
this.mBottomGlow.onRelease();
z |= this.mBottomGlow.isFinished();
}
if (z) {
ViewCompat.postInvalidateOnAnimation(this);
}
}
public void absorbGlows(int i, int i2) {
if (i < 0) {
ensureLeftGlow();
if (this.mLeftGlow.isFinished()) {
this.mLeftGlow.onAbsorb(-i);
}
} else if (i > 0) {
ensureRightGlow();
if (this.mRightGlow.isFinished()) {
this.mRightGlow.onAbsorb(i);
}
}
if (i2 < 0) {
ensureTopGlow();
if (this.mTopGlow.isFinished()) {
this.mTopGlow.onAbsorb(-i2);
}
} else if (i2 > 0) {
ensureBottomGlow();
if (this.mBottomGlow.isFinished()) {
this.mBottomGlow.onAbsorb(i2);
}
}
if (i == 0 && i2 == 0) {
return;
}
ViewCompat.postInvalidateOnAnimation(this);
}
public void ensureLeftGlow() {
if (this.mLeftGlow != null) {
return;
}
EdgeEffect createEdgeEffect = this.mEdgeEffectFactory.createEdgeEffect(this, 0);
this.mLeftGlow = createEdgeEffect;
if (this.mClipToPadding) {
createEdgeEffect.setSize((getMeasuredHeight() - getPaddingTop()) - getPaddingBottom(), (getMeasuredWidth() - getPaddingLeft()) - getPaddingRight());
} else {
createEdgeEffect.setSize(getMeasuredHeight(), getMeasuredWidth());
}
}
public void ensureRightGlow() {
if (this.mRightGlow != null) {
return;
}
EdgeEffect createEdgeEffect = this.mEdgeEffectFactory.createEdgeEffect(this, 2);
this.mRightGlow = createEdgeEffect;
if (this.mClipToPadding) {
createEdgeEffect.setSize((getMeasuredHeight() - getPaddingTop()) - getPaddingBottom(), (getMeasuredWidth() - getPaddingLeft()) - getPaddingRight());
} else {
createEdgeEffect.setSize(getMeasuredHeight(), getMeasuredWidth());
}
}
public void ensureTopGlow() {
if (this.mTopGlow != null) {
return;
}
EdgeEffect createEdgeEffect = this.mEdgeEffectFactory.createEdgeEffect(this, 1);
this.mTopGlow = createEdgeEffect;
if (this.mClipToPadding) {
createEdgeEffect.setSize((getMeasuredWidth() - getPaddingLeft()) - getPaddingRight(), (getMeasuredHeight() - getPaddingTop()) - getPaddingBottom());
} else {
createEdgeEffect.setSize(getMeasuredWidth(), getMeasuredHeight());
}
}
public void ensureBottomGlow() {
if (this.mBottomGlow != null) {
return;
}
EdgeEffect createEdgeEffect = this.mEdgeEffectFactory.createEdgeEffect(this, 3);
this.mBottomGlow = createEdgeEffect;
if (this.mClipToPadding) {
createEdgeEffect.setSize((getMeasuredWidth() - getPaddingLeft()) - getPaddingRight(), (getMeasuredHeight() - getPaddingTop()) - getPaddingBottom());
} else {
createEdgeEffect.setSize(getMeasuredWidth(), getMeasuredHeight());
}
}
public void setEdgeEffectFactory(@NonNull EdgeEffectFactory edgeEffectFactory) {
Preconditions.checkNotNull(edgeEffectFactory);
this.mEdgeEffectFactory = edgeEffectFactory;
invalidateGlows();
}
@Override // android.view.ViewGroup, android.view.ViewParent
public View focusSearch(View view, int i) {
View view2;
boolean z;
View onInterceptFocusSearch = this.mLayout.onInterceptFocusSearch(view, i);
if (onInterceptFocusSearch != null) {
return onInterceptFocusSearch;
}
boolean z2 = (this.mAdapter == null || this.mLayout == null || isComputingLayout() || this.mLayoutSuppressed) ? false : true;
FocusFinder focusFinder = FocusFinder.getInstance();
if (z2 && (i == 2 || i == 1)) {
if (this.mLayout.canScrollVertically()) {
int i2 = i == 2 ? 130 : 33;
z = focusFinder.findNextFocus(this, view, i2) == null;
if (FORCE_ABS_FOCUS_SEARCH_DIRECTION) {
i = i2;
}
} else {
z = false;
}
if (!z && this.mLayout.canScrollHorizontally()) {
int i3 = (this.mLayout.getLayoutDirection() == 1) ^ (i == 2) ? 66 : 17;
boolean z3 = focusFinder.findNextFocus(this, view, i3) == null;
if (FORCE_ABS_FOCUS_SEARCH_DIRECTION) {
i = i3;
}
z = z3;
}
if (z) {
consumePendingUpdateOperations();
if (findContainingItemView(view) == null) {
return null;
}
startInterceptRequestLayout();
this.mLayout.onFocusSearchFailed(view, i, this.mRecycler, this.mState);
stopInterceptRequestLayout(false);
}
view2 = focusFinder.findNextFocus(this, view, i);
} else {
View findNextFocus = focusFinder.findNextFocus(this, view, i);
if (findNextFocus == null && z2) {
consumePendingUpdateOperations();
if (findContainingItemView(view) == null) {
return null;
}
startInterceptRequestLayout();
view2 = this.mLayout.onFocusSearchFailed(view, i, this.mRecycler, this.mState);
stopInterceptRequestLayout(false);
} else {
view2 = findNextFocus;
}
}
if (view2 == null || view2.hasFocusable()) {
return isPreferredNextFocus(view, view2, i) ? view2 : super.focusSearch(view, i);
}
if (getFocusedChild() == null) {
return super.focusSearch(view, i);
}
requestChildOnScreen(view2, null);
return view;
}
private boolean isPreferredNextFocus(View view, View view2, int i) {
int i2;
if (view2 == null || view2 == this || view2 == view || findContainingItemView(view2) == null) {
return false;
}
if (view == null || findContainingItemView(view) == null) {
return true;
}
this.mTempRect.set(0, 0, view.getWidth(), view.getHeight());
this.mTempRect2.set(0, 0, view2.getWidth(), view2.getHeight());
offsetDescendantRectToMyCoords(view, this.mTempRect);
offsetDescendantRectToMyCoords(view2, this.mTempRect2);
char c = 65535;
int i3 = this.mLayout.getLayoutDirection() == 1 ? -1 : 1;
Rect rect = this.mTempRect;
int i4 = rect.left;
Rect rect2 = this.mTempRect2;
int i5 = rect2.left;
if ((i4 < i5 || rect.right <= i5) && rect.right < rect2.right) {
i2 = 1;
} else {
int i6 = rect.right;
int i7 = rect2.right;
i2 = ((i6 > i7 || i4 >= i7) && i4 > i5) ? -1 : 0;
}
int i8 = rect.top;
int i9 = rect2.top;
if ((i8 < i9 || rect.bottom <= i9) && rect.bottom < rect2.bottom) {
c = 1;
} else {
int i10 = rect.bottom;
int i11 = rect2.bottom;
if ((i10 <= i11 && i8 < i11) || i8 <= i9) {
c = 0;
}
}
if (i == 1) {
return c < 0 || (c == 0 && i2 * i3 < 0);
}
if (i == 2) {
return c > 0 || (c == 0 && i2 * i3 > 0);
}
if (i == 17) {
return i2 < 0;
}
if (i == 33) {
return c < 0;
}
if (i == 66) {
return i2 > 0;
}
if (i == 130) {
return c > 0;
}
throw new IllegalArgumentException("Invalid direction: " + i + exceptionLabel());
}
@Override // android.view.ViewGroup, android.view.ViewParent
public void requestChildFocus(View view, View view2) {
if (!this.mLayout.onRequestChildFocus(this, this.mState, view, view2) && view2 != null) {
requestChildOnScreen(view, view2);
}
super.requestChildFocus(view, view2);
}
private void requestChildOnScreen(@NonNull View view, @Nullable View view2) {
View view3 = view2 != null ? view2 : view;
this.mTempRect.set(0, 0, view3.getWidth(), view3.getHeight());
ViewGroup.LayoutParams layoutParams = view3.getLayoutParams();
if (layoutParams instanceof LayoutParams) {
LayoutParams layoutParams2 = (LayoutParams) layoutParams;
if (!layoutParams2.mInsetsDirty) {
Rect rect = layoutParams2.mDecorInsets;
Rect rect2 = this.mTempRect;
rect2.left -= rect.left;
rect2.right += rect.right;
rect2.top -= rect.top;
rect2.bottom += rect.bottom;
}
}
if (view2 != null) {
offsetDescendantRectToMyCoords(view2, this.mTempRect);
offsetRectIntoDescendantCoords(view, this.mTempRect);
}
this.mLayout.requestChildRectangleOnScreen(this, view, this.mTempRect, !this.mFirstLayoutComplete, view2 == null);
}
@Override // android.view.ViewGroup, android.view.ViewParent
public boolean requestChildRectangleOnScreen(View view, Rect rect, boolean z) {
return this.mLayout.requestChildRectangleOnScreen(this, view, rect, z);
}
@Override // android.view.ViewGroup, android.view.View
public void addFocusables(ArrayList<View> arrayList, int i, int i2) {
LayoutManager layoutManager = this.mLayout;
if (layoutManager == null || !layoutManager.onAddFocusables(this, arrayList, i, i2)) {
super.addFocusables(arrayList, i, i2);
}
}
@Override // android.view.ViewGroup
public boolean onRequestFocusInDescendants(int i, Rect rect) {
if (isComputingLayout()) {
return false;
}
return super.onRequestFocusInDescendants(i, rect);
}
/* JADX WARN: Code restructure failed: missing block: B:16:0x004b, code lost:
if (r1 >= 30.0f) goto L22;
*/
@Override // android.view.ViewGroup, android.view.View
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void onAttachedToWindow() {
/*
r5 = this;
super.onAttachedToWindow()
r0 = 0
r5.mLayoutOrScrollCounter = r0
r1 = 1
r5.mIsAttached = r1
boolean r2 = r5.mFirstLayoutComplete
if (r2 == 0) goto L14
boolean r2 = r5.isLayoutRequested()
if (r2 != 0) goto L14
goto L15
L14:
r1 = r0
L15:
r5.mFirstLayoutComplete = r1
androidx.recyclerview.widget.RecyclerView$LayoutManager r1 = r5.mLayout
if (r1 == 0) goto L1e
r1.dispatchAttachedToWindow(r5)
L1e:
r5.mPostedAnimatorRunner = r0
boolean r0 = androidx.recyclerview.widget.RecyclerView.ALLOW_THREAD_GAP_WORK
if (r0 == 0) goto L61
java.lang.ThreadLocal<androidx.recyclerview.widget.GapWorker> r0 = androidx.recyclerview.widget.GapWorker.sGapWorker
java.lang.Object r1 = r0.get()
androidx.recyclerview.widget.GapWorker r1 = (androidx.recyclerview.widget.GapWorker) r1
r5.mGapWorker = r1
if (r1 != 0) goto L5c
androidx.recyclerview.widget.GapWorker r1 = new androidx.recyclerview.widget.GapWorker
r1.<init>()
r5.mGapWorker = r1
android.view.Display r1 = androidx.core.view.ViewCompat.getDisplay(r5)
boolean r2 = r5.isInEditMode()
if (r2 != 0) goto L4e
if (r1 == 0) goto L4e
float r1 = r1.getRefreshRate()
r2 = 1106247680(0x41f00000, float:30.0)
int r2 = (r1 > r2 ? 1 : (r1 == r2 ? 0 : -1))
if (r2 < 0) goto L4e
goto L50
L4e:
r1 = 1114636288(0x42700000, float:60.0)
L50:
androidx.recyclerview.widget.GapWorker r2 = r5.mGapWorker
r3 = 1315859240(0x4e6e6b28, float:1.0E9)
float r3 = r3 / r1
long r3 = (long) r3
r2.mFrameIntervalNs = r3
r0.set(r2)
L5c:
androidx.recyclerview.widget.GapWorker r0 = r5.mGapWorker
r0.add(r5)
L61:
return
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.recyclerview.widget.RecyclerView.onAttachedToWindow():void");
}
@Override // android.view.ViewGroup, android.view.View
public void onDetachedFromWindow() {
GapWorker gapWorker;
super.onDetachedFromWindow();
ItemAnimator itemAnimator = this.mItemAnimator;
if (itemAnimator != null) {
itemAnimator.endAnimations();
}
stopScroll();
this.mIsAttached = false;
LayoutManager layoutManager = this.mLayout;
if (layoutManager != null) {
layoutManager.dispatchDetachedFromWindow(this, this.mRecycler);
}
this.mPendingAccessibilityImportanceChange.clear();
removeCallbacks(this.mItemAnimatorRunner);
this.mViewInfoStore.onDetach();
if (!ALLOW_THREAD_GAP_WORK || (gapWorker = this.mGapWorker) == null) {
return;
}
gapWorker.remove(this);
this.mGapWorker = null;
}
public void assertInLayoutOrScroll(String str) {
if (isComputingLayout()) {
return;
}
if (str == null) {
throw new IllegalStateException("Cannot call this method unless RecyclerView is computing a layout or scrolling" + exceptionLabel());
}
throw new IllegalStateException(str + exceptionLabel());
}
public void assertNotInLayoutOrScroll(String str) {
if (isComputingLayout()) {
if (str == null) {
throw new IllegalStateException("Cannot call this method while RecyclerView is computing a layout or scrolling" + exceptionLabel());
}
throw new IllegalStateException(str);
}
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("" + exceptionLabel()));
}
}
public void addOnItemTouchListener(@NonNull OnItemTouchListener onItemTouchListener) {
this.mOnItemTouchListeners.add(onItemTouchListener);
}
public void removeOnItemTouchListener(@NonNull OnItemTouchListener onItemTouchListener) {
this.mOnItemTouchListeners.remove(onItemTouchListener);
if (this.mInterceptingOnItemTouchListener == onItemTouchListener) {
this.mInterceptingOnItemTouchListener = null;
}
}
private boolean dispatchToOnItemTouchListeners(MotionEvent motionEvent) {
OnItemTouchListener onItemTouchListener = this.mInterceptingOnItemTouchListener;
if (onItemTouchListener == null) {
if (motionEvent.getAction() == 0) {
return false;
}
return findInterceptingOnItemTouchListener(motionEvent);
}
onItemTouchListener.onTouchEvent(this, motionEvent);
int action = motionEvent.getAction();
if (action == 3 || action == 1) {
this.mInterceptingOnItemTouchListener = null;
}
return true;
}
private boolean findInterceptingOnItemTouchListener(MotionEvent motionEvent) {
int action = motionEvent.getAction();
int size = this.mOnItemTouchListeners.size();
for (int i = 0; i < size; i++) {
OnItemTouchListener onItemTouchListener = this.mOnItemTouchListeners.get(i);
if (onItemTouchListener.onInterceptTouchEvent(this, motionEvent) && action != 3) {
this.mInterceptingOnItemTouchListener = onItemTouchListener;
return true;
}
}
return false;
}
/* JADX WARN: Code restructure failed: missing block: B:49:0x00ce, code lost:
if (r0 != false) goto L46;
*/
/* JADX WARN: Multi-variable type inference failed */
@Override // android.view.ViewGroup
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public boolean onInterceptTouchEvent(android.view.MotionEvent r9) {
/*
Method dump skipped, instructions count: 289
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.recyclerview.widget.RecyclerView.onInterceptTouchEvent(android.view.MotionEvent):boolean");
}
@Override // android.view.ViewGroup, android.view.ViewParent
public void requestDisallowInterceptTouchEvent(boolean z) {
int size = this.mOnItemTouchListeners.size();
for (int i = 0; i < size; i++) {
this.mOnItemTouchListeners.get(i).onRequestDisallowInterceptTouchEvent(z);
}
super.requestDisallowInterceptTouchEvent(z);
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Removed duplicated region for block: B:48:0x00e2 */
/* JADX WARN: Removed duplicated region for block: B:54:0x00f8 */
@Override // android.view.View
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public boolean onTouchEvent(android.view.MotionEvent r18) {
/*
Method dump skipped, instructions count: 477
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.recyclerview.widget.RecyclerView.onTouchEvent(android.view.MotionEvent):boolean");
}
private void resetScroll() {
VelocityTracker velocityTracker = this.mVelocityTracker;
if (velocityTracker != null) {
velocityTracker.clear();
}
stopNestedScroll(0);
releaseGlows();
}
private void cancelScroll() {
resetScroll();
setScrollState(0);
}
private void onPointerUp(MotionEvent motionEvent) {
int actionIndex = motionEvent.getActionIndex();
if (motionEvent.getPointerId(actionIndex) == this.mScrollPointerId) {
int i = actionIndex == 0 ? 1 : 0;
this.mScrollPointerId = motionEvent.getPointerId(i);
int x = (int) (motionEvent.getX(i) + 0.5f);
this.mLastTouchX = x;
this.mInitialTouchX = x;
int y = (int) (motionEvent.getY(i) + 0.5f);
this.mLastTouchY = y;
this.mInitialTouchY = y;
}
}
/* JADX WARN: Removed duplicated region for block: B:20:0x0068 */
@Override // android.view.View
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public boolean onGenericMotionEvent(android.view.MotionEvent r6) {
/*
r5 = this;
androidx.recyclerview.widget.RecyclerView$LayoutManager r0 = r5.mLayout
r1 = 0
if (r0 != 0) goto L6
return r1
L6:
boolean r0 = r5.mLayoutSuppressed
if (r0 == 0) goto Lb
return r1
Lb:
int r0 = r6.getAction()
r2 = 8
if (r0 != r2) goto L78
int r0 = r6.getSource()
r0 = r0 & 2
r2 = 0
if (r0 == 0) goto L3e
androidx.recyclerview.widget.RecyclerView$LayoutManager r0 = r5.mLayout
boolean r0 = r0.canScrollVertically()
if (r0 == 0) goto L2c
r0 = 9
float r0 = r6.getAxisValue(r0)
float r0 = -r0
goto L2d
L2c:
r0 = r2
L2d:
androidx.recyclerview.widget.RecyclerView$LayoutManager r3 = r5.mLayout
boolean r3 = r3.canScrollHorizontally()
if (r3 == 0) goto L3c
r3 = 10
float r3 = r6.getAxisValue(r3)
goto L64
L3c:
r3 = r2
goto L64
L3e:
int r0 = r6.getSource()
r3 = 4194304(0x400000, float:5.877472E-39)
r0 = r0 & r3
if (r0 == 0) goto L62
r0 = 26
float r0 = r6.getAxisValue(r0)
androidx.recyclerview.widget.RecyclerView$LayoutManager r3 = r5.mLayout
boolean r3 = r3.canScrollVertically()
if (r3 == 0) goto L57
float r0 = -r0
goto L3c
L57:
androidx.recyclerview.widget.RecyclerView$LayoutManager r3 = r5.mLayout
boolean r3 = r3.canScrollHorizontally()
if (r3 == 0) goto L62
r3 = r0
r0 = r2
goto L64
L62:
r0 = r2
r3 = r0
L64:
int r4 = (r0 > r2 ? 1 : (r0 == r2 ? 0 : -1))
if (r4 != 0) goto L6c
int r2 = (r3 > r2 ? 1 : (r3 == r2 ? 0 : -1))
if (r2 == 0) goto L78
L6c:
float r2 = r5.mScaledHorizontalScrollFactor
float r3 = r3 * r2
int r2 = (int) r3
float r3 = r5.mScaledVerticalScrollFactor
float r0 = r0 * r3
int r0 = (int) r0
r3 = 1
r5.nestedScrollByInternal(r2, r0, r6, r3)
L78:
return r1
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.recyclerview.widget.RecyclerView.onGenericMotionEvent(android.view.MotionEvent):boolean");
}
@Override // android.view.View
public void onMeasure(int i, int i2) {
LayoutManager layoutManager = this.mLayout;
if (layoutManager == null) {
defaultOnMeasure(i, i2);
return;
}
boolean z = false;
if (layoutManager.isAutoMeasureEnabled()) {
int mode = View.MeasureSpec.getMode(i);
int mode2 = View.MeasureSpec.getMode(i2);
this.mLayout.onMeasure(this.mRecycler, this.mState, i, i2);
if (mode == 1073741824 && mode2 == 1073741824) {
z = true;
}
this.mLastAutoMeasureSkippedDueToExact = z;
if (z || this.mAdapter == null) {
return;
}
if (this.mState.mLayoutStep == 1) {
dispatchLayoutStep1();
}
this.mLayout.setMeasureSpecs(i, i2);
this.mState.mIsMeasuring = true;
dispatchLayoutStep2();
this.mLayout.setMeasuredDimensionFromChildren(i, i2);
if (this.mLayout.shouldMeasureTwice()) {
this.mLayout.setMeasureSpecs(View.MeasureSpec.makeMeasureSpec(getMeasuredWidth(), 1073741824), View.MeasureSpec.makeMeasureSpec(getMeasuredHeight(), 1073741824));
this.mState.mIsMeasuring = true;
dispatchLayoutStep2();
this.mLayout.setMeasuredDimensionFromChildren(i, i2);
}
this.mLastAutoMeasureNonExactMeasuredWidth = getMeasuredWidth();
this.mLastAutoMeasureNonExactMeasuredHeight = getMeasuredHeight();
return;
}
if (this.mHasFixedSize) {
this.mLayout.onMeasure(this.mRecycler, this.mState, i, i2);
return;
}
if (this.mAdapterUpdateDuringMeasure) {
startInterceptRequestLayout();
onEnterLayoutOrScroll();
processAdapterUpdatesAndSetAnimationFlags();
onExitLayoutOrScroll();
State state = this.mState;
if (state.mRunPredictiveAnimations) {
state.mInPreLayout = true;
} else {
this.mAdapterHelper.consumeUpdatesInOnePass();
this.mState.mInPreLayout = false;
}
this.mAdapterUpdateDuringMeasure = false;
stopInterceptRequestLayout(false);
} else if (this.mState.mRunPredictiveAnimations) {
setMeasuredDimension(getMeasuredWidth(), getMeasuredHeight());
return;
}
Adapter adapter = this.mAdapter;
if (adapter != null) {
this.mState.mItemCount = adapter.getItemCount();
} else {
this.mState.mItemCount = 0;
}
startInterceptRequestLayout();
this.mLayout.onMeasure(this.mRecycler, this.mState, i, i2);
stopInterceptRequestLayout(false);
this.mState.mInPreLayout = false;
}
public void defaultOnMeasure(int i, int i2) {
setMeasuredDimension(LayoutManager.chooseSize(i, getPaddingLeft() + getPaddingRight(), ViewCompat.getMinimumWidth(this)), LayoutManager.chooseSize(i2, getPaddingTop() + getPaddingBottom(), ViewCompat.getMinimumHeight(this)));
}
@Override // android.view.View
public void onSizeChanged(int i, int i2, int i3, int i4) {
super.onSizeChanged(i, i2, i3, i4);
if (i == i3 && i2 == i4) {
return;
}
invalidateGlows();
}
public void setItemAnimator(@Nullable ItemAnimator itemAnimator) {
ItemAnimator itemAnimator2 = this.mItemAnimator;
if (itemAnimator2 != null) {
itemAnimator2.endAnimations();
this.mItemAnimator.setListener(null);
}
this.mItemAnimator = itemAnimator;
if (itemAnimator != null) {
itemAnimator.setListener(this.mItemAnimatorListener);
}
}
public void onExitLayoutOrScroll() {
onExitLayoutOrScroll(true);
}
public void onExitLayoutOrScroll(boolean z) {
int i = this.mLayoutOrScrollCounter - 1;
this.mLayoutOrScrollCounter = i;
if (i < 1) {
this.mLayoutOrScrollCounter = 0;
if (z) {
dispatchContentChangedIfNecessary();
dispatchPendingImportantForAccessibilityChanges();
}
}
}
public boolean isAccessibilityEnabled() {
AccessibilityManager accessibilityManager = this.mAccessibilityManager;
return accessibilityManager != null && accessibilityManager.isEnabled();
}
private void dispatchContentChangedIfNecessary() {
int i = this.mEatenAccessibilityChangeFlags;
this.mEatenAccessibilityChangeFlags = 0;
if (i == 0 || !isAccessibilityEnabled()) {
return;
}
AccessibilityEvent obtain = AccessibilityEvent.obtain();
obtain.setEventType(2048);
AccessibilityEventCompat.setContentChangeTypes(obtain, i);
sendAccessibilityEventUnchecked(obtain);
}
public boolean shouldDeferAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
if (!isComputingLayout()) {
return false;
}
int contentChangeTypes = accessibilityEvent != null ? AccessibilityEventCompat.getContentChangeTypes(accessibilityEvent) : 0;
this.mEatenAccessibilityChangeFlags |= contentChangeTypes != 0 ? contentChangeTypes : 0;
return true;
}
@Override // android.view.View, android.view.accessibility.AccessibilityEventSource
public void sendAccessibilityEventUnchecked(AccessibilityEvent accessibilityEvent) {
if (shouldDeferAccessibilityEvent(accessibilityEvent)) {
return;
}
super.sendAccessibilityEventUnchecked(accessibilityEvent);
}
@Override // android.view.View
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
onPopulateAccessibilityEvent(accessibilityEvent);
return true;
}
public void postAnimationRunner() {
if (this.mPostedAnimatorRunner || !this.mIsAttached) {
return;
}
ViewCompat.postOnAnimation(this, this.mItemAnimatorRunner);
this.mPostedAnimatorRunner = true;
}
private boolean predictiveItemAnimationsEnabled() {
return this.mItemAnimator != null && this.mLayout.supportsPredictiveItemAnimations();
}
private void processAdapterUpdatesAndSetAnimationFlags() {
boolean z;
if (this.mDataSetHasChangedAfterLayout) {
this.mAdapterHelper.reset();
if (this.mDispatchItemsChangedEvent) {
this.mLayout.onItemsChanged(this);
}
}
if (predictiveItemAnimationsEnabled()) {
this.mAdapterHelper.preProcess();
} else {
this.mAdapterHelper.consumeUpdatesInOnePass();
}
boolean z2 = this.mItemsAddedOrRemoved || this.mItemsChanged;
this.mState.mRunSimpleAnimations = this.mFirstLayoutComplete && this.mItemAnimator != null && ((z = this.mDataSetHasChangedAfterLayout) || z2 || this.mLayout.mRequestedSimpleAnimations) && (!z || this.mAdapter.hasStableIds());
State state = this.mState;
state.mRunPredictiveAnimations = state.mRunSimpleAnimations && z2 && !this.mDataSetHasChangedAfterLayout && predictiveItemAnimationsEnabled();
}
public void dispatchLayout() {
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.mIsMeasuring = false;
boolean z = this.mLastAutoMeasureSkippedDueToExact && !(this.mLastAutoMeasureNonExactMeasuredWidth == getWidth() && this.mLastAutoMeasureNonExactMeasuredHeight == getHeight());
this.mLastAutoMeasureNonExactMeasuredWidth = 0;
this.mLastAutoMeasureNonExactMeasuredHeight = 0;
this.mLastAutoMeasureSkippedDueToExact = false;
if (this.mState.mLayoutStep == 1) {
dispatchLayoutStep1();
this.mLayout.setExactMeasureSpecsFrom(this);
dispatchLayoutStep2();
} else if (this.mAdapterHelper.hasUpdates() || z || this.mLayout.getWidth() != getWidth() || this.mLayout.getHeight() != getHeight()) {
this.mLayout.setExactMeasureSpecsFrom(this);
dispatchLayoutStep2();
} else {
this.mLayout.setExactMeasureSpecsFrom(this);
}
dispatchLayoutStep3();
}
private void saveFocusInfo() {
int absoluteAdapterPosition;
View focusedChild = (this.mPreserveFocusAfterLayout && hasFocus() && this.mAdapter != null) ? getFocusedChild() : null;
ViewHolder findContainingViewHolder = focusedChild != null ? findContainingViewHolder(focusedChild) : null;
if (findContainingViewHolder == null) {
resetFocusInfo();
return;
}
this.mState.mFocusedItemId = this.mAdapter.hasStableIds() ? findContainingViewHolder.getItemId() : -1L;
State state = this.mState;
if (this.mDataSetHasChangedAfterLayout) {
absoluteAdapterPosition = -1;
} else {
absoluteAdapterPosition = findContainingViewHolder.isRemoved() ? findContainingViewHolder.mOldPosition : findContainingViewHolder.getAbsoluteAdapterPosition();
}
state.mFocusedItemPosition = absoluteAdapterPosition;
this.mState.mFocusedSubChildId = getDeepestFocusedViewWithId(findContainingViewHolder.itemView);
}
private void resetFocusInfo() {
State state = this.mState;
state.mFocusedItemId = -1L;
state.mFocusedItemPosition = -1;
state.mFocusedSubChildId = -1;
}
@Nullable
private View findNextViewToFocus() {
ViewHolder findViewHolderForAdapterPosition;
State state = this.mState;
int i = state.mFocusedItemPosition;
if (i == -1) {
i = 0;
}
int itemCount = state.getItemCount();
for (int i2 = i; i2 < itemCount; i2++) {
ViewHolder findViewHolderForAdapterPosition2 = findViewHolderForAdapterPosition(i2);
if (findViewHolderForAdapterPosition2 == null) {
break;
}
if (findViewHolderForAdapterPosition2.itemView.hasFocusable()) {
return findViewHolderForAdapterPosition2.itemView;
}
}
int min = Math.min(itemCount, i);
do {
min--;
if (min < 0 || (findViewHolderForAdapterPosition = findViewHolderForAdapterPosition(min)) == null) {
return null;
}
} while (!findViewHolderForAdapterPosition.itemView.hasFocusable());
return findViewHolderForAdapterPosition.itemView;
}
private void recoverFocusFromState() {
View findViewById;
if (!this.mPreserveFocusAfterLayout || this.mAdapter == null || !hasFocus() || getDescendantFocusability() == 393216) {
return;
}
if (getDescendantFocusability() == 131072 && isFocused()) {
return;
}
if (!isFocused()) {
View focusedChild = getFocusedChild();
if (IGNORE_DETACHED_FOCUSED_CHILD && (focusedChild.getParent() == null || !focusedChild.hasFocus())) {
if (this.mChildHelper.getChildCount() == 0) {
requestFocus();
return;
}
} else if (!this.mChildHelper.isHidden(focusedChild)) {
return;
}
}
View view = null;
ViewHolder findViewHolderForItemId = (this.mState.mFocusedItemId == -1 || !this.mAdapter.hasStableIds()) ? null : findViewHolderForItemId(this.mState.mFocusedItemId);
if (findViewHolderForItemId == null || this.mChildHelper.isHidden(findViewHolderForItemId.itemView) || !findViewHolderForItemId.itemView.hasFocusable()) {
if (this.mChildHelper.getChildCount() > 0) {
view = findNextViewToFocus();
}
} else {
view = findViewHolderForItemId.itemView;
}
if (view != null) {
int i = this.mState.mFocusedSubChildId;
if (i != -1 && (findViewById = view.findViewById(i)) != null && findViewById.isFocusable()) {
view = findViewById;
}
view.requestFocus();
}
}
private int getDeepestFocusedViewWithId(View view) {
int id = view.getId();
while (!view.isFocused() && (view instanceof ViewGroup) && view.hasFocus()) {
view = ((ViewGroup) view).getFocusedChild();
if (view.getId() != -1) {
id = view.getId();
}
}
return id;
}
public final void fillRemainingScrollValues(State state) {
if (getScrollState() == 2) {
OverScroller overScroller = this.mViewFlinger.mOverScroller;
state.mRemainingScrollHorizontal = overScroller.getFinalX() - overScroller.getCurrX();
state.mRemainingScrollVertical = overScroller.getFinalY() - overScroller.getCurrY();
} else {
state.mRemainingScrollHorizontal = 0;
state.mRemainingScrollVertical = 0;
}
}
private void dispatchLayoutStep1() {
this.mState.assertLayoutStep(1);
fillRemainingScrollValues(this.mState);
this.mState.mIsMeasuring = false;
startInterceptRequestLayout();
this.mViewInfoStore.clear();
onEnterLayoutOrScroll();
processAdapterUpdatesAndSetAnimationFlags();
saveFocusInfo();
State state = this.mState;
state.mTrackOldChangeHolders = state.mRunSimpleAnimations && this.mItemsChanged;
this.mItemsChanged = false;
this.mItemsAddedOrRemoved = false;
state.mInPreLayout = state.mRunPredictiveAnimations;
state.mItemCount = this.mAdapter.getItemCount();
findMinMaxChildLayoutPositions(this.mMinMaxLayoutPositions);
if (this.mState.mRunSimpleAnimations) {
int childCount = this.mChildHelper.getChildCount();
for (int i = 0; i < childCount; i++) {
ViewHolder childViewHolderInt = getChildViewHolderInt(this.mChildHelper.getChildAt(i));
if (!childViewHolderInt.shouldIgnore() && (!childViewHolderInt.isInvalid() || this.mAdapter.hasStableIds())) {
this.mViewInfoStore.addToPreLayout(childViewHolderInt, this.mItemAnimator.recordPreLayoutInformation(this.mState, childViewHolderInt, ItemAnimator.buildAdapterChangeFlagsForAnimations(childViewHolderInt), childViewHolderInt.getUnmodifiedPayloads()));
if (this.mState.mTrackOldChangeHolders && childViewHolderInt.isUpdated() && !childViewHolderInt.isRemoved() && !childViewHolderInt.shouldIgnore() && !childViewHolderInt.isInvalid()) {
this.mViewInfoStore.addToOldChangeHolders(getChangedHolderKey(childViewHolderInt), childViewHolderInt);
}
}
}
}
if (this.mState.mRunPredictiveAnimations) {
saveOldPositions();
State state2 = this.mState;
boolean z = state2.mStructureChanged;
state2.mStructureChanged = false;
this.mLayout.onLayoutChildren(this.mRecycler, state2);
this.mState.mStructureChanged = z;
for (int i2 = 0; i2 < this.mChildHelper.getChildCount(); i2++) {
ViewHolder childViewHolderInt2 = getChildViewHolderInt(this.mChildHelper.getChildAt(i2));
if (!childViewHolderInt2.shouldIgnore() && !this.mViewInfoStore.isInPreLayout(childViewHolderInt2)) {
int buildAdapterChangeFlagsForAnimations = ItemAnimator.buildAdapterChangeFlagsForAnimations(childViewHolderInt2);
boolean hasAnyOfTheFlags = childViewHolderInt2.hasAnyOfTheFlags(8192);
if (!hasAnyOfTheFlags) {
buildAdapterChangeFlagsForAnimations |= 4096;
}
ItemAnimator.ItemHolderInfo recordPreLayoutInformation = this.mItemAnimator.recordPreLayoutInformation(this.mState, childViewHolderInt2, buildAdapterChangeFlagsForAnimations, childViewHolderInt2.getUnmodifiedPayloads());
if (hasAnyOfTheFlags) {
recordAnimationInfoIfBouncedHiddenView(childViewHolderInt2, recordPreLayoutInformation);
} else {
this.mViewInfoStore.addToAppearedInPreLayoutHolders(childViewHolderInt2, recordPreLayoutInformation);
}
}
}
clearOldPositions();
} else {
clearOldPositions();
}
onExitLayoutOrScroll();
stopInterceptRequestLayout(false);
this.mState.mLayoutStep = 2;
}
private void dispatchLayoutStep2() {
startInterceptRequestLayout();
onEnterLayoutOrScroll();
this.mState.assertLayoutStep(6);
this.mAdapterHelper.consumeUpdatesInOnePass();
this.mState.mItemCount = this.mAdapter.getItemCount();
this.mState.mDeletedInvisibleItemCountSincePreviousLayout = 0;
if (this.mPendingSavedState != null && this.mAdapter.canRestoreState()) {
Parcelable parcelable = this.mPendingSavedState.mLayoutState;
if (parcelable != null) {
this.mLayout.onRestoreInstanceState(parcelable);
}
this.mPendingSavedState = null;
}
State state = this.mState;
state.mInPreLayout = false;
this.mLayout.onLayoutChildren(this.mRecycler, state);
State state2 = this.mState;
state2.mStructureChanged = false;
state2.mRunSimpleAnimations = state2.mRunSimpleAnimations && this.mItemAnimator != null;
state2.mLayoutStep = 4;
onExitLayoutOrScroll();
stopInterceptRequestLayout(false);
}
private void dispatchLayoutStep3() {
this.mState.assertLayoutStep(4);
startInterceptRequestLayout();
onEnterLayoutOrScroll();
State state = this.mState;
state.mLayoutStep = 1;
if (state.mRunSimpleAnimations) {
for (int childCount = this.mChildHelper.getChildCount() - 1; childCount >= 0; childCount--) {
ViewHolder childViewHolderInt = getChildViewHolderInt(this.mChildHelper.getChildAt(childCount));
if (!childViewHolderInt.shouldIgnore()) {
long changedHolderKey = getChangedHolderKey(childViewHolderInt);
ItemAnimator.ItemHolderInfo recordPostLayoutInformation = this.mItemAnimator.recordPostLayoutInformation(this.mState, childViewHolderInt);
ViewHolder fromOldChangeHolders = this.mViewInfoStore.getFromOldChangeHolders(changedHolderKey);
if (fromOldChangeHolders != null && !fromOldChangeHolders.shouldIgnore()) {
boolean isDisappearing = this.mViewInfoStore.isDisappearing(fromOldChangeHolders);
boolean isDisappearing2 = this.mViewInfoStore.isDisappearing(childViewHolderInt);
if (isDisappearing && fromOldChangeHolders == childViewHolderInt) {
this.mViewInfoStore.addToPostLayout(childViewHolderInt, recordPostLayoutInformation);
} else {
ItemAnimator.ItemHolderInfo popFromPreLayout = this.mViewInfoStore.popFromPreLayout(fromOldChangeHolders);
this.mViewInfoStore.addToPostLayout(childViewHolderInt, recordPostLayoutInformation);
ItemAnimator.ItemHolderInfo popFromPostLayout = this.mViewInfoStore.popFromPostLayout(childViewHolderInt);
if (popFromPreLayout == null) {
handleMissingPreInfoForChangeError(changedHolderKey, childViewHolderInt, fromOldChangeHolders);
} else {
animateChange(fromOldChangeHolders, childViewHolderInt, popFromPreLayout, popFromPostLayout, isDisappearing, isDisappearing2);
}
}
} else {
this.mViewInfoStore.addToPostLayout(childViewHolderInt, recordPostLayoutInformation);
}
}
}
this.mViewInfoStore.process(this.mViewInfoProcessCallback);
}
this.mLayout.removeAndRecycleScrapInt(this.mRecycler);
State state2 = this.mState;
state2.mPreviousLayoutItemCount = state2.mItemCount;
this.mDataSetHasChangedAfterLayout = false;
this.mDispatchItemsChangedEvent = false;
state2.mRunSimpleAnimations = false;
state2.mRunPredictiveAnimations = false;
this.mLayout.mRequestedSimpleAnimations = false;
ArrayList<ViewHolder> arrayList = this.mRecycler.mChangedScrap;
if (arrayList != null) {
arrayList.clear();
}
LayoutManager layoutManager = this.mLayout;
if (layoutManager.mPrefetchMaxObservedInInitialPrefetch) {
layoutManager.mPrefetchMaxCountObserved = 0;
layoutManager.mPrefetchMaxObservedInInitialPrefetch = false;
this.mRecycler.updateViewCacheSize();
}
this.mLayout.onLayoutCompleted(this.mState);
onExitLayoutOrScroll();
stopInterceptRequestLayout(false);
this.mViewInfoStore.clear();
int[] iArr = this.mMinMaxLayoutPositions;
if (didChildRangeChange(iArr[0], iArr[1])) {
dispatchOnScrolled(0, 0);
}
recoverFocusFromState();
resetFocusInfo();
}
private void handleMissingPreInfoForChangeError(long j, ViewHolder viewHolder, ViewHolder viewHolder2) {
int childCount = this.mChildHelper.getChildCount();
for (int i = 0; i < childCount; i++) {
ViewHolder childViewHolderInt = getChildViewHolderInt(this.mChildHelper.getChildAt(i));
if (childViewHolderInt != viewHolder && getChangedHolderKey(childViewHolderInt) == j) {
Adapter adapter = this.mAdapter;
if (adapter != null && adapter.hasStableIds()) {
throw new IllegalStateException("Two different ViewHolders have the same stable ID. Stable IDs in your adapter MUST BE unique and SHOULD NOT change.\n ViewHolder 1:" + childViewHolderInt + " \n View Holder 2:" + viewHolder + exceptionLabel());
}
throw new IllegalStateException("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:" + childViewHolderInt + " \n View Holder 2:" + viewHolder + exceptionLabel());
}
}
Log.e(TAG, "Problem while matching changed view holders with the newones. The pre-layout information for the change holder " + viewHolder2 + " cannot be found but it is necessary for " + viewHolder + exceptionLabel());
}
public void recordAnimationInfoIfBouncedHiddenView(ViewHolder viewHolder, ItemAnimator.ItemHolderInfo itemHolderInfo) {
viewHolder.setFlags(0, 8192);
if (this.mState.mTrackOldChangeHolders && viewHolder.isUpdated() && !viewHolder.isRemoved() && !viewHolder.shouldIgnore()) {
this.mViewInfoStore.addToOldChangeHolders(getChangedHolderKey(viewHolder), viewHolder);
}
this.mViewInfoStore.addToPreLayout(viewHolder, itemHolderInfo);
}
private void findMinMaxChildLayoutPositions(int[] iArr) {
int childCount = this.mChildHelper.getChildCount();
if (childCount == 0) {
iArr[0] = -1;
iArr[1] = -1;
return;
}
int i = Integer.MAX_VALUE;
int i2 = Integer.MIN_VALUE;
for (int i3 = 0; i3 < childCount; i3++) {
ViewHolder childViewHolderInt = getChildViewHolderInt(this.mChildHelper.getChildAt(i3));
if (!childViewHolderInt.shouldIgnore()) {
int layoutPosition = childViewHolderInt.getLayoutPosition();
if (layoutPosition < i) {
i = layoutPosition;
}
if (layoutPosition > i2) {
i2 = layoutPosition;
}
}
}
iArr[0] = i;
iArr[1] = i2;
}
private boolean didChildRangeChange(int i, int i2) {
findMinMaxChildLayoutPositions(this.mMinMaxLayoutPositions);
int[] iArr = this.mMinMaxLayoutPositions;
return (iArr[0] == i && iArr[1] == i2) ? false : true;
}
@Override // android.view.ViewGroup
public void removeDetachedView(View view, boolean z) {
ViewHolder childViewHolderInt = getChildViewHolderInt(view);
if (childViewHolderInt != null) {
if (childViewHolderInt.isTmpDetached()) {
childViewHolderInt.clearTmpDetachFlag();
} else if (!childViewHolderInt.shouldIgnore()) {
throw new IllegalArgumentException("Called removeDetachedView with a view which is not flagged as tmp detached." + childViewHolderInt + exceptionLabel());
}
}
view.clearAnimation();
dispatchChildDetached(view);
super.removeDetachedView(view, z);
}
public long getChangedHolderKey(ViewHolder viewHolder) {
return this.mAdapter.hasStableIds() ? viewHolder.getItemId() : viewHolder.mPosition;
}
public void animateAppearance(@NonNull ViewHolder viewHolder, @Nullable ItemAnimator.ItemHolderInfo itemHolderInfo, @NonNull ItemAnimator.ItemHolderInfo itemHolderInfo2) {
viewHolder.setIsRecyclable(false);
if (this.mItemAnimator.animateAppearance(viewHolder, itemHolderInfo, itemHolderInfo2)) {
postAnimationRunner();
}
}
public void animateDisappearance(@NonNull ViewHolder viewHolder, @NonNull ItemAnimator.ItemHolderInfo itemHolderInfo, @Nullable ItemAnimator.ItemHolderInfo itemHolderInfo2) {
addAnimatingView(viewHolder);
viewHolder.setIsRecyclable(false);
if (this.mItemAnimator.animateDisappearance(viewHolder, itemHolderInfo, itemHolderInfo2)) {
postAnimationRunner();
}
}
private void animateChange(@NonNull ViewHolder viewHolder, @NonNull ViewHolder viewHolder2, @NonNull ItemAnimator.ItemHolderInfo itemHolderInfo, @NonNull ItemAnimator.ItemHolderInfo itemHolderInfo2, boolean z, boolean z2) {
viewHolder.setIsRecyclable(false);
if (z) {
addAnimatingView(viewHolder);
}
if (viewHolder != viewHolder2) {
if (z2) {
addAnimatingView(viewHolder2);
}
viewHolder.mShadowedHolder = viewHolder2;
addAnimatingView(viewHolder);
this.mRecycler.unscrapView(viewHolder);
viewHolder2.setIsRecyclable(false);
viewHolder2.mShadowingHolder = viewHolder;
}
if (this.mItemAnimator.animateChange(viewHolder, viewHolder2, itemHolderInfo, itemHolderInfo2)) {
postAnimationRunner();
}
}
@Override // android.view.ViewGroup, android.view.View
public void onLayout(boolean z, int i, int i2, int i3, int i4) {
TraceCompat.beginSection(TRACE_ON_LAYOUT_TAG);
dispatchLayout();
TraceCompat.endSection();
this.mFirstLayoutComplete = true;
}
@Override // android.view.View, android.view.ViewParent
public void requestLayout() {
if (this.mInterceptRequestLayoutDepth != 0 || this.mLayoutSuppressed) {
this.mLayoutWasDefered = true;
} else {
super.requestLayout();
}
}
public void markItemDecorInsetsDirty() {
int unfilteredChildCount = this.mChildHelper.getUnfilteredChildCount();
for (int i = 0; i < unfilteredChildCount; i++) {
((LayoutParams) this.mChildHelper.getUnfilteredChildAt(i).getLayoutParams()).mInsetsDirty = true;
}
this.mRecycler.markItemDecorInsetsDirty();
}
@Override // android.view.View
public void draw(Canvas canvas) {
boolean z;
super.draw(canvas);
int size = this.mItemDecorations.size();
boolean z2 = false;
for (int i = 0; i < size; i++) {
this.mItemDecorations.get(i).onDrawOver(canvas, this, this.mState);
}
EdgeEffect edgeEffect = this.mLeftGlow;
if (edgeEffect == null || edgeEffect.isFinished()) {
z = false;
} else {
int save = canvas.save();
int paddingBottom = this.mClipToPadding ? getPaddingBottom() : 0;
canvas.rotate(270.0f);
canvas.translate((-getHeight()) + paddingBottom, 0.0f);
EdgeEffect edgeEffect2 = this.mLeftGlow;
z = edgeEffect2 != null && edgeEffect2.draw(canvas);
canvas.restoreToCount(save);
}
EdgeEffect edgeEffect3 = this.mTopGlow;
if (edgeEffect3 != null && !edgeEffect3.isFinished()) {
int save2 = canvas.save();
if (this.mClipToPadding) {
canvas.translate(getPaddingLeft(), getPaddingTop());
}
EdgeEffect edgeEffect4 = this.mTopGlow;
z |= edgeEffect4 != null && edgeEffect4.draw(canvas);
canvas.restoreToCount(save2);
}
EdgeEffect edgeEffect5 = this.mRightGlow;
if (edgeEffect5 != null && !edgeEffect5.isFinished()) {
int save3 = canvas.save();
int width = getWidth();
int paddingTop = this.mClipToPadding ? getPaddingTop() : 0;
canvas.rotate(90.0f);
canvas.translate(paddingTop, -width);
EdgeEffect edgeEffect6 = this.mRightGlow;
z |= edgeEffect6 != null && edgeEffect6.draw(canvas);
canvas.restoreToCount(save3);
}
EdgeEffect edgeEffect7 = this.mBottomGlow;
if (edgeEffect7 != null && !edgeEffect7.isFinished()) {
int save4 = canvas.save();
canvas.rotate(180.0f);
if (this.mClipToPadding) {
canvas.translate((-getWidth()) + getPaddingRight(), (-getHeight()) + getPaddingBottom());
} else {
canvas.translate(-getWidth(), -getHeight());
}
EdgeEffect edgeEffect8 = this.mBottomGlow;
if (edgeEffect8 != null && edgeEffect8.draw(canvas)) {
z2 = true;
}
z |= z2;
canvas.restoreToCount(save4);
}
if ((z || this.mItemAnimator == null || this.mItemDecorations.size() <= 0 || !this.mItemAnimator.isRunning()) && !z) {
return;
}
ViewCompat.postInvalidateOnAnimation(this);
}
@Override // android.view.View
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
int size = this.mItemDecorations.size();
for (int i = 0; i < size; i++) {
this.mItemDecorations.get(i).onDraw(canvas, this, this.mState);
}
}
@Override // android.view.ViewGroup
public boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
return (layoutParams instanceof LayoutParams) && this.mLayout.checkLayoutParams((LayoutParams) layoutParams);
}
@Override // android.view.ViewGroup
public ViewGroup.LayoutParams generateDefaultLayoutParams() {
LayoutManager layoutManager = this.mLayout;
if (layoutManager == null) {
throw new IllegalStateException("RecyclerView has no LayoutManager" + exceptionLabel());
}
return layoutManager.generateDefaultLayoutParams();
}
@Override // android.view.ViewGroup
public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
LayoutManager layoutManager = this.mLayout;
if (layoutManager == null) {
throw new IllegalStateException("RecyclerView has no LayoutManager" + exceptionLabel());
}
return layoutManager.generateLayoutParams(getContext(), attributeSet);
}
@Override // android.view.ViewGroup
public ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
LayoutManager layoutManager = this.mLayout;
if (layoutManager == null) {
throw new IllegalStateException("RecyclerView has no LayoutManager" + exceptionLabel());
}
return layoutManager.generateLayoutParams(layoutParams);
}
public boolean isAnimating() {
ItemAnimator itemAnimator = this.mItemAnimator;
return itemAnimator != null && itemAnimator.isRunning();
}
public void saveOldPositions() {
int unfilteredChildCount = this.mChildHelper.getUnfilteredChildCount();
for (int i = 0; i < unfilteredChildCount; i++) {
ViewHolder childViewHolderInt = getChildViewHolderInt(this.mChildHelper.getUnfilteredChildAt(i));
if (!childViewHolderInt.shouldIgnore()) {
childViewHolderInt.saveOldPosition();
}
}
}
public void clearOldPositions() {
int unfilteredChildCount = this.mChildHelper.getUnfilteredChildCount();
for (int i = 0; i < unfilteredChildCount; i++) {
ViewHolder childViewHolderInt = getChildViewHolderInt(this.mChildHelper.getUnfilteredChildAt(i));
if (!childViewHolderInt.shouldIgnore()) {
childViewHolderInt.clearOldPosition();
}
}
this.mRecycler.clearOldPositions();
}
public void offsetPositionRecordsForMove(int i, int i2) {
int i3;
int i4;
int i5;
int i6;
int unfilteredChildCount = this.mChildHelper.getUnfilteredChildCount();
if (i < i2) {
i5 = -1;
i4 = i;
i3 = i2;
} else {
i3 = i;
i4 = i2;
i5 = 1;
}
for (int i7 = 0; i7 < unfilteredChildCount; i7++) {
ViewHolder childViewHolderInt = getChildViewHolderInt(this.mChildHelper.getUnfilteredChildAt(i7));
if (childViewHolderInt != null && (i6 = childViewHolderInt.mPosition) >= i4 && i6 <= i3) {
if (i6 == i) {
childViewHolderInt.offsetPosition(i2 - i, false);
} else {
childViewHolderInt.offsetPosition(i5, false);
}
this.mState.mStructureChanged = true;
}
}
this.mRecycler.offsetPositionRecordsForMove(i, i2);
requestLayout();
}
public void offsetPositionRecordsForInsert(int i, int i2) {
int unfilteredChildCount = this.mChildHelper.getUnfilteredChildCount();
for (int i3 = 0; i3 < unfilteredChildCount; i3++) {
ViewHolder childViewHolderInt = getChildViewHolderInt(this.mChildHelper.getUnfilteredChildAt(i3));
if (childViewHolderInt != null && !childViewHolderInt.shouldIgnore() && childViewHolderInt.mPosition >= i) {
childViewHolderInt.offsetPosition(i2, false);
this.mState.mStructureChanged = true;
}
}
this.mRecycler.offsetPositionRecordsForInsert(i, i2);
requestLayout();
}
public void offsetPositionRecordsForRemove(int i, int i2, boolean z) {
int i3 = i + i2;
int unfilteredChildCount = this.mChildHelper.getUnfilteredChildCount();
for (int i4 = 0; i4 < unfilteredChildCount; i4++) {
ViewHolder childViewHolderInt = getChildViewHolderInt(this.mChildHelper.getUnfilteredChildAt(i4));
if (childViewHolderInt != null && !childViewHolderInt.shouldIgnore()) {
int i5 = childViewHolderInt.mPosition;
if (i5 >= i3) {
childViewHolderInt.offsetPosition(-i2, z);
this.mState.mStructureChanged = true;
} else if (i5 >= i) {
childViewHolderInt.flagRemovedAndOffsetPosition(i - 1, -i2, z);
this.mState.mStructureChanged = true;
}
}
}
this.mRecycler.offsetPositionRecordsForRemove(i, i2, z);
requestLayout();
}
public void viewRangeUpdate(int i, int i2, Object obj) {
int i3;
int unfilteredChildCount = this.mChildHelper.getUnfilteredChildCount();
int i4 = i + i2;
for (int i5 = 0; i5 < unfilteredChildCount; i5++) {
View unfilteredChildAt = this.mChildHelper.getUnfilteredChildAt(i5);
ViewHolder childViewHolderInt = getChildViewHolderInt(unfilteredChildAt);
if (childViewHolderInt != null && !childViewHolderInt.shouldIgnore() && (i3 = childViewHolderInt.mPosition) >= i && i3 < i4) {
childViewHolderInt.addFlags(2);
childViewHolderInt.addChangePayload(obj);
((LayoutParams) unfilteredChildAt.getLayoutParams()).mInsetsDirty = true;
}
}
this.mRecycler.viewRangeUpdate(i, i2);
}
public boolean canReuseUpdatedViewHolder(ViewHolder viewHolder) {
ItemAnimator itemAnimator = this.mItemAnimator;
return itemAnimator == null || itemAnimator.canReuseUpdatedViewHolder(viewHolder, viewHolder.getUnmodifiedPayloads());
}
public void processDataSetCompletelyChanged(boolean z) {
this.mDispatchItemsChangedEvent = z | this.mDispatchItemsChangedEvent;
this.mDataSetHasChangedAfterLayout = true;
markKnownViewsInvalid();
}
public void markKnownViewsInvalid() {
int unfilteredChildCount = this.mChildHelper.getUnfilteredChildCount();
for (int i = 0; i < unfilteredChildCount; i++) {
ViewHolder childViewHolderInt = getChildViewHolderInt(this.mChildHelper.getUnfilteredChildAt(i));
if (childViewHolderInt != null && !childViewHolderInt.shouldIgnore()) {
childViewHolderInt.addFlags(6);
}
}
markItemDecorInsetsDirty();
this.mRecycler.markKnownViewsInvalid();
}
public void invalidateItemDecorations() {
if (this.mItemDecorations.size() == 0) {
return;
}
LayoutManager layoutManager = this.mLayout;
if (layoutManager != null) {
layoutManager.assertNotInLayoutOrScroll("Cannot invalidate item decorations during a scroll or layout");
}
markItemDecorInsetsDirty();
requestLayout();
}
public ViewHolder getChildViewHolder(@NonNull View view) {
ViewParent parent = view.getParent();
if (parent != null && parent != this) {
throw new IllegalArgumentException("View " + view + " is not a direct child of " + this);
}
return getChildViewHolderInt(view);
}
/* JADX WARN: Code restructure failed: missing block: B:11:?, code lost:
return r3;
*/
@androidx.annotation.Nullable
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public android.view.View findContainingItemView(@androidx.annotation.NonNull android.view.View r3) {
/*
r2 = this;
android.view.ViewParent r0 = r3.getParent()
L4:
if (r0 == 0) goto L14
if (r0 == r2) goto L14
boolean r1 = r0 instanceof android.view.View
if (r1 == 0) goto L14
r3 = r0
android.view.View r3 = (android.view.View) r3
android.view.ViewParent r0 = r3.getParent()
goto L4
L14:
if (r0 != r2) goto L17
goto L18
L17:
r3 = 0
L18:
return r3
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.recyclerview.widget.RecyclerView.findContainingItemView(android.view.View):android.view.View");
}
@Nullable
public ViewHolder findContainingViewHolder(@NonNull View view) {
View findContainingItemView = findContainingItemView(view);
if (findContainingItemView == null) {
return null;
}
return getChildViewHolder(findContainingItemView);
}
public static ViewHolder getChildViewHolderInt(View view) {
if (view == null) {
return null;
}
return ((LayoutParams) view.getLayoutParams()).mViewHolder;
}
@Deprecated
public int getChildPosition(@NonNull View view) {
return getChildAdapterPosition(view);
}
public int getChildAdapterPosition(@NonNull View view) {
ViewHolder childViewHolderInt = getChildViewHolderInt(view);
if (childViewHolderInt != null) {
return childViewHolderInt.getAbsoluteAdapterPosition();
}
return -1;
}
public int getChildLayoutPosition(@NonNull View view) {
ViewHolder childViewHolderInt = getChildViewHolderInt(view);
if (childViewHolderInt != null) {
return childViewHolderInt.getLayoutPosition();
}
return -1;
}
public long getChildItemId(@NonNull View view) {
ViewHolder childViewHolderInt;
Adapter adapter = this.mAdapter;
if (adapter == null || !adapter.hasStableIds() || (childViewHolderInt = getChildViewHolderInt(view)) == null) {
return -1L;
}
return childViewHolderInt.getItemId();
}
@Nullable
@Deprecated
public ViewHolder findViewHolderForPosition(int i) {
return findViewHolderForPosition(i, false);
}
@Nullable
public ViewHolder findViewHolderForLayoutPosition(int i) {
return findViewHolderForPosition(i, false);
}
@Nullable
public ViewHolder findViewHolderForAdapterPosition(int i) {
ViewHolder viewHolder = null;
if (this.mDataSetHasChangedAfterLayout) {
return null;
}
int unfilteredChildCount = this.mChildHelper.getUnfilteredChildCount();
for (int i2 = 0; i2 < unfilteredChildCount; i2++) {
ViewHolder childViewHolderInt = getChildViewHolderInt(this.mChildHelper.getUnfilteredChildAt(i2));
if (childViewHolderInt != null && !childViewHolderInt.isRemoved() && getAdapterPositionInRecyclerView(childViewHolderInt) == i) {
if (!this.mChildHelper.isHidden(childViewHolderInt.itemView)) {
return childViewHolderInt;
}
viewHolder = childViewHolderInt;
}
}
return viewHolder;
}
/* JADX WARN: Removed duplicated region for block: B:12:0x0034 */
/* JADX WARN: Removed duplicated region for block: B:15:0x0036 A[SYNTHETIC] */
@androidx.annotation.Nullable
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public androidx.recyclerview.widget.RecyclerView.ViewHolder findViewHolderForPosition(int r6, boolean r7) {
/*
r5 = this;
androidx.recyclerview.widget.ChildHelper r0 = r5.mChildHelper
int r0 = r0.getUnfilteredChildCount()
r1 = 0
r2 = 0
L8:
if (r2 >= r0) goto L3a
androidx.recyclerview.widget.ChildHelper r3 = r5.mChildHelper
android.view.View r3 = r3.getUnfilteredChildAt(r2)
androidx.recyclerview.widget.RecyclerView$ViewHolder r3 = getChildViewHolderInt(r3)
if (r3 == 0) goto L37
boolean r4 = r3.isRemoved()
if (r4 != 0) goto L37
if (r7 == 0) goto L23
int r4 = r3.mPosition
if (r4 == r6) goto L2a
goto L37
L23:
int r4 = r3.getLayoutPosition()
if (r4 == r6) goto L2a
goto L37
L2a:
androidx.recyclerview.widget.ChildHelper r1 = r5.mChildHelper
android.view.View r4 = r3.itemView
boolean r1 = r1.isHidden(r4)
if (r1 == 0) goto L36
r1 = r3
goto L37
L36:
return r3
L37:
int r2 = r2 + 1
goto L8
L3a:
return r1
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.recyclerview.widget.RecyclerView.findViewHolderForPosition(int, boolean):androidx.recyclerview.widget.RecyclerView$ViewHolder");
}
public ViewHolder findViewHolderForItemId(long j) {
Adapter adapter = this.mAdapter;
ViewHolder viewHolder = null;
if (adapter != null && adapter.hasStableIds()) {
int unfilteredChildCount = this.mChildHelper.getUnfilteredChildCount();
for (int i = 0; i < unfilteredChildCount; i++) {
ViewHolder childViewHolderInt = getChildViewHolderInt(this.mChildHelper.getUnfilteredChildAt(i));
if (childViewHolderInt != null && !childViewHolderInt.isRemoved() && childViewHolderInt.getItemId() == j) {
if (!this.mChildHelper.isHidden(childViewHolderInt.itemView)) {
return childViewHolderInt;
}
viewHolder = childViewHolderInt;
}
}
}
return viewHolder;
}
@Nullable
public View findChildViewUnder(float f, float f2) {
for (int childCount = this.mChildHelper.getChildCount() - 1; childCount >= 0; childCount--) {
View childAt = this.mChildHelper.getChildAt(childCount);
float translationX = childAt.getTranslationX();
float translationY = childAt.getTranslationY();
if (f >= childAt.getLeft() + translationX && f <= childAt.getRight() + translationX && f2 >= childAt.getTop() + translationY && f2 <= childAt.getBottom() + translationY) {
return childAt;
}
}
return null;
}
@Override // android.view.ViewGroup
public boolean drawChild(Canvas canvas, View view, long j) {
return super.drawChild(canvas, view, j);
}
public void offsetChildrenVertical(@Px int i) {
int childCount = this.mChildHelper.getChildCount();
for (int i2 = 0; i2 < childCount; i2++) {
this.mChildHelper.getChildAt(i2).offsetTopAndBottom(i);
}
}
public void offsetChildrenHorizontal(@Px int i) {
int childCount = this.mChildHelper.getChildCount();
for (int i2 = 0; i2 < childCount; i2++) {
this.mChildHelper.getChildAt(i2).offsetLeftAndRight(i);
}
}
public void getDecoratedBoundsWithMargins(@NonNull View view, @NonNull Rect rect) {
getDecoratedBoundsWithMarginsInt(view, rect);
}
public static void getDecoratedBoundsWithMarginsInt(View view, Rect rect) {
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
Rect rect2 = layoutParams.mDecorInsets;
rect.set((view.getLeft() - rect2.left) - ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin, (view.getTop() - rect2.top) - ((ViewGroup.MarginLayoutParams) layoutParams).topMargin, view.getRight() + rect2.right + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin, view.getBottom() + rect2.bottom + ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin);
}
public Rect getItemDecorInsetsForChild(View view) {
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
if (!layoutParams.mInsetsDirty) {
return layoutParams.mDecorInsets;
}
if (this.mState.isPreLayout() && (layoutParams.isItemChanged() || layoutParams.isViewInvalid())) {
return layoutParams.mDecorInsets;
}
Rect rect = layoutParams.mDecorInsets;
rect.set(0, 0, 0, 0);
int size = this.mItemDecorations.size();
for (int i = 0; i < size; i++) {
this.mTempRect.set(0, 0, 0, 0);
this.mItemDecorations.get(i).getItemOffsets(this.mTempRect, view, this, this.mState);
int i2 = rect.left;
Rect rect2 = this.mTempRect;
rect.left = i2 + rect2.left;
rect.top += rect2.top;
rect.right += rect2.right;
rect.bottom += rect2.bottom;
}
layoutParams.mInsetsDirty = false;
return rect;
}
public void dispatchOnScrolled(int i, int i2) {
this.mDispatchScrollCounter++;
int scrollX = getScrollX();
int scrollY = getScrollY();
onScrollChanged(scrollX, scrollY, scrollX - i, scrollY - i2);
onScrolled(i, i2);
OnScrollListener onScrollListener = this.mScrollListener;
if (onScrollListener != null) {
onScrollListener.onScrolled(this, i, i2);
}
List<OnScrollListener> list = this.mScrollListeners;
if (list != null) {
for (int size = list.size() - 1; size >= 0; size--) {
this.mScrollListeners.get(size).onScrolled(this, i, i2);
}
}
this.mDispatchScrollCounter--;
}
public void dispatchOnScrollStateChanged(int i) {
LayoutManager layoutManager = this.mLayout;
if (layoutManager != null) {
layoutManager.onScrollStateChanged(i);
}
onScrollStateChanged(i);
OnScrollListener onScrollListener = this.mScrollListener;
if (onScrollListener != null) {
onScrollListener.onScrollStateChanged(this, i);
}
List<OnScrollListener> list = this.mScrollListeners;
if (list != null) {
for (int size = list.size() - 1; size >= 0; size--) {
this.mScrollListeners.get(size).onScrollStateChanged(this, i);
}
}
}
public boolean hasPendingAdapterUpdates() {
return !this.mFirstLayoutComplete || this.mDataSetHasChangedAfterLayout || this.mAdapterHelper.hasPendingUpdates();
}
public class ViewFlinger implements Runnable {
private boolean mEatRunOnAnimationRequest;
Interpolator mInterpolator;
private int mLastFlingX;
private int mLastFlingY;
OverScroller mOverScroller;
private boolean mReSchedulePostAnimationCallback;
public ViewFlinger() {
Interpolator interpolator = RecyclerView.sQuinticInterpolator;
this.mInterpolator = interpolator;
this.mEatRunOnAnimationRequest = false;
this.mReSchedulePostAnimationCallback = false;
this.mOverScroller = new OverScroller(RecyclerView.this.getContext(), interpolator);
}
@Override // java.lang.Runnable
public void run() {
int i;
int i2;
RecyclerView recyclerView = RecyclerView.this;
if (recyclerView.mLayout == null) {
stop();
return;
}
this.mReSchedulePostAnimationCallback = false;
this.mEatRunOnAnimationRequest = true;
recyclerView.consumePendingUpdateOperations();
OverScroller overScroller = this.mOverScroller;
if (overScroller.computeScrollOffset()) {
int currX = overScroller.getCurrX();
int currY = overScroller.getCurrY();
int i3 = currX - this.mLastFlingX;
int i4 = currY - this.mLastFlingY;
this.mLastFlingX = currX;
this.mLastFlingY = currY;
RecyclerView recyclerView2 = RecyclerView.this;
int[] iArr = recyclerView2.mReusableIntPair;
iArr[0] = 0;
iArr[1] = 0;
if (recyclerView2.dispatchNestedPreScroll(i3, i4, iArr, null, 1)) {
int[] iArr2 = RecyclerView.this.mReusableIntPair;
i3 -= iArr2[0];
i4 -= iArr2[1];
}
if (RecyclerView.this.getOverScrollMode() != 2) {
RecyclerView.this.considerReleasingGlowsOnScroll(i3, i4);
}
RecyclerView recyclerView3 = RecyclerView.this;
if (recyclerView3.mAdapter != null) {
int[] iArr3 = recyclerView3.mReusableIntPair;
iArr3[0] = 0;
iArr3[1] = 0;
recyclerView3.scrollStep(i3, i4, iArr3);
RecyclerView recyclerView4 = RecyclerView.this;
int[] iArr4 = recyclerView4.mReusableIntPair;
i2 = iArr4[0];
i = iArr4[1];
i3 -= i2;
i4 -= i;
SmoothScroller smoothScroller = recyclerView4.mLayout.mSmoothScroller;
if (smoothScroller != null && !smoothScroller.isPendingInitialRun() && smoothScroller.isRunning()) {
int itemCount = RecyclerView.this.mState.getItemCount();
if (itemCount == 0) {
smoothScroller.stop();
} else if (smoothScroller.getTargetPosition() >= itemCount) {
smoothScroller.setTargetPosition(itemCount - 1);
smoothScroller.onAnimation(i2, i);
} else {
smoothScroller.onAnimation(i2, i);
}
}
} else {
i = 0;
i2 = 0;
}
if (!RecyclerView.this.mItemDecorations.isEmpty()) {
RecyclerView.this.invalidate();
}
RecyclerView recyclerView5 = RecyclerView.this;
int[] iArr5 = recyclerView5.mReusableIntPair;
iArr5[0] = 0;
iArr5[1] = 0;
recyclerView5.dispatchNestedScroll(i2, i, i3, i4, null, 1, iArr5);
RecyclerView recyclerView6 = RecyclerView.this;
int[] iArr6 = recyclerView6.mReusableIntPair;
int i5 = i3 - iArr6[0];
int i6 = i4 - iArr6[1];
if (i2 != 0 || i != 0) {
recyclerView6.dispatchOnScrolled(i2, i);
}
if (!RecyclerView.this.awakenScrollBars()) {
RecyclerView.this.invalidate();
}
boolean z = overScroller.isFinished() || (((overScroller.getCurrX() == overScroller.getFinalX()) || i5 != 0) && ((overScroller.getCurrY() == overScroller.getFinalY()) || i6 != 0));
SmoothScroller smoothScroller2 = RecyclerView.this.mLayout.mSmoothScroller;
if ((smoothScroller2 == null || !smoothScroller2.isPendingInitialRun()) && z) {
if (RecyclerView.this.getOverScrollMode() != 2) {
int currVelocity = (int) overScroller.getCurrVelocity();
int i7 = i5 < 0 ? -currVelocity : i5 > 0 ? currVelocity : 0;
if (i6 < 0) {
currVelocity = -currVelocity;
} else if (i6 <= 0) {
currVelocity = 0;
}
RecyclerView.this.absorbGlows(i7, currVelocity);
}
if (RecyclerView.ALLOW_THREAD_GAP_WORK) {
RecyclerView.this.mPrefetchRegistry.clearPrefetchPositions();
}
} else {
postOnAnimation();
RecyclerView recyclerView7 = RecyclerView.this;
GapWorker gapWorker = recyclerView7.mGapWorker;
if (gapWorker != null) {
gapWorker.postFromTraversal(recyclerView7, i2, i);
}
}
}
SmoothScroller smoothScroller3 = RecyclerView.this.mLayout.mSmoothScroller;
if (smoothScroller3 != null && smoothScroller3.isPendingInitialRun()) {
smoothScroller3.onAnimation(0, 0);
}
this.mEatRunOnAnimationRequest = false;
if (this.mReSchedulePostAnimationCallback) {
internalPostOnAnimation();
} else {
RecyclerView.this.setScrollState(0);
RecyclerView.this.stopNestedScroll(1);
}
}
public void postOnAnimation() {
if (this.mEatRunOnAnimationRequest) {
this.mReSchedulePostAnimationCallback = true;
} else {
internalPostOnAnimation();
}
}
private void internalPostOnAnimation() {
RecyclerView.this.removeCallbacks(this);
ViewCompat.postOnAnimation(RecyclerView.this, this);
}
public void fling(int i, int i2) {
RecyclerView.this.setScrollState(2);
this.mLastFlingY = 0;
this.mLastFlingX = 0;
Interpolator interpolator = this.mInterpolator;
Interpolator interpolator2 = RecyclerView.sQuinticInterpolator;
if (interpolator != interpolator2) {
this.mInterpolator = interpolator2;
this.mOverScroller = new OverScroller(RecyclerView.this.getContext(), interpolator2);
}
this.mOverScroller.fling(0, 0, i, i2, Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE);
postOnAnimation();
}
public void smoothScrollBy(int i, int i2, int i3, @Nullable Interpolator interpolator) {
if (i3 == Integer.MIN_VALUE) {
i3 = computeScrollDuration(i, i2);
}
int i4 = i3;
if (interpolator == null) {
interpolator = RecyclerView.sQuinticInterpolator;
}
if (this.mInterpolator != interpolator) {
this.mInterpolator = interpolator;
this.mOverScroller = new OverScroller(RecyclerView.this.getContext(), interpolator);
}
this.mLastFlingY = 0;
this.mLastFlingX = 0;
RecyclerView.this.setScrollState(2);
this.mOverScroller.startScroll(0, 0, i, i2, i4);
postOnAnimation();
}
private int computeScrollDuration(int i, int i2) {
int abs = Math.abs(i);
int abs2 = Math.abs(i2);
boolean z = abs > abs2;
RecyclerView recyclerView = RecyclerView.this;
int width = z ? recyclerView.getWidth() : recyclerView.getHeight();
if (!z) {
abs = abs2;
}
return Math.min((int) (((abs / width) + 1.0f) * 300.0f), 2000);
}
public void stop() {
RecyclerView.this.removeCallbacks(this);
this.mOverScroller.abortAnimation();
}
}
public void repositionShadowingViews() {
ViewHolder viewHolder;
int childCount = this.mChildHelper.getChildCount();
for (int i = 0; i < childCount; i++) {
View childAt = this.mChildHelper.getChildAt(i);
ViewHolder childViewHolder = getChildViewHolder(childAt);
if (childViewHolder != null && (viewHolder = childViewHolder.mShadowingHolder) != null) {
View view = viewHolder.itemView;
int left = childAt.getLeft();
int top = childAt.getTop();
if (left != view.getLeft() || top != view.getTop()) {
view.layout(left, top, view.getWidth() + left, view.getHeight() + top);
}
}
}
}
public class RecyclerViewDataObserver extends AdapterDataObserver {
public RecyclerViewDataObserver() {
}
@Override // androidx.recyclerview.widget.RecyclerView.AdapterDataObserver
public void onChanged() {
RecyclerView.this.assertNotInLayoutOrScroll(null);
RecyclerView recyclerView = RecyclerView.this;
recyclerView.mState.mStructureChanged = true;
recyclerView.processDataSetCompletelyChanged(true);
if (RecyclerView.this.mAdapterHelper.hasPendingUpdates()) {
return;
}
RecyclerView.this.requestLayout();
}
@Override // androidx.recyclerview.widget.RecyclerView.AdapterDataObserver
public void onItemRangeChanged(int i, int i2, Object obj) {
RecyclerView.this.assertNotInLayoutOrScroll(null);
if (RecyclerView.this.mAdapterHelper.onItemRangeChanged(i, i2, obj)) {
triggerUpdateProcessor();
}
}
@Override // androidx.recyclerview.widget.RecyclerView.AdapterDataObserver
public void onItemRangeInserted(int i, int i2) {
RecyclerView.this.assertNotInLayoutOrScroll(null);
if (RecyclerView.this.mAdapterHelper.onItemRangeInserted(i, i2)) {
triggerUpdateProcessor();
}
}
@Override // androidx.recyclerview.widget.RecyclerView.AdapterDataObserver
public void onItemRangeRemoved(int i, int i2) {
RecyclerView.this.assertNotInLayoutOrScroll(null);
if (RecyclerView.this.mAdapterHelper.onItemRangeRemoved(i, i2)) {
triggerUpdateProcessor();
}
}
@Override // androidx.recyclerview.widget.RecyclerView.AdapterDataObserver
public void onItemRangeMoved(int i, int i2, int i3) {
RecyclerView.this.assertNotInLayoutOrScroll(null);
if (RecyclerView.this.mAdapterHelper.onItemRangeMoved(i, i2, i3)) {
triggerUpdateProcessor();
}
}
public void triggerUpdateProcessor() {
if (RecyclerView.POST_UPDATES_ON_ANIMATION) {
RecyclerView recyclerView = RecyclerView.this;
if (recyclerView.mHasFixedSize && recyclerView.mIsAttached) {
ViewCompat.postOnAnimation(recyclerView, recyclerView.mUpdateChildViewsRunnable);
return;
}
}
RecyclerView recyclerView2 = RecyclerView.this;
recyclerView2.mAdapterUpdateDuringMeasure = true;
recyclerView2.requestLayout();
}
@Override // androidx.recyclerview.widget.RecyclerView.AdapterDataObserver
public void onStateRestorationPolicyChanged() {
Adapter adapter;
RecyclerView recyclerView = RecyclerView.this;
if (recyclerView.mPendingSavedState == null || (adapter = recyclerView.mAdapter) == null || !adapter.canRestoreState()) {
return;
}
RecyclerView.this.requestLayout();
}
}
public static class EdgeEffectFactory {
public static final int DIRECTION_BOTTOM = 3;
public static final int DIRECTION_LEFT = 0;
public static final int DIRECTION_RIGHT = 2;
public static final int DIRECTION_TOP = 1;
@Retention(RetentionPolicy.SOURCE)
public @interface EdgeDirection {
}
@NonNull
public EdgeEffect createEdgeEffect(@NonNull RecyclerView recyclerView, int i) {
return new EdgeEffect(recyclerView.getContext());
}
}
public static class RecycledViewPool {
private static final int DEFAULT_MAX_SCRAP = 5;
SparseArray<ScrapData> mScrap = new SparseArray<>();
private int mAttachCount = 0;
public static class ScrapData {
final ArrayList<ViewHolder> mScrapHeap = new ArrayList<>();
int mMaxScrap = 5;
long mCreateRunningAverageNs = 0;
long mBindRunningAverageNs = 0;
}
public void attach() {
this.mAttachCount++;
}
public void detach() {
this.mAttachCount--;
}
public void clear() {
for (int i = 0; i < this.mScrap.size(); i++) {
this.mScrap.valueAt(i).mScrapHeap.clear();
}
}
public void setMaxRecycledViews(int i, int i2) {
ScrapData scrapDataForType = getScrapDataForType(i);
scrapDataForType.mMaxScrap = i2;
ArrayList<ViewHolder> arrayList = scrapDataForType.mScrapHeap;
while (arrayList.size() > i2) {
arrayList.remove(arrayList.size() - 1);
}
}
public int getRecycledViewCount(int i) {
return getScrapDataForType(i).mScrapHeap.size();
}
@Nullable
public ViewHolder getRecycledView(int i) {
ScrapData scrapData = this.mScrap.get(i);
if (scrapData == null || scrapData.mScrapHeap.isEmpty()) {
return null;
}
ArrayList<ViewHolder> arrayList = scrapData.mScrapHeap;
for (int size = arrayList.size() - 1; size >= 0; size--) {
if (!arrayList.get(size).isAttachedToTransitionOverlay()) {
return arrayList.remove(size);
}
}
return null;
}
public int size() {
int i = 0;
for (int i2 = 0; i2 < this.mScrap.size(); i2++) {
ArrayList<ViewHolder> arrayList = this.mScrap.valueAt(i2).mScrapHeap;
if (arrayList != null) {
i += arrayList.size();
}
}
return i;
}
public void putRecycledView(ViewHolder viewHolder) {
int itemViewType = viewHolder.getItemViewType();
ArrayList<ViewHolder> arrayList = getScrapDataForType(itemViewType).mScrapHeap;
if (this.mScrap.get(itemViewType).mMaxScrap <= arrayList.size()) {
return;
}
viewHolder.resetInternal();
arrayList.add(viewHolder);
}
public long runningAverage(long j, long j2) {
return j == 0 ? j2 : ((j / 4) * 3) + (j2 / 4);
}
public void factorInCreateTime(int i, long j) {
ScrapData scrapDataForType = getScrapDataForType(i);
scrapDataForType.mCreateRunningAverageNs = runningAverage(scrapDataForType.mCreateRunningAverageNs, j);
}
public void factorInBindTime(int i, long j) {
ScrapData scrapDataForType = getScrapDataForType(i);
scrapDataForType.mBindRunningAverageNs = runningAverage(scrapDataForType.mBindRunningAverageNs, j);
}
public boolean willCreateInTime(int i, long j, long j2) {
long j3 = getScrapDataForType(i).mCreateRunningAverageNs;
return j3 == 0 || j + j3 < j2;
}
public boolean willBindInTime(int i, long j, long j2) {
long j3 = getScrapDataForType(i).mBindRunningAverageNs;
return j3 == 0 || j + j3 < j2;
}
public void onAdapterChanged(Adapter adapter, Adapter adapter2, boolean z) {
if (adapter != null) {
detach();
}
if (!z && this.mAttachCount == 0) {
clear();
}
if (adapter2 != null) {
attach();
}
}
private ScrapData getScrapDataForType(int i) {
ScrapData scrapData = this.mScrap.get(i);
if (scrapData != null) {
return scrapData;
}
ScrapData scrapData2 = new ScrapData();
this.mScrap.put(i, scrapData2);
return scrapData2;
}
}
@Nullable
public static RecyclerView findNestedRecyclerView(@NonNull View view) {
if (!(view instanceof ViewGroup)) {
return null;
}
if (view instanceof RecyclerView) {
return (RecyclerView) view;
}
ViewGroup viewGroup = (ViewGroup) view;
int childCount = viewGroup.getChildCount();
for (int i = 0; i < childCount; i++) {
RecyclerView findNestedRecyclerView = findNestedRecyclerView(viewGroup.getChildAt(i));
if (findNestedRecyclerView != null) {
return findNestedRecyclerView;
}
}
return null;
}
public static void clearNestedRecyclerViewIfNotNested(@NonNull ViewHolder viewHolder) {
WeakReference<RecyclerView> weakReference = viewHolder.mNestedRecyclerView;
if (weakReference != null) {
RecyclerView recyclerView = weakReference.get();
while (recyclerView != null) {
if (recyclerView == viewHolder.itemView) {
return;
}
Object parent = recyclerView.getParent();
recyclerView = parent instanceof View ? (View) parent : null;
}
viewHolder.mNestedRecyclerView = null;
}
}
public long getNanoTime() {
if (ALLOW_THREAD_GAP_WORK) {
return System.nanoTime();
}
return 0L;
}
public final class Recycler {
static final int DEFAULT_CACHE_SIZE = 2;
final ArrayList<ViewHolder> mAttachedScrap;
final ArrayList<ViewHolder> mCachedViews;
ArrayList<ViewHolder> mChangedScrap;
RecycledViewPool mRecyclerPool;
private int mRequestedCacheMax;
private final List<ViewHolder> mUnmodifiableAttachedScrap;
private ViewCacheExtension mViewCacheExtension;
int mViewCacheMax;
@NonNull
public List<ViewHolder> getScrapList() {
return this.mUnmodifiableAttachedScrap;
}
public void setViewCacheExtension(ViewCacheExtension viewCacheExtension) {
this.mViewCacheExtension = viewCacheExtension;
}
public Recycler() {
ArrayList<ViewHolder> arrayList = new ArrayList<>();
this.mAttachedScrap = arrayList;
this.mChangedScrap = null;
this.mCachedViews = new ArrayList<>();
this.mUnmodifiableAttachedScrap = Collections.unmodifiableList(arrayList);
this.mRequestedCacheMax = 2;
this.mViewCacheMax = 2;
}
public void clear() {
this.mAttachedScrap.clear();
recycleAndClearCachedViews();
}
public void setViewCacheSize(int i) {
this.mRequestedCacheMax = i;
updateViewCacheSize();
}
public void updateViewCacheSize() {
LayoutManager layoutManager = RecyclerView.this.mLayout;
this.mViewCacheMax = this.mRequestedCacheMax + (layoutManager != null ? layoutManager.mPrefetchMaxCountObserved : 0);
for (int size = this.mCachedViews.size() - 1; size >= 0 && this.mCachedViews.size() > this.mViewCacheMax; size--) {
recycleCachedViewAt(size);
}
}
public boolean validateViewHolderForOffsetPosition(ViewHolder viewHolder) {
if (viewHolder.isRemoved()) {
return RecyclerView.this.mState.isPreLayout();
}
int i = viewHolder.mPosition;
if (i < 0 || i >= RecyclerView.this.mAdapter.getItemCount()) {
throw new IndexOutOfBoundsException("Inconsistency detected. Invalid view holder adapter position" + viewHolder + RecyclerView.this.exceptionLabel());
}
if (RecyclerView.this.mState.isPreLayout() || RecyclerView.this.mAdapter.getItemViewType(viewHolder.mPosition) == viewHolder.getItemViewType()) {
return !RecyclerView.this.mAdapter.hasStableIds() || viewHolder.getItemId() == RecyclerView.this.mAdapter.getItemId(viewHolder.mPosition);
}
return false;
}
private boolean tryBindViewHolderByDeadline(@NonNull ViewHolder viewHolder, int i, int i2, long j) {
viewHolder.mBindingAdapter = null;
viewHolder.mOwnerRecyclerView = RecyclerView.this;
int itemViewType = viewHolder.getItemViewType();
long nanoTime = RecyclerView.this.getNanoTime();
if (j != Long.MAX_VALUE && !this.mRecyclerPool.willBindInTime(itemViewType, nanoTime, j)) {
return false;
}
RecyclerView.this.mAdapter.bindViewHolder(viewHolder, i);
this.mRecyclerPool.factorInBindTime(viewHolder.getItemViewType(), RecyclerView.this.getNanoTime() - nanoTime);
attachAccessibilityDelegateOnBind(viewHolder);
if (!RecyclerView.this.mState.isPreLayout()) {
return true;
}
viewHolder.mPreLayoutPosition = i2;
return true;
}
public void bindViewToPosition(@NonNull View view, int i) {
LayoutParams layoutParams;
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
if (childViewHolderInt == null) {
throw new IllegalArgumentException("The view does not have a ViewHolder. You cannot pass arbitrary views to this method, they should be created by the Adapter" + RecyclerView.this.exceptionLabel());
}
int findPositionOffset = RecyclerView.this.mAdapterHelper.findPositionOffset(i);
if (findPositionOffset < 0 || findPositionOffset >= RecyclerView.this.mAdapter.getItemCount()) {
throw new IndexOutOfBoundsException("Inconsistency detected. Invalid item position " + i + "(offset:" + findPositionOffset + ").state:" + RecyclerView.this.mState.getItemCount() + RecyclerView.this.exceptionLabel());
}
tryBindViewHolderByDeadline(childViewHolderInt, findPositionOffset, i, Long.MAX_VALUE);
ViewGroup.LayoutParams layoutParams2 = childViewHolderInt.itemView.getLayoutParams();
if (layoutParams2 == null) {
layoutParams = (LayoutParams) RecyclerView.this.generateDefaultLayoutParams();
childViewHolderInt.itemView.setLayoutParams(layoutParams);
} else if (!RecyclerView.this.checkLayoutParams(layoutParams2)) {
layoutParams = (LayoutParams) RecyclerView.this.generateLayoutParams(layoutParams2);
childViewHolderInt.itemView.setLayoutParams(layoutParams);
} else {
layoutParams = (LayoutParams) layoutParams2;
}
layoutParams.mInsetsDirty = true;
layoutParams.mViewHolder = childViewHolderInt;
layoutParams.mPendingInvalidate = childViewHolderInt.itemView.getParent() == null;
}
public int convertPreLayoutPositionToPostLayout(int i) {
if (i >= 0 && i < RecyclerView.this.mState.getItemCount()) {
return !RecyclerView.this.mState.isPreLayout() ? i : RecyclerView.this.mAdapterHelper.findPositionOffset(i);
}
throw new IndexOutOfBoundsException("invalid position " + i + ". State item count is " + RecyclerView.this.mState.getItemCount() + RecyclerView.this.exceptionLabel());
}
@NonNull
public View getViewForPosition(int i) {
return getViewForPosition(i, false);
}
public View getViewForPosition(int i, boolean z) {
return tryGetViewHolderForPositionByDeadline(i, z, Long.MAX_VALUE).itemView;
}
/* JADX WARN: Removed duplicated region for block: B:15:0x0037 */
/* JADX WARN: Removed duplicated region for block: B:24:0x005c */
/* JADX WARN: Removed duplicated region for block: B:26:0x005f */
/* JADX WARN: Removed duplicated region for block: B:70:0x0186 */
/* JADX WARN: Removed duplicated region for block: B:76:0x01a3 */
/* JADX WARN: Removed duplicated region for block: B:79:0x01c6 */
/* JADX WARN: Removed duplicated region for block: B:85:0x01ff */
/* JADX WARN: Removed duplicated region for block: B:88:0x0229 A[ADDED_TO_REGION] */
/* JADX WARN: Removed duplicated region for block: B:92:0x020d */
/* JADX WARN: Removed duplicated region for block: B:98:0x01d5 */
@androidx.annotation.Nullable
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public androidx.recyclerview.widget.RecyclerView.ViewHolder tryGetViewHolderForPositionByDeadline(int r17, boolean r18, long r19) {
/*
Method dump skipped, instructions count: 616
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.recyclerview.widget.RecyclerView.Recycler.tryGetViewHolderForPositionByDeadline(int, boolean, long):androidx.recyclerview.widget.RecyclerView$ViewHolder");
}
private void attachAccessibilityDelegateOnBind(ViewHolder viewHolder) {
if (RecyclerView.this.isAccessibilityEnabled()) {
View view = viewHolder.itemView;
if (ViewCompat.getImportantForAccessibility(view) == 0) {
ViewCompat.setImportantForAccessibility(view, 1);
}
RecyclerViewAccessibilityDelegate recyclerViewAccessibilityDelegate = RecyclerView.this.mAccessibilityDelegate;
if (recyclerViewAccessibilityDelegate == null) {
return;
}
AccessibilityDelegateCompat itemDelegate = recyclerViewAccessibilityDelegate.getItemDelegate();
if (itemDelegate instanceof RecyclerViewAccessibilityDelegate.ItemDelegate) {
((RecyclerViewAccessibilityDelegate.ItemDelegate) itemDelegate).saveOriginalDelegate(view);
}
ViewCompat.setAccessibilityDelegate(view, itemDelegate);
}
}
private void invalidateDisplayListInt(ViewHolder viewHolder) {
View view = viewHolder.itemView;
if (view instanceof ViewGroup) {
invalidateDisplayListInt((ViewGroup) view, false);
}
}
private void invalidateDisplayListInt(ViewGroup viewGroup, boolean z) {
for (int childCount = viewGroup.getChildCount() - 1; childCount >= 0; childCount--) {
View childAt = viewGroup.getChildAt(childCount);
if (childAt instanceof ViewGroup) {
invalidateDisplayListInt((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 void recycleView(@NonNull View view) {
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
if (childViewHolderInt.isTmpDetached()) {
RecyclerView.this.removeDetachedView(view, false);
}
if (childViewHolderInt.isScrap()) {
childViewHolderInt.unScrap();
} else if (childViewHolderInt.wasReturnedFromScrap()) {
childViewHolderInt.clearReturnedFromScrapFlag();
}
recycleViewHolderInternal(childViewHolderInt);
if (RecyclerView.this.mItemAnimator == null || childViewHolderInt.isRecyclable()) {
return;
}
RecyclerView.this.mItemAnimator.endAnimation(childViewHolderInt);
}
public void recycleAndClearCachedViews() {
for (int size = this.mCachedViews.size() - 1; size >= 0; size--) {
recycleCachedViewAt(size);
}
this.mCachedViews.clear();
if (RecyclerView.ALLOW_THREAD_GAP_WORK) {
RecyclerView.this.mPrefetchRegistry.clearPrefetchPositions();
}
}
public void recycleCachedViewAt(int i) {
addViewHolderToRecycledViewPool(this.mCachedViews.get(i), true);
this.mCachedViews.remove(i);
}
public void recycleViewHolderInternal(ViewHolder viewHolder) {
boolean z;
boolean z2 = true;
if (viewHolder.isScrap() || viewHolder.itemView.getParent() != null) {
StringBuilder sb = new StringBuilder();
sb.append("Scrapped or attached views may not be recycled. isScrap:");
sb.append(viewHolder.isScrap());
sb.append(" isAttached:");
sb.append(viewHolder.itemView.getParent() != null);
sb.append(RecyclerView.this.exceptionLabel());
throw new IllegalArgumentException(sb.toString());
}
if (viewHolder.isTmpDetached()) {
throw new IllegalArgumentException("Tmp detached view should be removed from RecyclerView before it can be recycled: " + viewHolder + RecyclerView.this.exceptionLabel());
}
if (viewHolder.shouldIgnore()) {
throw new IllegalArgumentException("Trying to recycle an ignored view holder. You should first call stopIgnoringView(view) before calling recycle." + RecyclerView.this.exceptionLabel());
}
boolean doesTransientStatePreventRecycling = viewHolder.doesTransientStatePreventRecycling();
Adapter adapter = RecyclerView.this.mAdapter;
if ((adapter != null && doesTransientStatePreventRecycling && adapter.onFailedToRecycleView(viewHolder)) || viewHolder.isRecyclable()) {
if (this.mViewCacheMax <= 0 || viewHolder.hasAnyOfTheFlags(IronSourceError.ERROR_CAPPED_PER_SESSION)) {
z = false;
} else {
int size = this.mCachedViews.size();
if (size >= this.mViewCacheMax && size > 0) {
recycleCachedViewAt(0);
size--;
}
if (RecyclerView.ALLOW_THREAD_GAP_WORK && size > 0 && !RecyclerView.this.mPrefetchRegistry.lastPrefetchIncludedPosition(viewHolder.mPosition)) {
int i = size - 1;
while (i >= 0) {
if (!RecyclerView.this.mPrefetchRegistry.lastPrefetchIncludedPosition(this.mCachedViews.get(i).mPosition)) {
break;
} else {
i--;
}
}
size = i + 1;
}
this.mCachedViews.add(size, viewHolder);
z = true;
}
if (z) {
z2 = false;
} else {
addViewHolderToRecycledViewPool(viewHolder, true);
}
r1 = z;
} else {
z2 = false;
}
RecyclerView.this.mViewInfoStore.removeViewHolder(viewHolder);
if (r1 || z2 || !doesTransientStatePreventRecycling) {
return;
}
viewHolder.mBindingAdapter = null;
viewHolder.mOwnerRecyclerView = null;
}
public void addViewHolderToRecycledViewPool(@NonNull ViewHolder viewHolder, boolean z) {
RecyclerView.clearNestedRecyclerViewIfNotNested(viewHolder);
View view = viewHolder.itemView;
RecyclerViewAccessibilityDelegate recyclerViewAccessibilityDelegate = RecyclerView.this.mAccessibilityDelegate;
if (recyclerViewAccessibilityDelegate != null) {
AccessibilityDelegateCompat itemDelegate = recyclerViewAccessibilityDelegate.getItemDelegate();
ViewCompat.setAccessibilityDelegate(view, itemDelegate instanceof RecyclerViewAccessibilityDelegate.ItemDelegate ? ((RecyclerViewAccessibilityDelegate.ItemDelegate) itemDelegate).getAndRemoveOriginalDelegateForItem(view) : null);
}
if (z) {
dispatchViewRecycled(viewHolder);
}
viewHolder.mBindingAdapter = null;
viewHolder.mOwnerRecyclerView = null;
getRecycledViewPool().putRecycledView(viewHolder);
}
public void quickRecycleScrapView(View view) {
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
childViewHolderInt.mScrapContainer = null;
childViewHolderInt.mInChangeScrap = false;
childViewHolderInt.clearReturnedFromScrapFlag();
recycleViewHolderInternal(childViewHolderInt);
}
public void scrapView(View view) {
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
if (childViewHolderInt.hasAnyOfTheFlags(12) || !childViewHolderInt.isUpdated() || RecyclerView.this.canReuseUpdatedViewHolder(childViewHolderInt)) {
if (childViewHolderInt.isInvalid() && !childViewHolderInt.isRemoved() && !RecyclerView.this.mAdapter.hasStableIds()) {
throw new IllegalArgumentException("Called scrap view with an invalid view. Invalid views cannot be reused from scrap, they should rebound from recycler pool." + RecyclerView.this.exceptionLabel());
}
childViewHolderInt.setScrapContainer(this, false);
this.mAttachedScrap.add(childViewHolderInt);
return;
}
if (this.mChangedScrap == null) {
this.mChangedScrap = new ArrayList<>();
}
childViewHolderInt.setScrapContainer(this, true);
this.mChangedScrap.add(childViewHolderInt);
}
public void unscrapView(ViewHolder viewHolder) {
if (viewHolder.mInChangeScrap) {
this.mChangedScrap.remove(viewHolder);
} else {
this.mAttachedScrap.remove(viewHolder);
}
viewHolder.mScrapContainer = null;
viewHolder.mInChangeScrap = false;
viewHolder.clearReturnedFromScrapFlag();
}
public int getScrapCount() {
return this.mAttachedScrap.size();
}
public View getScrapViewAt(int i) {
return this.mAttachedScrap.get(i).itemView;
}
public void clearScrap() {
this.mAttachedScrap.clear();
ArrayList<ViewHolder> arrayList = this.mChangedScrap;
if (arrayList != null) {
arrayList.clear();
}
}
public ViewHolder getChangedScrapViewForPosition(int i) {
int size;
int findPositionOffset;
ArrayList<ViewHolder> arrayList = this.mChangedScrap;
if (arrayList != null && (size = arrayList.size()) != 0) {
for (int i2 = 0; i2 < size; i2++) {
ViewHolder viewHolder = this.mChangedScrap.get(i2);
if (!viewHolder.wasReturnedFromScrap() && viewHolder.getLayoutPosition() == i) {
viewHolder.addFlags(32);
return viewHolder;
}
}
if (RecyclerView.this.mAdapter.hasStableIds() && (findPositionOffset = RecyclerView.this.mAdapterHelper.findPositionOffset(i)) > 0 && findPositionOffset < RecyclerView.this.mAdapter.getItemCount()) {
long itemId = RecyclerView.this.mAdapter.getItemId(findPositionOffset);
for (int i3 = 0; i3 < size; i3++) {
ViewHolder viewHolder2 = this.mChangedScrap.get(i3);
if (!viewHolder2.wasReturnedFromScrap() && viewHolder2.getItemId() == itemId) {
viewHolder2.addFlags(32);
return viewHolder2;
}
}
}
}
return null;
}
public ViewHolder getScrapOrHiddenOrCachedHolderForPosition(int i, boolean z) {
View findHiddenNonRemovedView;
int size = this.mAttachedScrap.size();
for (int i2 = 0; i2 < size; i2++) {
ViewHolder viewHolder = this.mAttachedScrap.get(i2);
if (!viewHolder.wasReturnedFromScrap() && viewHolder.getLayoutPosition() == i && !viewHolder.isInvalid() && (RecyclerView.this.mState.mInPreLayout || !viewHolder.isRemoved())) {
viewHolder.addFlags(32);
return viewHolder;
}
}
if (!z && (findHiddenNonRemovedView = RecyclerView.this.mChildHelper.findHiddenNonRemovedView(i)) != null) {
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(findHiddenNonRemovedView);
RecyclerView.this.mChildHelper.unhide(findHiddenNonRemovedView);
int indexOfChild = RecyclerView.this.mChildHelper.indexOfChild(findHiddenNonRemovedView);
if (indexOfChild == -1) {
throw new IllegalStateException("layout index should not be -1 after unhiding a view:" + childViewHolderInt + RecyclerView.this.exceptionLabel());
}
RecyclerView.this.mChildHelper.detachViewFromParent(indexOfChild);
scrapView(findHiddenNonRemovedView);
childViewHolderInt.addFlags(8224);
return childViewHolderInt;
}
int size2 = this.mCachedViews.size();
for (int i3 = 0; i3 < size2; i3++) {
ViewHolder viewHolder2 = this.mCachedViews.get(i3);
if (!viewHolder2.isInvalid() && viewHolder2.getLayoutPosition() == i && !viewHolder2.isAttachedToTransitionOverlay()) {
if (!z) {
this.mCachedViews.remove(i3);
}
return viewHolder2;
}
}
return null;
}
public ViewHolder getScrapOrCachedViewForId(long j, int i, boolean z) {
for (int size = this.mAttachedScrap.size() - 1; size >= 0; size--) {
ViewHolder viewHolder = this.mAttachedScrap.get(size);
if (viewHolder.getItemId() == j && !viewHolder.wasReturnedFromScrap()) {
if (i == viewHolder.getItemViewType()) {
viewHolder.addFlags(32);
if (viewHolder.isRemoved() && !RecyclerView.this.mState.isPreLayout()) {
viewHolder.setFlags(2, 14);
}
return viewHolder;
}
if (!z) {
this.mAttachedScrap.remove(size);
RecyclerView.this.removeDetachedView(viewHolder.itemView, false);
quickRecycleScrapView(viewHolder.itemView);
}
}
}
int size2 = this.mCachedViews.size();
while (true) {
size2--;
if (size2 < 0) {
return null;
}
ViewHolder viewHolder2 = this.mCachedViews.get(size2);
if (viewHolder2.getItemId() == j && !viewHolder2.isAttachedToTransitionOverlay()) {
if (i == viewHolder2.getItemViewType()) {
if (!z) {
this.mCachedViews.remove(size2);
}
return viewHolder2;
}
if (!z) {
recycleCachedViewAt(size2);
return null;
}
}
}
}
public void dispatchViewRecycled(@NonNull ViewHolder viewHolder) {
RecyclerListener recyclerListener = RecyclerView.this.mRecyclerListener;
if (recyclerListener != null) {
recyclerListener.onViewRecycled(viewHolder);
}
int size = RecyclerView.this.mRecyclerListeners.size();
for (int i = 0; i < size; i++) {
RecyclerView.this.mRecyclerListeners.get(i).onViewRecycled(viewHolder);
}
Adapter adapter = RecyclerView.this.mAdapter;
if (adapter != null) {
adapter.onViewRecycled(viewHolder);
}
RecyclerView recyclerView = RecyclerView.this;
if (recyclerView.mState != null) {
recyclerView.mViewInfoStore.removeViewHolder(viewHolder);
}
}
public void onAdapterChanged(Adapter adapter, Adapter adapter2, boolean z) {
clear();
getRecycledViewPool().onAdapterChanged(adapter, adapter2, z);
}
public void offsetPositionRecordsForMove(int i, int i2) {
int i3;
int i4;
int i5;
int i6;
if (i < i2) {
i3 = -1;
i5 = i;
i4 = i2;
} else {
i3 = 1;
i4 = i;
i5 = i2;
}
int size = this.mCachedViews.size();
for (int i7 = 0; i7 < size; i7++) {
ViewHolder viewHolder = this.mCachedViews.get(i7);
if (viewHolder != null && (i6 = viewHolder.mPosition) >= i5 && i6 <= i4) {
if (i6 == i) {
viewHolder.offsetPosition(i2 - i, false);
} else {
viewHolder.offsetPosition(i3, false);
}
}
}
}
public void offsetPositionRecordsForInsert(int i, int i2) {
int size = this.mCachedViews.size();
for (int i3 = 0; i3 < size; i3++) {
ViewHolder viewHolder = this.mCachedViews.get(i3);
if (viewHolder != null && viewHolder.mPosition >= i) {
viewHolder.offsetPosition(i2, false);
}
}
}
public void offsetPositionRecordsForRemove(int i, int i2, boolean z) {
int i3 = i + i2;
for (int size = this.mCachedViews.size() - 1; size >= 0; size--) {
ViewHolder viewHolder = this.mCachedViews.get(size);
if (viewHolder != null) {
int i4 = viewHolder.mPosition;
if (i4 >= i3) {
viewHolder.offsetPosition(-i2, z);
} else if (i4 >= i) {
viewHolder.addFlags(8);
recycleCachedViewAt(size);
}
}
}
}
public void setRecycledViewPool(RecycledViewPool recycledViewPool) {
RecycledViewPool recycledViewPool2 = this.mRecyclerPool;
if (recycledViewPool2 != null) {
recycledViewPool2.detach();
}
this.mRecyclerPool = recycledViewPool;
if (recycledViewPool == null || RecyclerView.this.getAdapter() == null) {
return;
}
this.mRecyclerPool.attach();
}
public RecycledViewPool getRecycledViewPool() {
if (this.mRecyclerPool == null) {
this.mRecyclerPool = new RecycledViewPool();
}
return this.mRecyclerPool;
}
public void viewRangeUpdate(int i, int i2) {
int i3;
int i4 = i2 + i;
for (int size = this.mCachedViews.size() - 1; size >= 0; size--) {
ViewHolder viewHolder = this.mCachedViews.get(size);
if (viewHolder != null && (i3 = viewHolder.mPosition) >= i && i3 < i4) {
viewHolder.addFlags(2);
recycleCachedViewAt(size);
}
}
}
public void markKnownViewsInvalid() {
int size = this.mCachedViews.size();
for (int i = 0; i < size; i++) {
ViewHolder viewHolder = this.mCachedViews.get(i);
if (viewHolder != null) {
viewHolder.addFlags(6);
viewHolder.addChangePayload(null);
}
}
Adapter adapter = RecyclerView.this.mAdapter;
if (adapter == null || !adapter.hasStableIds()) {
recycleAndClearCachedViews();
}
}
public void clearOldPositions() {
int size = this.mCachedViews.size();
for (int i = 0; i < size; i++) {
this.mCachedViews.get(i).clearOldPosition();
}
int size2 = this.mAttachedScrap.size();
for (int i2 = 0; i2 < size2; i2++) {
this.mAttachedScrap.get(i2).clearOldPosition();
}
ArrayList<ViewHolder> arrayList = this.mChangedScrap;
if (arrayList != null) {
int size3 = arrayList.size();
for (int i3 = 0; i3 < size3; i3++) {
this.mChangedScrap.get(i3).clearOldPosition();
}
}
}
public void markItemDecorInsetsDirty() {
int size = this.mCachedViews.size();
for (int i = 0; i < size; i++) {
LayoutParams layoutParams = (LayoutParams) this.mCachedViews.get(i).itemView.getLayoutParams();
if (layoutParams != null) {
layoutParams.mInsetsDirty = true;
}
}
}
}
public static abstract class Adapter<VH extends ViewHolder> {
private final AdapterDataObservable mObservable = new AdapterDataObservable();
private boolean mHasStableIds = false;
private StateRestorationPolicy mStateRestorationPolicy = StateRestorationPolicy.ALLOW;
public enum StateRestorationPolicy {
ALLOW,
PREVENT_WHEN_EMPTY,
PREVENT
}
public int findRelativeAdapterPositionIn(@NonNull Adapter<? extends ViewHolder> adapter, @NonNull ViewHolder viewHolder, int i) {
if (adapter == this) {
return i;
}
return -1;
}
public abstract int getItemCount();
public long getItemId(int i) {
return -1L;
}
public int getItemViewType(int i) {
return 0;
}
@NonNull
public final StateRestorationPolicy getStateRestorationPolicy() {
return this.mStateRestorationPolicy;
}
public final boolean hasStableIds() {
return this.mHasStableIds;
}
public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) {
}
public abstract void onBindViewHolder(@NonNull VH vh, int i);
@NonNull
public abstract VH onCreateViewHolder(@NonNull ViewGroup viewGroup, int i);
public void onDetachedFromRecyclerView(@NonNull RecyclerView recyclerView) {
}
public boolean onFailedToRecycleView(@NonNull VH vh) {
return false;
}
public void onViewAttachedToWindow(@NonNull VH vh) {
}
public void onViewDetachedFromWindow(@NonNull VH vh) {
}
public void onViewRecycled(@NonNull VH vh) {
}
public void onBindViewHolder(@NonNull VH vh, int i, @NonNull List<Object> list) {
onBindViewHolder(vh, i);
}
@NonNull
public final VH createViewHolder(@NonNull ViewGroup viewGroup, int i) {
try {
TraceCompat.beginSection(RecyclerView.TRACE_CREATE_VIEW_TAG);
VH onCreateViewHolder = onCreateViewHolder(viewGroup, i);
if (onCreateViewHolder.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)");
}
onCreateViewHolder.mItemViewType = i;
return onCreateViewHolder;
} finally {
TraceCompat.endSection();
}
}
/* JADX WARN: Multi-variable type inference failed */
public final void bindViewHolder(@NonNull VH vh, int i) {
boolean z = vh.mBindingAdapter == null;
if (z) {
vh.mPosition = i;
if (hasStableIds()) {
vh.mItemId = getItemId(i);
}
vh.setFlags(1, 519);
TraceCompat.beginSection(RecyclerView.TRACE_BIND_VIEW_TAG);
}
vh.mBindingAdapter = this;
onBindViewHolder(vh, i, vh.getUnmodifiedPayloads());
if (z) {
vh.clearPayload();
ViewGroup.LayoutParams layoutParams = vh.itemView.getLayoutParams();
if (layoutParams instanceof LayoutParams) {
((LayoutParams) layoutParams).mInsetsDirty = true;
}
TraceCompat.endSection();
}
}
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 final boolean hasObservers() {
return this.mObservable.hasObservers();
}
public void registerAdapterDataObserver(@NonNull AdapterDataObserver adapterDataObserver) {
this.mObservable.registerObserver(adapterDataObserver);
}
public void unregisterAdapterDataObserver(@NonNull AdapterDataObserver adapterDataObserver) {
this.mObservable.unregisterObserver(adapterDataObserver);
}
public final void notifyDataSetChanged() {
this.mObservable.notifyChanged();
}
public final void notifyItemChanged(int i) {
this.mObservable.notifyItemRangeChanged(i, 1);
}
public final void notifyItemChanged(int i, @Nullable Object obj) {
this.mObservable.notifyItemRangeChanged(i, 1, obj);
}
public final void notifyItemRangeChanged(int i, int i2) {
this.mObservable.notifyItemRangeChanged(i, i2);
}
public final void notifyItemRangeChanged(int i, int i2, @Nullable Object obj) {
this.mObservable.notifyItemRangeChanged(i, i2, obj);
}
public final void notifyItemInserted(int i) {
this.mObservable.notifyItemRangeInserted(i, 1);
}
public final void notifyItemMoved(int i, int i2) {
this.mObservable.notifyItemMoved(i, i2);
}
public final void notifyItemRangeInserted(int i, int i2) {
this.mObservable.notifyItemRangeInserted(i, i2);
}
public final void notifyItemRemoved(int i) {
this.mObservable.notifyItemRangeRemoved(i, 1);
}
public final void notifyItemRangeRemoved(int i, int i2) {
this.mObservable.notifyItemRangeRemoved(i, i2);
}
public void setStateRestorationPolicy(@NonNull StateRestorationPolicy stateRestorationPolicy) {
this.mStateRestorationPolicy = stateRestorationPolicy;
this.mObservable.notifyStateRestorationPolicyChanged();
}
public boolean canRestoreState() {
int i = AnonymousClass7.$SwitchMap$androidx$recyclerview$widget$RecyclerView$Adapter$StateRestorationPolicy[this.mStateRestorationPolicy.ordinal()];
if (i != 1) {
return i != 2 || getItemCount() > 0;
}
return false;
}
}
/* renamed from: androidx.recyclerview.widget.RecyclerView$7, reason: invalid class name */
public static /* synthetic */ class AnonymousClass7 {
static final /* synthetic */ int[] $SwitchMap$androidx$recyclerview$widget$RecyclerView$Adapter$StateRestorationPolicy;
static {
int[] iArr = new int[Adapter.StateRestorationPolicy.values().length];
$SwitchMap$androidx$recyclerview$widget$RecyclerView$Adapter$StateRestorationPolicy = iArr;
try {
iArr[Adapter.StateRestorationPolicy.PREVENT.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$androidx$recyclerview$widget$RecyclerView$Adapter$StateRestorationPolicy[Adapter.StateRestorationPolicy.PREVENT_WHEN_EMPTY.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
}
}
public void dispatchChildDetached(View view) {
ViewHolder childViewHolderInt = getChildViewHolderInt(view);
onChildDetachedFromWindow(view);
Adapter adapter = this.mAdapter;
if (adapter != null && childViewHolderInt != null) {
adapter.onViewDetachedFromWindow(childViewHolderInt);
}
List<OnChildAttachStateChangeListener> list = this.mOnChildAttachStateListeners;
if (list != null) {
for (int size = list.size() - 1; size >= 0; size--) {
this.mOnChildAttachStateListeners.get(size).onChildViewDetachedFromWindow(view);
}
}
}
public void dispatchChildAttached(View view) {
ViewHolder childViewHolderInt = getChildViewHolderInt(view);
onChildAttachedToWindow(view);
Adapter adapter = this.mAdapter;
if (adapter != null && childViewHolderInt != null) {
adapter.onViewAttachedToWindow(childViewHolderInt);
}
List<OnChildAttachStateChangeListener> list = this.mOnChildAttachStateListeners;
if (list != null) {
for (int size = list.size() - 1; size >= 0; size--) {
this.mOnChildAttachStateListeners.get(size).onChildViewAttachedToWindow(view);
}
}
}
public static abstract class LayoutManager {
boolean mAutoMeasure;
ChildHelper mChildHelper;
private int mHeight;
private int mHeightMode;
ViewBoundsCheck mHorizontalBoundCheck;
private final ViewBoundsCheck.Callback mHorizontalBoundCheckCallback;
boolean mIsAttachedToWindow;
private boolean mItemPrefetchEnabled;
private boolean mMeasurementCacheEnabled;
int mPrefetchMaxCountObserved;
boolean mPrefetchMaxObservedInInitialPrefetch;
RecyclerView mRecyclerView;
boolean mRequestedSimpleAnimations;
@Nullable
SmoothScroller mSmoothScroller;
ViewBoundsCheck mVerticalBoundCheck;
private final ViewBoundsCheck.Callback mVerticalBoundCheckCallback;
private int mWidth;
private int mWidthMode;
public interface LayoutPrefetchRegistry {
void addPosition(int i, int i2);
}
public static class Properties {
public int orientation;
public boolean reverseLayout;
public int spanCount;
public boolean stackFromEnd;
}
public boolean canScrollHorizontally() {
return false;
}
public boolean canScrollVertically() {
return false;
}
public boolean checkLayoutParams(LayoutParams layoutParams) {
return layoutParams != null;
}
public void collectAdjacentPrefetchPositions(int i, int i2, State state, LayoutPrefetchRegistry layoutPrefetchRegistry) {
}
public void collectInitialPrefetchPositions(int i, LayoutPrefetchRegistry layoutPrefetchRegistry) {
}
public int computeHorizontalScrollExtent(@NonNull State state) {
return 0;
}
public int computeHorizontalScrollOffset(@NonNull State state) {
return 0;
}
public int computeHorizontalScrollRange(@NonNull State state) {
return 0;
}
public int computeVerticalScrollExtent(@NonNull State state) {
return 0;
}
public int computeVerticalScrollOffset(@NonNull State state) {
return 0;
}
public int computeVerticalScrollRange(@NonNull State state) {
return 0;
}
public abstract LayoutParams generateDefaultLayoutParams();
public int getBaseline() {
return -1;
}
public int getColumnCountForAccessibility(@NonNull Recycler recycler, @NonNull State state) {
return -1;
}
@Px
public int getHeight() {
return this.mHeight;
}
public int getHeightMode() {
return this.mHeightMode;
}
public int getRowCountForAccessibility(@NonNull Recycler recycler, @NonNull State state) {
return -1;
}
public int getSelectionModeForAccessibility(@NonNull Recycler recycler, @NonNull State state) {
return 0;
}
@Px
public int getWidth() {
return this.mWidth;
}
public int getWidthMode() {
return this.mWidthMode;
}
public boolean isAttachedToWindow() {
return this.mIsAttachedToWindow;
}
public boolean isAutoMeasureEnabled() {
return this.mAutoMeasure;
}
public final boolean isItemPrefetchEnabled() {
return this.mItemPrefetchEnabled;
}
public boolean isLayoutHierarchical(@NonNull Recycler recycler, @NonNull State state) {
return false;
}
public boolean isMeasurementCacheEnabled() {
return this.mMeasurementCacheEnabled;
}
public void onAdapterChanged(@Nullable Adapter adapter, @Nullable Adapter adapter2) {
}
public boolean onAddFocusables(@NonNull RecyclerView recyclerView, @NonNull ArrayList<View> arrayList, int i, int i2) {
return false;
}
@CallSuper
public void onAttachedToWindow(RecyclerView recyclerView) {
}
@Deprecated
public void onDetachedFromWindow(RecyclerView recyclerView) {
}
@Nullable
public View onFocusSearchFailed(@NonNull View view, int i, @NonNull Recycler recycler, @NonNull State state) {
return null;
}
public void onInitializeAccessibilityNodeInfoForItem(@NonNull Recycler recycler, @NonNull State state, @NonNull View view, @NonNull AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) {
}
@Nullable
public View onInterceptFocusSearch(@NonNull View view, int i) {
return null;
}
public void onItemsAdded(@NonNull RecyclerView recyclerView, int i, int i2) {
}
public void onItemsChanged(@NonNull RecyclerView recyclerView) {
}
public void onItemsMoved(@NonNull RecyclerView recyclerView, int i, int i2, int i3) {
}
public void onItemsRemoved(@NonNull RecyclerView recyclerView, int i, int i2) {
}
public void onItemsUpdated(@NonNull RecyclerView recyclerView, int i, int i2) {
}
public void onLayoutCompleted(State state) {
}
public void onRestoreInstanceState(Parcelable parcelable) {
}
@Nullable
public Parcelable onSaveInstanceState() {
return null;
}
public void onScrollStateChanged(int i) {
}
public void onSmoothScrollerStopped(SmoothScroller smoothScroller) {
if (this.mSmoothScroller == smoothScroller) {
this.mSmoothScroller = null;
}
}
public boolean performAccessibilityActionForItem(@NonNull Recycler recycler, @NonNull State state, @NonNull View view, int i, @Nullable Bundle bundle) {
return false;
}
public void requestSimpleAnimationsInNextLayout() {
this.mRequestedSimpleAnimations = true;
}
public int scrollHorizontallyBy(int i, Recycler recycler, State state) {
return 0;
}
public void scrollToPosition(int i) {
}
public int scrollVerticallyBy(int i, Recycler recycler, State state) {
return 0;
}
@Deprecated
public void setAutoMeasureEnabled(boolean z) {
this.mAutoMeasure = z;
}
public void setMeasurementCacheEnabled(boolean z) {
this.mMeasurementCacheEnabled = z;
}
public boolean shouldMeasureTwice() {
return false;
}
public boolean supportsPredictiveItemAnimations() {
return false;
}
public LayoutManager() {
ViewBoundsCheck.Callback callback = new ViewBoundsCheck.Callback() { // from class: androidx.recyclerview.widget.RecyclerView.LayoutManager.1
@Override // androidx.recyclerview.widget.ViewBoundsCheck.Callback
public View getChildAt(int i) {
return LayoutManager.this.getChildAt(i);
}
@Override // androidx.recyclerview.widget.ViewBoundsCheck.Callback
public int getParentStart() {
return LayoutManager.this.getPaddingLeft();
}
@Override // androidx.recyclerview.widget.ViewBoundsCheck.Callback
public int getParentEnd() {
return LayoutManager.this.getWidth() - LayoutManager.this.getPaddingRight();
}
@Override // androidx.recyclerview.widget.ViewBoundsCheck.Callback
public int getChildStart(View view) {
return LayoutManager.this.getDecoratedLeft(view) - ((ViewGroup.MarginLayoutParams) ((LayoutParams) view.getLayoutParams())).leftMargin;
}
@Override // androidx.recyclerview.widget.ViewBoundsCheck.Callback
public int getChildEnd(View view) {
return LayoutManager.this.getDecoratedRight(view) + ((ViewGroup.MarginLayoutParams) ((LayoutParams) view.getLayoutParams())).rightMargin;
}
};
this.mHorizontalBoundCheckCallback = callback;
ViewBoundsCheck.Callback callback2 = new ViewBoundsCheck.Callback() { // from class: androidx.recyclerview.widget.RecyclerView.LayoutManager.2
@Override // androidx.recyclerview.widget.ViewBoundsCheck.Callback
public View getChildAt(int i) {
return LayoutManager.this.getChildAt(i);
}
@Override // androidx.recyclerview.widget.ViewBoundsCheck.Callback
public int getParentStart() {
return LayoutManager.this.getPaddingTop();
}
@Override // androidx.recyclerview.widget.ViewBoundsCheck.Callback
public int getParentEnd() {
return LayoutManager.this.getHeight() - LayoutManager.this.getPaddingBottom();
}
@Override // androidx.recyclerview.widget.ViewBoundsCheck.Callback
public int getChildStart(View view) {
return LayoutManager.this.getDecoratedTop(view) - ((ViewGroup.MarginLayoutParams) ((LayoutParams) view.getLayoutParams())).topMargin;
}
@Override // androidx.recyclerview.widget.ViewBoundsCheck.Callback
public int getChildEnd(View view) {
return LayoutManager.this.getDecoratedBottom(view) + ((ViewGroup.MarginLayoutParams) ((LayoutParams) view.getLayoutParams())).bottomMargin;
}
};
this.mVerticalBoundCheckCallback = callback2;
this.mHorizontalBoundCheck = new ViewBoundsCheck(callback);
this.mVerticalBoundCheck = new ViewBoundsCheck(callback2);
this.mRequestedSimpleAnimations = false;
this.mIsAttachedToWindow = false;
this.mAutoMeasure = false;
this.mMeasurementCacheEnabled = true;
this.mItemPrefetchEnabled = true;
}
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 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 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 setMeasuredDimension(Rect rect, int i, int i2) {
setMeasuredDimension(chooseSize(i, rect.width() + getPaddingLeft() + getPaddingRight(), getMinimumWidth()), chooseSize(i2, rect.height() + getPaddingTop() + getPaddingBottom(), getMinimumHeight()));
}
public void requestLayout() {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
recyclerView.requestLayout();
}
}
public void assertInLayoutOrScroll(String str) {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
recyclerView.assertInLayoutOrScroll(str);
}
}
public static int chooseSize(int i, int i2, int i3) {
int mode = View.MeasureSpec.getMode(i);
int size = View.MeasureSpec.getSize(i);
if (mode != Integer.MIN_VALUE) {
return mode != 1073741824 ? Math.max(i2, i3) : size;
}
return Math.min(size, Math.max(i2, i3));
}
public void assertNotInLayoutOrScroll(String str) {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
recyclerView.assertNotInLayoutOrScroll(str);
}
}
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.updateViewCacheSize();
}
}
}
public void dispatchAttachedToWindow(RecyclerView recyclerView) {
this.mIsAttachedToWindow = true;
onAttachedToWindow(recyclerView);
}
public void dispatchDetachedFromWindow(RecyclerView recyclerView, Recycler recycler) {
this.mIsAttachedToWindow = false;
onDetachedFromWindow(recyclerView, recycler);
}
public void postOnAnimation(Runnable runnable) {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
ViewCompat.postOnAnimation(recyclerView, runnable);
}
}
public boolean removeCallbacks(Runnable runnable) {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
return recyclerView.removeCallbacks(runnable);
}
return false;
}
@CallSuper
public void onDetachedFromWindow(RecyclerView recyclerView, Recycler recycler) {
onDetachedFromWindow(recyclerView);
}
public boolean getClipToPadding() {
RecyclerView recyclerView = this.mRecyclerView;
return recyclerView != null && recyclerView.mClipToPadding;
}
public void onLayoutChildren(Recycler recycler, State state) {
Log.e(RecyclerView.TAG, "You must override onLayoutChildren(Recycler recycler, State state) ");
}
public LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
if (layoutParams instanceof LayoutParams) {
return new LayoutParams((LayoutParams) layoutParams);
}
if (layoutParams instanceof ViewGroup.MarginLayoutParams) {
return new LayoutParams((ViewGroup.MarginLayoutParams) layoutParams);
}
return new LayoutParams(layoutParams);
}
public LayoutParams generateLayoutParams(Context context, AttributeSet attributeSet) {
return new LayoutParams(context, attributeSet);
}
public void smoothScrollToPosition(RecyclerView recyclerView, State state, int i) {
Log.e(RecyclerView.TAG, "You must override smoothScrollToPosition to support smooth scrolling");
}
public void startSmoothScroll(SmoothScroller smoothScroller) {
SmoothScroller smoothScroller2 = this.mSmoothScroller;
if (smoothScroller2 != null && smoothScroller != smoothScroller2 && smoothScroller2.isRunning()) {
this.mSmoothScroller.stop();
}
this.mSmoothScroller = smoothScroller;
smoothScroller.start(this.mRecyclerView, this);
}
public boolean isSmoothScrolling() {
SmoothScroller smoothScroller = this.mSmoothScroller;
return smoothScroller != null && smoothScroller.isRunning();
}
public int getLayoutDirection() {
return ViewCompat.getLayoutDirection(this.mRecyclerView);
}
public void endAnimation(View view) {
ItemAnimator itemAnimator = this.mRecyclerView.mItemAnimator;
if (itemAnimator != null) {
itemAnimator.endAnimation(RecyclerView.getChildViewHolderInt(view));
}
}
public void addDisappearingView(View view) {
addDisappearingView(view, -1);
}
public void addDisappearingView(View view, int i) {
addViewInt(view, i, true);
}
public void addView(View view) {
addView(view, -1);
}
public void addView(View view, int i) {
addViewInt(view, i, false);
}
private void addViewInt(View view, int i, boolean z) {
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
if (z || childViewHolderInt.isRemoved()) {
this.mRecyclerView.mViewInfoStore.addToDisappearedInLayout(childViewHolderInt);
} else {
this.mRecyclerView.mViewInfoStore.removeFromDisappearedInLayout(childViewHolderInt);
}
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
if (childViewHolderInt.wasReturnedFromScrap() || childViewHolderInt.isScrap()) {
if (childViewHolderInt.isScrap()) {
childViewHolderInt.unScrap();
} else {
childViewHolderInt.clearReturnedFromScrapFlag();
}
this.mChildHelper.attachViewToParent(view, i, view.getLayoutParams(), false);
} else if (view.getParent() == this.mRecyclerView) {
int indexOfChild = this.mChildHelper.indexOfChild(view);
if (i == -1) {
i = this.mChildHelper.getChildCount();
}
if (indexOfChild == -1) {
throw new IllegalStateException("Added View has RecyclerView as parent but view is not a real child. Unfiltered index:" + this.mRecyclerView.indexOfChild(view) + this.mRecyclerView.exceptionLabel());
}
if (indexOfChild != i) {
this.mRecyclerView.mLayout.moveView(indexOfChild, i);
}
} else {
this.mChildHelper.addView(view, i, false);
layoutParams.mInsetsDirty = true;
SmoothScroller smoothScroller = this.mSmoothScroller;
if (smoothScroller != null && smoothScroller.isRunning()) {
this.mSmoothScroller.onChildAttachedToWindow(view);
}
}
if (layoutParams.mPendingInvalidate) {
childViewHolderInt.itemView.invalidate();
layoutParams.mPendingInvalidate = false;
}
}
public void removeView(View view) {
this.mChildHelper.removeView(view);
}
public void removeViewAt(int i) {
if (getChildAt(i) != null) {
this.mChildHelper.removeViewAt(i);
}
}
public void removeAllViews() {
for (int childCount = getChildCount() - 1; childCount >= 0; childCount--) {
this.mChildHelper.removeViewAt(childCount);
}
}
public int getPosition(@NonNull View view) {
return ((LayoutParams) view.getLayoutParams()).getViewLayoutPosition();
}
public int getItemViewType(@NonNull View view) {
return RecyclerView.getChildViewHolderInt(view).getItemViewType();
}
@Nullable
public View findContainingItemView(@NonNull View view) {
View findContainingItemView;
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView == null || (findContainingItemView = recyclerView.findContainingItemView(view)) == null || this.mChildHelper.isHidden(findContainingItemView)) {
return null;
}
return findContainingItemView;
}
@Nullable
public View findViewByPosition(int i) {
int childCount = getChildCount();
for (int i2 = 0; i2 < childCount; i2++) {
View childAt = getChildAt(i2);
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(childAt);
if (childViewHolderInt != null && childViewHolderInt.getLayoutPosition() == i && !childViewHolderInt.shouldIgnore() && (this.mRecyclerView.mState.isPreLayout() || !childViewHolderInt.isRemoved())) {
return childAt;
}
}
return null;
}
public void detachView(@NonNull View view) {
int indexOfChild = this.mChildHelper.indexOfChild(view);
if (indexOfChild >= 0) {
detachViewInternal(indexOfChild, view);
}
}
public void detachViewAt(int i) {
detachViewInternal(i, getChildAt(i));
}
private void detachViewInternal(int i, @NonNull View view) {
this.mChildHelper.detachViewFromParent(i);
}
public void attachView(@NonNull View view, int i, LayoutParams layoutParams) {
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
if (childViewHolderInt.isRemoved()) {
this.mRecyclerView.mViewInfoStore.addToDisappearedInLayout(childViewHolderInt);
} else {
this.mRecyclerView.mViewInfoStore.removeFromDisappearedInLayout(childViewHolderInt);
}
this.mChildHelper.attachViewToParent(view, i, layoutParams, childViewHolderInt.isRemoved());
}
public void attachView(@NonNull View view, int i) {
attachView(view, i, (LayoutParams) view.getLayoutParams());
}
public void attachView(@NonNull View view) {
attachView(view, -1);
}
public void removeDetachedView(@NonNull View view) {
this.mRecyclerView.removeDetachedView(view, false);
}
public void moveView(int i, int i2) {
View childAt = getChildAt(i);
if (childAt == null) {
throw new IllegalArgumentException("Cannot move a child from non-existing index:" + i + this.mRecyclerView.toString());
}
detachViewAt(i);
attachView(childAt, i2);
}
public void detachAndScrapView(@NonNull View view, @NonNull Recycler recycler) {
scrapOrRecycleView(recycler, this.mChildHelper.indexOfChild(view), view);
}
public void detachAndScrapViewAt(int i, @NonNull Recycler recycler) {
scrapOrRecycleView(recycler, i, getChildAt(i));
}
public void removeAndRecycleView(@NonNull View view, @NonNull Recycler recycler) {
removeView(view);
recycler.recycleView(view);
}
public void removeAndRecycleViewAt(int i, @NonNull Recycler recycler) {
View childAt = getChildAt(i);
removeViewAt(i);
recycler.recycleView(childAt);
}
public int getChildCount() {
ChildHelper childHelper = this.mChildHelper;
if (childHelper != null) {
return childHelper.getChildCount();
}
return 0;
}
@Nullable
public View getChildAt(int i) {
ChildHelper childHelper = this.mChildHelper;
if (childHelper != null) {
return childHelper.getChildAt(i);
}
return null;
}
@Px
public int getPaddingLeft() {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
return recyclerView.getPaddingLeft();
}
return 0;
}
@Px
public int getPaddingTop() {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
return recyclerView.getPaddingTop();
}
return 0;
}
@Px
public int getPaddingRight() {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
return recyclerView.getPaddingRight();
}
return 0;
}
@Px
public int getPaddingBottom() {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
return recyclerView.getPaddingBottom();
}
return 0;
}
@Px
public int getPaddingStart() {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
return ViewCompat.getPaddingStart(recyclerView);
}
return 0;
}
@Px
public int getPaddingEnd() {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
return ViewCompat.getPaddingEnd(recyclerView);
}
return 0;
}
public boolean isFocused() {
RecyclerView recyclerView = this.mRecyclerView;
return recyclerView != null && recyclerView.isFocused();
}
public boolean hasFocus() {
RecyclerView recyclerView = this.mRecyclerView;
return recyclerView != null && recyclerView.hasFocus();
}
@Nullable
public View getFocusedChild() {
View focusedChild;
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView == null || (focusedChild = recyclerView.getFocusedChild()) == null || this.mChildHelper.isHidden(focusedChild)) {
return null;
}
return focusedChild;
}
public int getItemCount() {
RecyclerView recyclerView = this.mRecyclerView;
Adapter adapter = recyclerView != null ? recyclerView.getAdapter() : null;
if (adapter != null) {
return adapter.getItemCount();
}
return 0;
}
public void offsetChildrenHorizontal(@Px int i) {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
recyclerView.offsetChildrenHorizontal(i);
}
}
public void offsetChildrenVertical(@Px int i) {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
recyclerView.offsetChildrenVertical(i);
}
}
public void ignoreView(@NonNull View view) {
ViewParent parent = view.getParent();
RecyclerView recyclerView = this.mRecyclerView;
if (parent != recyclerView || recyclerView.indexOfChild(view) == -1) {
throw new IllegalArgumentException("View should be fully attached to be ignored" + this.mRecyclerView.exceptionLabel());
}
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
childViewHolderInt.addFlags(128);
this.mRecyclerView.mViewInfoStore.removeViewHolder(childViewHolderInt);
}
public void stopIgnoringView(@NonNull View view) {
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
childViewHolderInt.stopIgnoring();
childViewHolderInt.resetInternal();
childViewHolderInt.addFlags(4);
}
public void detachAndScrapAttachedViews(@NonNull Recycler recycler) {
for (int childCount = getChildCount() - 1; childCount >= 0; childCount--) {
scrapOrRecycleView(recycler, childCount, getChildAt(childCount));
}
}
private void scrapOrRecycleView(Recycler recycler, int i, View view) {
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
if (childViewHolderInt.shouldIgnore()) {
return;
}
if (childViewHolderInt.isInvalid() && !childViewHolderInt.isRemoved() && !this.mRecyclerView.mAdapter.hasStableIds()) {
removeViewAt(i);
recycler.recycleViewHolderInternal(childViewHolderInt);
} else {
detachViewAt(i);
recycler.scrapView(view);
this.mRecyclerView.mViewInfoStore.onViewDetached(childViewHolderInt);
}
}
public void removeAndRecycleScrapInt(Recycler recycler) {
int scrapCount = recycler.getScrapCount();
for (int i = scrapCount - 1; i >= 0; i--) {
View scrapViewAt = recycler.getScrapViewAt(i);
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(scrapViewAt);
if (!childViewHolderInt.shouldIgnore()) {
childViewHolderInt.setIsRecyclable(false);
if (childViewHolderInt.isTmpDetached()) {
this.mRecyclerView.removeDetachedView(scrapViewAt, false);
}
ItemAnimator itemAnimator = this.mRecyclerView.mItemAnimator;
if (itemAnimator != null) {
itemAnimator.endAnimation(childViewHolderInt);
}
childViewHolderInt.setIsRecyclable(true);
recycler.quickRecycleScrapView(scrapViewAt);
}
}
recycler.clearScrap();
if (scrapCount > 0) {
this.mRecyclerView.invalidate();
}
}
public void measureChild(@NonNull View view, int i, int i2) {
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
Rect itemDecorInsetsForChild = this.mRecyclerView.getItemDecorInsetsForChild(view);
int i3 = i + itemDecorInsetsForChild.left + itemDecorInsetsForChild.right;
int i4 = i2 + itemDecorInsetsForChild.top + itemDecorInsetsForChild.bottom;
int childMeasureSpec = getChildMeasureSpec(getWidth(), getWidthMode(), getPaddingLeft() + getPaddingRight() + i3, ((ViewGroup.MarginLayoutParams) layoutParams).width, canScrollHorizontally());
int childMeasureSpec2 = getChildMeasureSpec(getHeight(), getHeightMode(), getPaddingTop() + getPaddingBottom() + i4, ((ViewGroup.MarginLayoutParams) layoutParams).height, canScrollVertically());
if (shouldMeasureChild(view, childMeasureSpec, childMeasureSpec2, layoutParams)) {
view.measure(childMeasureSpec, childMeasureSpec2);
}
}
public boolean shouldReMeasureChild(View view, int i, int i2, LayoutParams layoutParams) {
return (this.mMeasurementCacheEnabled && isMeasurementUpToDate(view.getMeasuredWidth(), i, ((ViewGroup.MarginLayoutParams) layoutParams).width) && isMeasurementUpToDate(view.getMeasuredHeight(), i2, ((ViewGroup.MarginLayoutParams) layoutParams).height)) ? false : true;
}
public boolean shouldMeasureChild(View view, int i, int i2, LayoutParams layoutParams) {
return (!view.isLayoutRequested() && this.mMeasurementCacheEnabled && isMeasurementUpToDate(view.getWidth(), i, ((ViewGroup.MarginLayoutParams) layoutParams).width) && isMeasurementUpToDate(view.getHeight(), i2, ((ViewGroup.MarginLayoutParams) layoutParams).height)) ? false : true;
}
private static boolean isMeasurementUpToDate(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;
}
public void measureChildWithMargins(@NonNull View view, int i, int i2) {
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
Rect itemDecorInsetsForChild = this.mRecyclerView.getItemDecorInsetsForChild(view);
int i3 = i + itemDecorInsetsForChild.left + itemDecorInsetsForChild.right;
int i4 = i2 + itemDecorInsetsForChild.top + itemDecorInsetsForChild.bottom;
int childMeasureSpec = getChildMeasureSpec(getWidth(), getWidthMode(), getPaddingLeft() + getPaddingRight() + ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin + i3, ((ViewGroup.MarginLayoutParams) layoutParams).width, canScrollHorizontally());
int childMeasureSpec2 = getChildMeasureSpec(getHeight(), getHeightMode(), getPaddingTop() + getPaddingBottom() + ((ViewGroup.MarginLayoutParams) layoutParams).topMargin + ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin + i4, ((ViewGroup.MarginLayoutParams) layoutParams).height, canScrollVertically());
if (shouldMeasureChild(view, childMeasureSpec, childMeasureSpec2, layoutParams)) {
view.measure(childMeasureSpec, childMeasureSpec2);
}
}
/* JADX WARN: Code restructure failed: missing block: B:3:0x000a, code lost:
if (r3 >= 0) goto L5;
*/
@java.lang.Deprecated
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static int getChildMeasureSpec(int r1, int r2, int r3, boolean r4) {
/*
int r1 = r1 - r2
r2 = 0
int r1 = java.lang.Math.max(r2, r1)
r0 = 1073741824(0x40000000, float:2.0)
if (r4 == 0) goto L10
if (r3 < 0) goto Le
Lc:
r2 = r0
goto L1e
Le:
r3 = r2
goto L1e
L10:
if (r3 < 0) goto L13
goto Lc
L13:
r4 = -1
if (r3 != r4) goto L18
r3 = r1
goto Lc
L18:
r4 = -2
if (r3 != r4) goto Le
r2 = -2147483648(0xffffffff80000000, float:-0.0)
r3 = r1
L1e:
int r1 = android.view.View.MeasureSpec.makeMeasureSpec(r3, r2)
return r1
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.recyclerview.widget.RecyclerView.LayoutManager.getChildMeasureSpec(int, int, int, boolean):int");
}
/* JADX WARN: Code restructure failed: missing block: B:11:0x0018, code lost:
if (r5 == 1073741824) goto L14;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static int getChildMeasureSpec(int r4, int r5, int r6, int r7, boolean r8) {
/*
int r4 = r4 - r6
r6 = 0
int r4 = java.lang.Math.max(r6, r4)
r0 = -2
r1 = -1
r2 = -2147483648(0xffffffff80000000, float:-0.0)
r3 = 1073741824(0x40000000, float:2.0)
if (r8 == 0) goto L1d
if (r7 < 0) goto L12
L10:
r5 = r3
goto L30
L12:
if (r7 != r1) goto L1a
if (r5 == r2) goto L22
if (r5 == 0) goto L1a
if (r5 == r3) goto L22
L1a:
r5 = r6
r7 = r5
goto L30
L1d:
if (r7 < 0) goto L20
goto L10
L20:
if (r7 != r1) goto L24
L22:
r7 = r4
goto L30
L24:
if (r7 != r0) goto L1a
if (r5 == r2) goto L2e
if (r5 != r3) goto L2b
goto L2e
L2b:
r7 = r4
r5 = r6
goto L30
L2e:
r7 = r4
r5 = r2
L30:
int r4 = android.view.View.MeasureSpec.makeMeasureSpec(r7, r5)
return r4
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.recyclerview.widget.RecyclerView.LayoutManager.getChildMeasureSpec(int, int, int, int, boolean):int");
}
public int getDecoratedMeasuredWidth(@NonNull View view) {
Rect rect = ((LayoutParams) view.getLayoutParams()).mDecorInsets;
return view.getMeasuredWidth() + rect.left + rect.right;
}
public int getDecoratedMeasuredHeight(@NonNull View view) {
Rect rect = ((LayoutParams) view.getLayoutParams()).mDecorInsets;
return view.getMeasuredHeight() + rect.top + rect.bottom;
}
public void layoutDecorated(@NonNull View view, int i, int i2, int i3, int i4) {
Rect rect = ((LayoutParams) view.getLayoutParams()).mDecorInsets;
view.layout(i + rect.left, i2 + rect.top, i3 - rect.right, i4 - rect.bottom);
}
public void layoutDecoratedWithMargins(@NonNull View view, int i, int i2, int i3, int i4) {
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
Rect rect = layoutParams.mDecorInsets;
view.layout(i + rect.left + ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin, i2 + rect.top + ((ViewGroup.MarginLayoutParams) layoutParams).topMargin, (i3 - rect.right) - ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin, (i4 - rect.bottom) - ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin);
}
public void getTransformedBoundingBox(@NonNull View view, boolean z, @NonNull Rect rect) {
Matrix matrix;
if (z) {
Rect rect2 = ((LayoutParams) view.getLayoutParams()).mDecorInsets;
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());
}
public void getDecoratedBoundsWithMargins(@NonNull View view, @NonNull Rect rect) {
RecyclerView.getDecoratedBoundsWithMarginsInt(view, rect);
}
public int getDecoratedLeft(@NonNull View view) {
return view.getLeft() - getLeftDecorationWidth(view);
}
public int getDecoratedTop(@NonNull View view) {
return view.getTop() - getTopDecorationHeight(view);
}
public int getDecoratedRight(@NonNull View view) {
return view.getRight() + getRightDecorationWidth(view);
}
public int getDecoratedBottom(@NonNull View view) {
return view.getBottom() + getBottomDecorationHeight(view);
}
public void calculateItemDecorationsForChild(@NonNull View view, @NonNull Rect rect) {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView == null) {
rect.set(0, 0, 0, 0);
} else {
rect.set(recyclerView.getItemDecorInsetsForChild(view));
}
}
public int getTopDecorationHeight(@NonNull View view) {
return ((LayoutParams) view.getLayoutParams()).mDecorInsets.top;
}
public int getBottomDecorationHeight(@NonNull View view) {
return ((LayoutParams) view.getLayoutParams()).mDecorInsets.bottom;
}
public int getLeftDecorationWidth(@NonNull View view) {
return ((LayoutParams) view.getLayoutParams()).mDecorInsets.left;
}
public int getRightDecorationWidth(@NonNull View view) {
return ((LayoutParams) view.getLayoutParams()).mDecorInsets.right;
}
private int[] getChildRectangleOnScreenScrollAmount(View view, Rect rect) {
int[] iArr = new int[2];
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 width2 = rect.width() + left;
int height2 = rect.height() + top;
int i = left - paddingLeft;
int min = Math.min(0, i);
int i2 = top - paddingTop;
int min2 = Math.min(0, i2);
int i3 = width2 - width;
int max = Math.max(0, i3);
int max2 = Math.max(0, height2 - height);
if (getLayoutDirection() != 1) {
if (min == 0) {
min = Math.min(i, max);
}
max = min;
} else if (max == 0) {
max = Math.max(min, i3);
}
if (min2 == 0) {
min2 = Math.min(i2, max2);
}
iArr[0] = max;
iArr[1] = min2;
return iArr;
}
public boolean requestChildRectangleOnScreen(@NonNull RecyclerView recyclerView, @NonNull View view, @NonNull Rect rect, boolean z) {
return requestChildRectangleOnScreen(recyclerView, view, rect, z, false);
}
public boolean requestChildRectangleOnScreen(@NonNull RecyclerView recyclerView, @NonNull View view, @NonNull Rect rect, boolean z, boolean z2) {
int[] childRectangleOnScreenScrollAmount = getChildRectangleOnScreenScrollAmount(view, rect);
int i = childRectangleOnScreenScrollAmount[0];
int i2 = childRectangleOnScreenScrollAmount[1];
if ((z2 && !isFocusedChildVisibleAfterScrolling(recyclerView, i, i2)) || (i == 0 && i2 == 0)) {
return false;
}
if (z) {
recyclerView.scrollBy(i, i2);
} else {
recyclerView.smoothScrollBy(i, i2);
}
return true;
}
public boolean isViewPartiallyVisible(@NonNull View view, boolean z, boolean z2) {
boolean z3 = this.mHorizontalBoundCheck.isViewWithinBoundFlags(view, 24579) && this.mVerticalBoundCheck.isViewWithinBoundFlags(view, 24579);
return z ? z3 : !z3;
}
private boolean isFocusedChildVisibleAfterScrolling(RecyclerView recyclerView, int i, int i2) {
View focusedChild = recyclerView.getFocusedChild();
if (focusedChild == null) {
return false;
}
int paddingLeft = getPaddingLeft();
int paddingTop = getPaddingTop();
int width = getWidth() - getPaddingRight();
int height = getHeight() - getPaddingBottom();
Rect rect = this.mRecyclerView.mTempRect;
getDecoratedBoundsWithMargins(focusedChild, rect);
return rect.left - i < width && rect.right - i > paddingLeft && rect.top - i2 < height && rect.bottom - i2 > paddingTop;
}
@Deprecated
public boolean onRequestChildFocus(@NonNull RecyclerView recyclerView, @NonNull View view, @Nullable View view2) {
return isSmoothScrolling() || recyclerView.isComputingLayout();
}
public boolean onRequestChildFocus(@NonNull RecyclerView recyclerView, @NonNull State state, @NonNull View view, @Nullable View view2) {
return onRequestChildFocus(recyclerView, view, view2);
}
public void onItemsUpdated(@NonNull RecyclerView recyclerView, int i, int i2, @Nullable Object obj) {
onItemsUpdated(recyclerView, i, i2);
}
public void onMeasure(@NonNull Recycler recycler, @NonNull State state, int i, int i2) {
this.mRecyclerView.defaultOnMeasure(i, i2);
}
public void setMeasuredDimension(int i, int i2) {
this.mRecyclerView.setMeasuredDimension(i, i2);
}
@Px
public int getMinimumWidth() {
return ViewCompat.getMinimumWidth(this.mRecyclerView);
}
@Px
public int getMinimumHeight() {
return ViewCompat.getMinimumHeight(this.mRecyclerView);
}
public void stopSmoothScroller() {
SmoothScroller smoothScroller = this.mSmoothScroller;
if (smoothScroller != null) {
smoothScroller.stop();
}
}
public void removeAndRecycleAllViews(@NonNull Recycler recycler) {
for (int childCount = getChildCount() - 1; childCount >= 0; childCount--) {
if (!RecyclerView.getChildViewHolderInt(getChildAt(childCount)).shouldIgnore()) {
removeAndRecycleViewAt(childCount, recycler);
}
}
}
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) {
RecyclerView recyclerView = this.mRecyclerView;
onInitializeAccessibilityNodeInfo(recyclerView.mRecycler, recyclerView.mState, accessibilityNodeInfoCompat);
}
public void onInitializeAccessibilityNodeInfo(@NonNull Recycler recycler, @NonNull State state, @NonNull AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) {
if (this.mRecyclerView.canScrollVertically(-1) || this.mRecyclerView.canScrollHorizontally(-1)) {
accessibilityNodeInfoCompat.addAction(8192);
accessibilityNodeInfoCompat.setScrollable(true);
}
if (this.mRecyclerView.canScrollVertically(1) || this.mRecyclerView.canScrollHorizontally(1)) {
accessibilityNodeInfoCompat.addAction(4096);
accessibilityNodeInfoCompat.setScrollable(true);
}
accessibilityNodeInfoCompat.setCollectionInfo(AccessibilityNodeInfoCompat.CollectionInfoCompat.obtain(getRowCountForAccessibility(recycler, state), getColumnCountForAccessibility(recycler, state), isLayoutHierarchical(recycler, state), getSelectionModeForAccessibility(recycler, state)));
}
public void onInitializeAccessibilityEvent(@NonNull AccessibilityEvent accessibilityEvent) {
RecyclerView recyclerView = this.mRecyclerView;
onInitializeAccessibilityEvent(recyclerView.mRecycler, recyclerView.mState, accessibilityEvent);
}
public void onInitializeAccessibilityEvent(@NonNull Recycler recycler, @NonNull State state, @NonNull 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);
Adapter adapter = this.mRecyclerView.mAdapter;
if (adapter != null) {
accessibilityEvent.setItemCount(adapter.getItemCount());
}
}
public void onInitializeAccessibilityNodeInfoForItem(View view, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) {
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
if (childViewHolderInt == null || childViewHolderInt.isRemoved() || this.mChildHelper.isHidden(childViewHolderInt.itemView)) {
return;
}
RecyclerView recyclerView = this.mRecyclerView;
onInitializeAccessibilityNodeInfoForItem(recyclerView.mRecycler, recyclerView.mState, view, accessibilityNodeInfoCompat);
}
public boolean performAccessibilityAction(int i, @Nullable Bundle bundle) {
RecyclerView recyclerView = this.mRecyclerView;
return performAccessibilityAction(recyclerView.mRecycler, recyclerView.mState, i, bundle);
}
public boolean performAccessibilityAction(@NonNull Recycler recycler, @NonNull State state, int i, @Nullable Bundle bundle) {
int height;
int width;
int i2;
int i3;
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView == null) {
return false;
}
if (i == 4096) {
height = recyclerView.canScrollVertically(1) ? (getHeight() - getPaddingTop()) - getPaddingBottom() : 0;
if (this.mRecyclerView.canScrollHorizontally(1)) {
width = (getWidth() - getPaddingLeft()) - getPaddingRight();
i2 = height;
i3 = width;
}
i2 = height;
i3 = 0;
} else if (i != 8192) {
i3 = 0;
i2 = 0;
} else {
height = recyclerView.canScrollVertically(-1) ? -((getHeight() - getPaddingTop()) - getPaddingBottom()) : 0;
if (this.mRecyclerView.canScrollHorizontally(-1)) {
width = -((getWidth() - getPaddingLeft()) - getPaddingRight());
i2 = height;
i3 = width;
}
i2 = height;
i3 = 0;
}
if (i2 == 0 && i3 == 0) {
return false;
}
this.mRecyclerView.smoothScrollBy(i3, i2, null, Integer.MIN_VALUE, true);
return true;
}
public boolean performAccessibilityActionForItem(@NonNull View view, int i, @Nullable Bundle bundle) {
RecyclerView recyclerView = this.mRecyclerView;
return performAccessibilityActionForItem(recyclerView.mRecycler, recyclerView.mState, view, i, bundle);
}
public static Properties getProperties(@NonNull Context context, @Nullable AttributeSet attributeSet, int i, int i2) {
Properties properties = new Properties();
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, androidx.recyclerview.R.styleable.RecyclerView, i, i2);
properties.orientation = obtainStyledAttributes.getInt(androidx.recyclerview.R.styleable.RecyclerView_android_orientation, 1);
properties.spanCount = obtainStyledAttributes.getInt(androidx.recyclerview.R.styleable.RecyclerView_spanCount, 1);
properties.reverseLayout = obtainStyledAttributes.getBoolean(androidx.recyclerview.R.styleable.RecyclerView_reverseLayout, false);
properties.stackFromEnd = obtainStyledAttributes.getBoolean(androidx.recyclerview.R.styleable.RecyclerView_stackFromEnd, false);
obtainStyledAttributes.recycle();
return properties;
}
public void setExactMeasureSpecsFrom(RecyclerView recyclerView) {
setMeasureSpecs(View.MeasureSpec.makeMeasureSpec(recyclerView.getWidth(), 1073741824), View.MeasureSpec.makeMeasureSpec(recyclerView.getHeight(), 1073741824));
}
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 static abstract class ItemDecoration {
@Deprecated
public void onDraw(@NonNull Canvas canvas, @NonNull RecyclerView recyclerView) {
}
@Deprecated
public void onDrawOver(@NonNull Canvas canvas, @NonNull RecyclerView recyclerView) {
}
public void onDraw(@NonNull Canvas canvas, @NonNull RecyclerView recyclerView, @NonNull State state) {
onDraw(canvas, recyclerView);
}
public void onDrawOver(@NonNull Canvas canvas, @NonNull RecyclerView recyclerView, @NonNull State state) {
onDrawOver(canvas, recyclerView);
}
@Deprecated
public void getItemOffsets(@NonNull Rect rect, int i, @NonNull RecyclerView recyclerView) {
rect.set(0, 0, 0, 0);
}
public void getItemOffsets(@NonNull Rect rect, @NonNull View view, @NonNull RecyclerView recyclerView, @NonNull State state) {
getItemOffsets(rect, ((LayoutParams) view.getLayoutParams()).getViewLayoutPosition(), recyclerView);
}
}
public static abstract class ViewHolder {
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.emptyList();
static final int PENDING_ACCESSIBILITY_STATE_NOT_SET = -1;
@NonNull
public final View itemView;
Adapter<? extends ViewHolder> mBindingAdapter;
int mFlags;
WeakReference<RecyclerView> mNestedRecyclerView;
RecyclerView mOwnerRecyclerView;
int mPosition = -1;
int mOldPosition = -1;
long mItemId = -1;
int mItemViewType = -1;
int mPreLayoutPosition = -1;
ViewHolder mShadowedHolder = null;
ViewHolder mShadowingHolder = null;
List<Object> mPayloads = null;
List<Object> mUnmodifiedPayloads = null;
private int mIsRecyclableCount = 0;
Recycler mScrapContainer = null;
boolean mInChangeScrap = false;
private int mWasImportantForAccessibilityBeforeHidden = 0;
@VisibleForTesting
int mPendingAccessibilityState = -1;
public void addFlags(int i) {
this.mFlags = i | this.mFlags;
}
public void clearOldPosition() {
this.mOldPosition = -1;
this.mPreLayoutPosition = -1;
}
public void clearReturnedFromScrapFlag() {
this.mFlags &= -33;
}
public void clearTmpDetachFlag() {
this.mFlags &= -257;
}
@Nullable
public final Adapter<? extends ViewHolder> getBindingAdapter() {
return this.mBindingAdapter;
}
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 boolean hasAnyOfTheFlags(int i) {
return (i & this.mFlags) != 0;
}
public boolean isBound() {
return (this.mFlags & 1) != 0;
}
public boolean isInvalid() {
return (this.mFlags & 4) != 0;
}
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 saveOldPosition() {
if (this.mOldPosition == -1) {
this.mOldPosition = this.mPosition;
}
}
public void setFlags(int i, int i2) {
this.mFlags = (i & i2) | (this.mFlags & (~i2));
}
public void setScrapContainer(Recycler recycler, boolean z) {
this.mScrapContainer = recycler;
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 boolean wasReturnedFromScrap() {
return (this.mFlags & 32) != 0;
}
public ViewHolder(@NonNull View view) {
if (view == null) {
throw new IllegalArgumentException("itemView may not be null");
}
this.itemView = view;
}
public void flagRemovedAndOffsetPosition(int i, int i2, boolean z) {
addFlags(8);
offsetPosition(i2, z);
this.mPosition = i;
}
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) {
((LayoutParams) this.itemView.getLayoutParams()).mInsetsDirty = true;
}
}
@Deprecated
public final int getAdapterPosition() {
return getBindingAdapterPosition();
}
public final int getBindingAdapterPosition() {
RecyclerView recyclerView;
Adapter 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 int getAbsoluteAdapterPosition() {
RecyclerView recyclerView = this.mOwnerRecyclerView;
if (recyclerView == null) {
return -1;
}
return recyclerView.getAdapterPositionInRecyclerView(this);
}
public void unScrap() {
this.mScrapContainer.unscrapView(this);
}
public boolean isAttachedToTransitionOverlay() {
return (this.itemView.getParent() == null || this.itemView.getParent() == this.mOwnerRecyclerView) ? false : true;
}
public boolean isAdapterPositionUnknown() {
return (this.mFlags & 512) != 0 || isInvalid();
}
public void addChangePayload(Object obj) {
if (obj == null) {
addFlags(1024);
} else if ((1024 & this.mFlags) == 0) {
createPayloadsIfNeeded();
this.mPayloads.add(obj);
}
}
private void createPayloadsIfNeeded() {
if (this.mPayloads == null) {
ArrayList arrayList = new ArrayList();
this.mPayloads = arrayList;
this.mUnmodifiedPayloads = Collections.unmodifiableList(arrayList);
}
}
public void clearPayload() {
List<Object> list = this.mPayloads;
if (list != null) {
list.clear();
}
this.mFlags &= -1025;
}
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 void resetInternal() {
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 onEnteredHiddenState(RecyclerView recyclerView) {
int i = this.mPendingAccessibilityState;
if (i != -1) {
this.mWasImportantForAccessibilityBeforeHidden = i;
} else {
this.mWasImportantForAccessibilityBeforeHidden = ViewCompat.getImportantForAccessibility(this.itemView);
}
recyclerView.setChildImportantForAccessibilityInternal(this, 4);
}
public void onLeftHiddenState(RecyclerView recyclerView) {
recyclerView.setChildImportantForAccessibilityInternal(this, this.mWasImportantForAccessibilityBeforeHidden);
this.mWasImportantForAccessibilityBeforeHidden = 0;
}
public String toString() {
StringBuilder sb = new StringBuilder((getClass().isAnonymousClass() ? "ViewHolder" : getClass().getSimpleName()) + "{" + Integer.toHexString(hashCode()) + " position=" + this.mPosition + " id=" + this.mItemId + ", oldPos=" + this.mOldPosition + ", pLpos:" + this.mPreLayoutPosition);
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 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;
Log.e("View", "isRecyclable decremented below 0: unmatched pair of setIsRecyable() calls for " + this);
return;
}
if (!z && i2 == 1) {
this.mFlags |= 16;
} else if (z && i2 == 0) {
this.mFlags &= -17;
}
}
public final boolean isRecyclable() {
return (this.mFlags & 16) == 0 && !ViewCompat.hasTransientState(this.itemView);
}
public boolean doesTransientStatePreventRecycling() {
return (this.mFlags & 16) == 0 && ViewCompat.hasTransientState(this.itemView);
}
}
@VisibleForTesting
public boolean setChildImportantForAccessibilityInternal(ViewHolder viewHolder, int i) {
if (isComputingLayout()) {
viewHolder.mPendingAccessibilityState = i;
this.mPendingAccessibilityImportanceChange.add(viewHolder);
return false;
}
ViewCompat.setImportantForAccessibility(viewHolder.itemView, i);
return true;
}
public void dispatchPendingImportantForAccessibilityChanges() {
int i;
for (int size = this.mPendingAccessibilityImportanceChange.size() - 1; size >= 0; size--) {
ViewHolder viewHolder = this.mPendingAccessibilityImportanceChange.get(size);
if (viewHolder.itemView.getParent() == this && !viewHolder.shouldIgnore() && (i = viewHolder.mPendingAccessibilityState) != -1) {
ViewCompat.setImportantForAccessibility(viewHolder.itemView, i);
viewHolder.mPendingAccessibilityState = -1;
}
}
this.mPendingAccessibilityImportanceChange.clear();
}
public int getAdapterPositionInRecyclerView(ViewHolder viewHolder) {
if (viewHolder.hasAnyOfTheFlags(IronSourceError.ERROR_PLACEMENT_CAPPED) || !viewHolder.isBound()) {
return -1;
}
return this.mAdapterHelper.applyPendingUpdatesToPosition(viewHolder.mPosition);
}
@VisibleForTesting
public void initFastScroller(StateListDrawable stateListDrawable, Drawable drawable, StateListDrawable stateListDrawable2, Drawable drawable2) {
if (stateListDrawable == null || drawable == null || stateListDrawable2 == null || drawable2 == null) {
throw new IllegalArgumentException("Trying to set fast scroller without both required drawables." + exceptionLabel());
}
Resources resources = getContext().getResources();
new FastScroller(this, stateListDrawable, drawable, stateListDrawable2, drawable2, resources.getDimensionPixelSize(androidx.recyclerview.R.dimen.fastscroll_default_thickness), resources.getDimensionPixelSize(androidx.recyclerview.R.dimen.fastscroll_minimum_range), resources.getDimensionPixelOffset(androidx.recyclerview.R.dimen.fastscroll_margin));
}
@Override // android.view.View, androidx.core.view.NestedScrollingChild
public void setNestedScrollingEnabled(boolean z) {
getScrollingChildHelper().setNestedScrollingEnabled(z);
}
@Override // android.view.View, androidx.core.view.NestedScrollingChild
public boolean isNestedScrollingEnabled() {
return getScrollingChildHelper().isNestedScrollingEnabled();
}
@Override // android.view.View, androidx.core.view.NestedScrollingChild
public boolean startNestedScroll(int i) {
return getScrollingChildHelper().startNestedScroll(i);
}
@Override // androidx.core.view.NestedScrollingChild2
public boolean startNestedScroll(int i, int i2) {
return getScrollingChildHelper().startNestedScroll(i, i2);
}
@Override // android.view.View, androidx.core.view.NestedScrollingChild
public void stopNestedScroll() {
getScrollingChildHelper().stopNestedScroll();
}
@Override // androidx.core.view.NestedScrollingChild2
public void stopNestedScroll(int i) {
getScrollingChildHelper().stopNestedScroll(i);
}
@Override // android.view.View, androidx.core.view.NestedScrollingChild
public boolean hasNestedScrollingParent() {
return getScrollingChildHelper().hasNestedScrollingParent();
}
@Override // androidx.core.view.NestedScrollingChild2
public boolean hasNestedScrollingParent(int i) {
return getScrollingChildHelper().hasNestedScrollingParent(i);
}
@Override // android.view.View, androidx.core.view.NestedScrollingChild
public boolean dispatchNestedScroll(int i, int i2, int i3, int i4, int[] iArr) {
return getScrollingChildHelper().dispatchNestedScroll(i, i2, i3, i4, iArr);
}
@Override // androidx.core.view.NestedScrollingChild2
public boolean dispatchNestedScroll(int i, int i2, int i3, int i4, int[] iArr, int i5) {
return getScrollingChildHelper().dispatchNestedScroll(i, i2, i3, i4, iArr, i5);
}
@Override // androidx.core.view.NestedScrollingChild3
public final void dispatchNestedScroll(int i, int i2, int i3, int i4, int[] iArr, int i5, @NonNull int[] iArr2) {
getScrollingChildHelper().dispatchNestedScroll(i, i2, i3, i4, iArr, i5, iArr2);
}
@Override // android.view.View, androidx.core.view.NestedScrollingChild
public boolean dispatchNestedPreScroll(int i, int i2, int[] iArr, int[] iArr2) {
return getScrollingChildHelper().dispatchNestedPreScroll(i, i2, iArr, iArr2);
}
@Override // androidx.core.view.NestedScrollingChild2
public boolean dispatchNestedPreScroll(int i, int i2, int[] iArr, int[] iArr2, int i3) {
return getScrollingChildHelper().dispatchNestedPreScroll(i, i2, iArr, iArr2, i3);
}
@Override // android.view.View, androidx.core.view.NestedScrollingChild
public boolean dispatchNestedFling(float f, float f2, boolean z) {
return getScrollingChildHelper().dispatchNestedFling(f, f2, z);
}
@Override // android.view.View, androidx.core.view.NestedScrollingChild
public boolean dispatchNestedPreFling(float f, float f2) {
return getScrollingChildHelper().dispatchNestedPreFling(f, f2);
}
public static class LayoutParams extends ViewGroup.MarginLayoutParams {
final Rect mDecorInsets;
boolean mInsetsDirty;
boolean mPendingInvalidate;
ViewHolder mViewHolder;
public LayoutParams(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.mDecorInsets = new Rect();
this.mInsetsDirty = true;
this.mPendingInvalidate = false;
}
public LayoutParams(int i, int i2) {
super(i, i2);
this.mDecorInsets = new Rect();
this.mInsetsDirty = true;
this.mPendingInvalidate = false;
}
public LayoutParams(ViewGroup.MarginLayoutParams marginLayoutParams) {
super(marginLayoutParams);
this.mDecorInsets = new Rect();
this.mInsetsDirty = true;
this.mPendingInvalidate = false;
}
public LayoutParams(ViewGroup.LayoutParams layoutParams) {
super(layoutParams);
this.mDecorInsets = new Rect();
this.mInsetsDirty = true;
this.mPendingInvalidate = false;
}
public LayoutParams(LayoutParams layoutParams) {
super((ViewGroup.LayoutParams) layoutParams);
this.mDecorInsets = new Rect();
this.mInsetsDirty = true;
this.mPendingInvalidate = false;
}
public boolean viewNeedsUpdate() {
return this.mViewHolder.needsUpdate();
}
public boolean isViewInvalid() {
return this.mViewHolder.isInvalid();
}
public boolean isItemRemoved() {
return this.mViewHolder.isRemoved();
}
public boolean isItemChanged() {
return this.mViewHolder.isUpdated();
}
@Deprecated
public int getViewPosition() {
return this.mViewHolder.getPosition();
}
public int getViewLayoutPosition() {
return this.mViewHolder.getLayoutPosition();
}
@Deprecated
public int getViewAdapterPosition() {
return this.mViewHolder.getBindingAdapterPosition();
}
public int getAbsoluteAdapterPosition() {
return this.mViewHolder.getAbsoluteAdapterPosition();
}
public int getBindingAdapterPosition() {
return this.mViewHolder.getBindingAdapterPosition();
}
}
public static abstract class AdapterDataObserver {
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, @Nullable Object obj) {
onItemRangeChanged(i, i2);
}
}
public static abstract class SmoothScroller {
private LayoutManager mLayoutManager;
private boolean mPendingInitialRun;
private RecyclerView mRecyclerView;
private boolean mRunning;
private boolean mStarted;
private View mTargetView;
private int mTargetPosition = -1;
private final Action mRecyclingAction = new Action(0, 0);
public interface ScrollVectorProvider {
@Nullable
PointF computeScrollVectorForPosition(int i);
}
@Nullable
public LayoutManager getLayoutManager() {
return this.mLayoutManager;
}
public int getTargetPosition() {
return this.mTargetPosition;
}
public boolean isPendingInitialRun() {
return this.mPendingInitialRun;
}
public boolean isRunning() {
return this.mRunning;
}
public abstract void onSeekTargetStep(@Px int i, @Px int i2, @NonNull State state, @NonNull Action action);
public abstract void onStart();
public abstract void onStop();
public abstract void onTargetFound(@NonNull View view, @NonNull State state, @NonNull Action action);
public void setTargetPosition(int i) {
this.mTargetPosition = i;
}
public void start(RecyclerView recyclerView, LayoutManager layoutManager) {
recyclerView.mViewFlinger.stop();
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 = layoutManager;
int i = this.mTargetPosition;
if (i == -1) {
throw new IllegalArgumentException("Invalid target position");
}
recyclerView.mState.mTargetPosition = i;
this.mRunning = true;
this.mPendingInitialRun = true;
this.mTargetView = findViewByPosition(getTargetPosition());
onStart();
this.mRecyclerView.mViewFlinger.postOnAnimation();
this.mStarted = true;
}
@Nullable
public PointF computeScrollVectorForPosition(int i) {
Object layoutManager = getLayoutManager();
if (layoutManager instanceof ScrollVectorProvider) {
return ((ScrollVectorProvider) layoutManager).computeScrollVectorForPosition(i);
}
Log.w(RecyclerView.TAG, "You should override computeScrollVectorForPosition when the LayoutManager does not implement " + ScrollVectorProvider.class.getCanonicalName());
return null;
}
public final void stop() {
if (this.mRunning) {
this.mRunning = false;
onStop();
this.mRecyclerView.mState.mTargetPosition = -1;
this.mTargetView = null;
this.mTargetPosition = -1;
this.mPendingInitialRun = false;
this.mLayoutManager.onSmoothScrollerStopped(this);
this.mLayoutManager = null;
this.mRecyclerView = null;
}
}
public void onAnimation(int i, int i2) {
PointF computeScrollVectorForPosition;
RecyclerView recyclerView = this.mRecyclerView;
if (this.mTargetPosition == -1 || recyclerView == null) {
stop();
}
if (this.mPendingInitialRun && this.mTargetView == null && this.mLayoutManager != null && (computeScrollVectorForPosition = computeScrollVectorForPosition(this.mTargetPosition)) != null) {
float f = computeScrollVectorForPosition.x;
if (f != 0.0f || computeScrollVectorForPosition.y != 0.0f) {
recyclerView.scrollStep((int) Math.signum(f), (int) Math.signum(computeScrollVectorForPosition.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.runIfNecessary(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);
boolean hasJumpTarget = this.mRecyclingAction.hasJumpTarget();
this.mRecyclingAction.runIfNecessary(recyclerView);
if (hasJumpTarget && this.mRunning) {
this.mPendingInitialRun = true;
recyclerView.mViewFlinger.postOnAnimation();
}
}
}
public int getChildPosition(View view) {
return this.mRecyclerView.getChildLayoutPosition(view);
}
public int getChildCount() {
return this.mRecyclerView.mLayout.getChildCount();
}
public View findViewByPosition(int i) {
return this.mRecyclerView.mLayout.findViewByPosition(i);
}
@Deprecated
public void instantScrollToPosition(int i) {
this.mRecyclerView.scrollToPosition(i);
}
public void onChildAttachedToWindow(View view) {
if (getChildPosition(view) == getTargetPosition()) {
this.mTargetView = view;
}
}
public void normalize(@NonNull PointF pointF) {
float f = pointF.x;
float f2 = pointF.y;
float sqrt = (float) Math.sqrt((f * f) + (f2 * f2));
pointF.x /= sqrt;
pointF.y /= sqrt;
}
public static class Action {
public static final int UNDEFINED_DURATION = Integer.MIN_VALUE;
private boolean mChanged;
private int mConsecutiveUpdates;
private int mDuration;
private int mDx;
private int mDy;
private Interpolator mInterpolator;
private int mJumpToPosition;
public int getDuration() {
return this.mDuration;
}
@Px
public int getDx() {
return this.mDx;
}
@Px
public int getDy() {
return this.mDy;
}
@Nullable
public Interpolator getInterpolator() {
return this.mInterpolator;
}
public boolean hasJumpTarget() {
return this.mJumpToPosition >= 0;
}
public void jumpTo(int i) {
this.mJumpToPosition = i;
}
public void setDuration(int i) {
this.mChanged = true;
this.mDuration = i;
}
public void setDx(@Px int i) {
this.mChanged = true;
this.mDx = i;
}
public void setDy(@Px int i) {
this.mChanged = true;
this.mDy = i;
}
public void setInterpolator(@Nullable Interpolator interpolator) {
this.mChanged = true;
this.mInterpolator = interpolator;
}
public void update(@Px int i, @Px int i2, int i3, @Nullable Interpolator interpolator) {
this.mDx = i;
this.mDy = i2;
this.mDuration = i3;
this.mInterpolator = interpolator;
this.mChanged = true;
}
public Action(@Px int i, @Px int i2) {
this(i, i2, Integer.MIN_VALUE, null);
}
public Action(@Px int i, @Px int i2, int i3) {
this(i, i2, i3, null);
}
public Action(@Px int i, @Px int i2, int i3, @Nullable Interpolator interpolator) {
this.mJumpToPosition = -1;
this.mChanged = false;
this.mConsecutiveUpdates = 0;
this.mDx = i;
this.mDy = i2;
this.mDuration = i3;
this.mInterpolator = interpolator;
}
public void runIfNecessary(RecyclerView recyclerView) {
int i = this.mJumpToPosition;
if (i >= 0) {
this.mJumpToPosition = -1;
recyclerView.jumpToPositionForSmoothScroller(i);
this.mChanged = false;
} else {
if (!this.mChanged) {
this.mConsecutiveUpdates = 0;
return;
}
validate();
recyclerView.mViewFlinger.smoothScrollBy(this.mDx, this.mDy, this.mDuration, this.mInterpolator);
int i2 = this.mConsecutiveUpdates + 1;
this.mConsecutiveUpdates = i2;
if (i2 > 10) {
Log.e(RecyclerView.TAG, "Smooth Scroll action is being updated too frequently. Make sure you are not changing it unless necessary");
}
this.mChanged = false;
}
}
private void validate() {
if (this.mInterpolator != null && this.mDuration < 1) {
throw new IllegalStateException("If you provide an interpolator, you must set a positive duration");
}
if (this.mDuration < 1) {
throw new IllegalStateException("Scroll duration must be a positive number");
}
}
}
}
public static class AdapterDataObservable extends Observable<AdapterDataObserver> {
public boolean hasObservers() {
return !((Observable) this).mObservers.isEmpty();
}
public void notifyChanged() {
for (int size = ((Observable) this).mObservers.size() - 1; size >= 0; size--) {
((AdapterDataObserver) ((Observable) this).mObservers.get(size)).onChanged();
}
}
public void notifyStateRestorationPolicyChanged() {
for (int size = ((Observable) this).mObservers.size() - 1; size >= 0; size--) {
((AdapterDataObserver) ((Observable) this).mObservers.get(size)).onStateRestorationPolicyChanged();
}
}
public void notifyItemRangeChanged(int i, int i2) {
notifyItemRangeChanged(i, i2, null);
}
public void notifyItemRangeChanged(int i, int i2, @Nullable Object obj) {
for (int size = ((Observable) this).mObservers.size() - 1; size >= 0; size--) {
((AdapterDataObserver) ((Observable) this).mObservers.get(size)).onItemRangeChanged(i, i2, obj);
}
}
public void notifyItemRangeInserted(int i, int i2) {
for (int size = ((Observable) this).mObservers.size() - 1; size >= 0; size--) {
((AdapterDataObserver) ((Observable) this).mObservers.get(size)).onItemRangeInserted(i, i2);
}
}
public void notifyItemRangeRemoved(int i, int i2) {
for (int size = ((Observable) this).mObservers.size() - 1; size >= 0; size--) {
((AdapterDataObserver) ((Observable) this).mObservers.get(size)).onItemRangeRemoved(i, i2);
}
}
public void notifyItemMoved(int i, int i2) {
for (int size = ((Observable) this).mObservers.size() - 1; size >= 0; size--) {
((AdapterDataObserver) ((Observable) this).mObservers.get(size)).onItemRangeMoved(i, i2, 1);
}
}
}
@RestrictTo({RestrictTo.Scope.LIBRARY})
public static class SavedState extends AbsSavedState {
public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.ClassLoaderCreator<SavedState>() { // from class: androidx.recyclerview.widget.RecyclerView.SavedState.1
/* JADX WARN: Can't rename method to resolve collision */
@Override // android.os.Parcelable.ClassLoaderCreator
public SavedState createFromParcel(Parcel parcel, ClassLoader classLoader) {
return new SavedState(parcel, classLoader);
}
@Override // android.os.Parcelable.Creator
public SavedState createFromParcel(Parcel parcel) {
return new SavedState(parcel, null);
}
@Override // android.os.Parcelable.Creator
public SavedState[] newArray(int i) {
return new SavedState[i];
}
};
Parcelable mLayoutState;
public SavedState(Parcel parcel, ClassLoader classLoader) {
super(parcel, classLoader);
this.mLayoutState = parcel.readParcelable(classLoader == null ? LayoutManager.class.getClassLoader() : classLoader);
}
public SavedState(Parcelable parcelable) {
super(parcelable);
}
@Override // androidx.customview.view.AbsSavedState, android.os.Parcelable
public void writeToParcel(Parcel parcel, int i) {
super.writeToParcel(parcel, i);
parcel.writeParcelable(this.mLayoutState, 0);
}
public void copyFrom(SavedState savedState) {
this.mLayoutState = savedState.mLayoutState;
}
}
public static class State {
static final int STEP_ANIMATIONS = 4;
static final int STEP_LAYOUT = 2;
static final int STEP_START = 1;
private SparseArray<Object> mData;
long mFocusedItemId;
int mFocusedItemPosition;
int mFocusedSubChildId;
int mRemainingScrollHorizontal;
int mRemainingScrollVertical;
int mTargetPosition = -1;
int mPreviousLayoutItemCount = 0;
int mDeletedInvisibleItemCountSincePreviousLayout = 0;
int mLayoutStep = 1;
int mItemCount = 0;
boolean mStructureChanged = false;
boolean mInPreLayout = false;
boolean mTrackOldChangeHolders = false;
boolean mIsMeasuring = false;
boolean mRunSimpleAnimations = false;
boolean mRunPredictiveAnimations = false;
public boolean didStructureChange() {
return this.mStructureChanged;
}
public int getItemCount() {
return this.mInPreLayout ? this.mPreviousLayoutItemCount - this.mDeletedInvisibleItemCountSincePreviousLayout : this.mItemCount;
}
public int getRemainingScrollHorizontal() {
return this.mRemainingScrollHorizontal;
}
public int getRemainingScrollVertical() {
return this.mRemainingScrollVertical;
}
public int getTargetScrollPosition() {
return this.mTargetPosition;
}
public boolean hasTargetScrollPosition() {
return this.mTargetPosition != -1;
}
public boolean isMeasuring() {
return this.mIsMeasuring;
}
public boolean isPreLayout() {
return this.mInPreLayout;
}
public boolean willRunPredictiveAnimations() {
return this.mRunPredictiveAnimations;
}
public boolean willRunSimpleAnimations() {
return this.mRunSimpleAnimations;
}
public void assertLayoutStep(int i) {
if ((this.mLayoutStep & i) != 0) {
return;
}
throw new IllegalStateException("Layout state should be one of " + Integer.toBinaryString(i) + " but it is " + Integer.toBinaryString(this.mLayoutStep));
}
public void prepareForNestedPrefetch(Adapter adapter) {
this.mLayoutStep = 1;
this.mItemCount = adapter.getItemCount();
this.mInPreLayout = false;
this.mTrackOldChangeHolders = false;
this.mIsMeasuring = false;
}
public void remove(int i) {
SparseArray<Object> sparseArray = this.mData;
if (sparseArray == null) {
return;
}
sparseArray.remove(i);
}
public <T> T get(int i) {
SparseArray<Object> sparseArray = this.mData;
if (sparseArray == null) {
return null;
}
return (T) sparseArray.get(i);
}
public void put(int i, Object obj) {
if (this.mData == null) {
this.mData = new SparseArray<>();
}
this.mData.put(i, obj);
}
public String toString() {
return "State{mTargetPosition=" + this.mTargetPosition + ", mData=" + this.mData + ", mItemCount=" + this.mItemCount + ", mIsMeasuring=" + this.mIsMeasuring + ", mPreviousLayoutItemCount=" + this.mPreviousLayoutItemCount + ", mDeletedInvisibleItemCountSincePreviousLayout=" + this.mDeletedInvisibleItemCountSincePreviousLayout + ", mStructureChanged=" + this.mStructureChanged + ", mInPreLayout=" + this.mInPreLayout + ", mRunSimpleAnimations=" + this.mRunSimpleAnimations + ", mRunPredictiveAnimations=" + this.mRunPredictiveAnimations + '}';
}
}
public class ItemAnimatorRestoreListener implements ItemAnimator.ItemAnimatorListener {
public ItemAnimatorRestoreListener() {
}
@Override // androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemAnimatorListener
public void onAnimationFinished(ViewHolder viewHolder) {
viewHolder.setIsRecyclable(true);
if (viewHolder.mShadowedHolder != null && viewHolder.mShadowingHolder == null) {
viewHolder.mShadowedHolder = null;
}
viewHolder.mShadowingHolder = null;
if (viewHolder.shouldBeKeptAsChild() || RecyclerView.this.removeAnimatingView(viewHolder.itemView) || !viewHolder.isTmpDetached()) {
return;
}
RecyclerView.this.removeDetachedView(viewHolder.itemView, false);
}
}
public static abstract class ItemAnimator {
public static final int FLAG_APPEARED_IN_PRE_LAYOUT = 4096;
public static final int FLAG_CHANGED = 2;
public static final int FLAG_INVALIDATED = 4;
public static final int FLAG_MOVED = 2048;
public static final int FLAG_REMOVED = 8;
private ItemAnimatorListener mListener = null;
private ArrayList<ItemAnimatorFinishedListener> mFinishedListeners = new ArrayList<>();
private long mAddDuration = 120;
private long mRemoveDuration = 120;
private long mMoveDuration = 250;
private long mChangeDuration = 250;
@Retention(RetentionPolicy.SOURCE)
public @interface AdapterChanges {
}
public interface ItemAnimatorFinishedListener {
void onAnimationsFinished();
}
public interface ItemAnimatorListener {
void onAnimationFinished(@NonNull ViewHolder viewHolder);
}
public abstract boolean animateAppearance(@NonNull ViewHolder viewHolder, @Nullable ItemHolderInfo itemHolderInfo, @NonNull ItemHolderInfo itemHolderInfo2);
public abstract boolean animateChange(@NonNull ViewHolder viewHolder, @NonNull ViewHolder viewHolder2, @NonNull ItemHolderInfo itemHolderInfo, @NonNull ItemHolderInfo itemHolderInfo2);
public abstract boolean animateDisappearance(@NonNull ViewHolder viewHolder, @NonNull ItemHolderInfo itemHolderInfo, @Nullable ItemHolderInfo itemHolderInfo2);
public abstract boolean animatePersistence(@NonNull ViewHolder viewHolder, @NonNull ItemHolderInfo itemHolderInfo, @NonNull ItemHolderInfo itemHolderInfo2);
public boolean canReuseUpdatedViewHolder(@NonNull ViewHolder viewHolder) {
return true;
}
public abstract void endAnimation(@NonNull ViewHolder viewHolder);
public abstract void endAnimations();
public long getAddDuration() {
return this.mAddDuration;
}
public long getChangeDuration() {
return this.mChangeDuration;
}
public long getMoveDuration() {
return this.mMoveDuration;
}
public long getRemoveDuration() {
return this.mRemoveDuration;
}
public abstract boolean isRunning();
public void onAnimationFinished(@NonNull ViewHolder viewHolder) {
}
public void onAnimationStarted(@NonNull ViewHolder viewHolder) {
}
public abstract void runPendingAnimations();
public void setAddDuration(long j) {
this.mAddDuration = j;
}
public void setChangeDuration(long j) {
this.mChangeDuration = j;
}
public void setListener(ItemAnimatorListener itemAnimatorListener) {
this.mListener = itemAnimatorListener;
}
public void setMoveDuration(long j) {
this.mMoveDuration = j;
}
public void setRemoveDuration(long j) {
this.mRemoveDuration = j;
}
@NonNull
public ItemHolderInfo recordPreLayoutInformation(@NonNull State state, @NonNull ViewHolder viewHolder, int i, @NonNull List<Object> list) {
return obtainHolderInfo().setFrom(viewHolder);
}
@NonNull
public ItemHolderInfo recordPostLayoutInformation(@NonNull State state, @NonNull ViewHolder viewHolder) {
return obtainHolderInfo().setFrom(viewHolder);
}
public static int buildAdapterChangeFlagsForAnimations(ViewHolder viewHolder) {
int i = viewHolder.mFlags;
int i2 = i & 14;
if (viewHolder.isInvalid()) {
return 4;
}
if ((i & 4) != 0) {
return i2;
}
int oldPosition = viewHolder.getOldPosition();
int absoluteAdapterPosition = viewHolder.getAbsoluteAdapterPosition();
return (oldPosition == -1 || absoluteAdapterPosition == -1 || oldPosition == absoluteAdapterPosition) ? i2 : i2 | 2048;
}
public final void dispatchAnimationFinished(@NonNull ViewHolder viewHolder) {
onAnimationFinished(viewHolder);
ItemAnimatorListener itemAnimatorListener = this.mListener;
if (itemAnimatorListener != null) {
itemAnimatorListener.onAnimationFinished(viewHolder);
}
}
public final void dispatchAnimationStarted(@NonNull ViewHolder viewHolder) {
onAnimationStarted(viewHolder);
}
public final boolean isRunning(@Nullable ItemAnimatorFinishedListener itemAnimatorFinishedListener) {
boolean isRunning = isRunning();
if (itemAnimatorFinishedListener != null) {
if (!isRunning) {
itemAnimatorFinishedListener.onAnimationsFinished();
} else {
this.mFinishedListeners.add(itemAnimatorFinishedListener);
}
}
return isRunning;
}
public boolean canReuseUpdatedViewHolder(@NonNull ViewHolder viewHolder, @NonNull List<Object> list) {
return canReuseUpdatedViewHolder(viewHolder);
}
public final void dispatchAnimationsFinished() {
int size = this.mFinishedListeners.size();
for (int i = 0; i < size; i++) {
this.mFinishedListeners.get(i).onAnimationsFinished();
}
this.mFinishedListeners.clear();
}
@NonNull
public ItemHolderInfo obtainHolderInfo() {
return new ItemHolderInfo();
}
public static class ItemHolderInfo {
public int bottom;
public int changeFlags;
public int left;
public int right;
public int top;
@NonNull
public ItemHolderInfo setFrom(@NonNull ViewHolder viewHolder) {
return setFrom(viewHolder, 0);
}
@NonNull
public ItemHolderInfo setFrom(@NonNull ViewHolder viewHolder, int i) {
View view = viewHolder.itemView;
this.left = view.getLeft();
this.top = view.getTop();
this.right = view.getRight();
this.bottom = view.getBottom();
return this;
}
}
}
@Override // android.view.ViewGroup
public int getChildDrawingOrder(int i, int i2) {
ChildDrawingOrderCallback childDrawingOrderCallback = this.mChildDrawingOrderCallback;
if (childDrawingOrderCallback == null) {
return super.getChildDrawingOrder(i, i2);
}
return childDrawingOrderCallback.onGetChildDrawingOrder(i, i2);
}
private NestedScrollingChildHelper getScrollingChildHelper() {
if (this.mScrollingChildHelper == null) {
this.mScrollingChildHelper = new NestedScrollingChildHelper(this);
}
return this.mScrollingChildHelper;
}
}