discord-jadx/app/src/main/java/androidx/recyclerview/widget/RecyclerView.java

7302 lines
299 KiB
Java

package androidx.recyclerview.widget;
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.Build;
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.Display;
import android.view.FocusFinder;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.animation.Interpolator;
import android.widget.EdgeEffect;
import android.widget.OverScroller;
import androidx.annotation.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.R;
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 c.d.b.a.a;
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;
public class RecyclerView extends ViewGroup implements ScrollingView, NestedScrollingChild2, NestedScrollingChild3 {
public static final boolean ALLOW_SIZE_IN_UNSPECIFIED_SPEC = (Build.VERSION.SDK_INT >= 23);
public static final boolean ALLOW_THREAD_GAP_WORK = true;
public static final boolean DEBUG = false;
public static final int DEFAULT_ORIENTATION = 1;
public static final boolean DISPATCH_TEMP_DETACH = false;
private static final boolean FORCE_ABS_FOCUS_SEARCH_DIRECTION = false;
public static final boolean FORCE_INVALIDATE_DISPLAY_LIST = false;
public static final long FOREVER_NS = Long.MAX_VALUE;
public static final int HORIZONTAL = 0;
private static final boolean IGNORE_DETACHED_FOCUSED_CHILD = false;
private static final int INVALID_POINTER = -1;
public static final int INVALID_TYPE = -1;
private static final Class<?>[] LAYOUT_MANAGER_CONSTRUCTOR_SIGNATURE;
public static final int MAX_SCROLL_DURATION = 2000;
private static final int[] NESTED_SCROLLING_ATTRS = {16843830};
public static final long NO_ID = -1;
public static final int NO_POSITION = -1;
public static final boolean POST_UPDATES_ON_ANIMATION = true;
public static final int SCROLL_STATE_DRAGGING = 1;
public static final int SCROLL_STATE_IDLE = 0;
public static final int SCROLL_STATE_SETTLING = 2;
public static final String TAG = "RecyclerView";
public static final int TOUCH_SLOP_DEFAULT = 0;
public static final int TOUCH_SLOP_PAGING = 1;
public static final String TRACE_BIND_VIEW_TAG = "RV OnBindView";
public static final String TRACE_CREATE_VIEW_TAG = "RV CreateView";
private static final String TRACE_HANDLE_ADAPTER_UPDATES_TAG = "RV PartialInvalidate";
public 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";
public static final String TRACE_PREFETCH_TAG = "RV Prefetch";
public static final String TRACE_SCROLL_TAG = "RV Scroll";
public static final int UNDEFINED_DURATION = Integer.MIN_VALUE;
public static final boolean VERBOSE_TRACING = false;
public static final int VERTICAL = 1;
public static final Interpolator sQuinticInterpolator = new AnonymousClass3();
public RecyclerViewAccessibilityDelegate mAccessibilityDelegate;
private final AccessibilityManager mAccessibilityManager;
public Adapter mAdapter;
public AdapterHelper mAdapterHelper;
public boolean mAdapterUpdateDuringMeasure;
private EdgeEffect mBottomGlow;
private ChildDrawingOrderCallback mChildDrawingOrderCallback;
public ChildHelper mChildHelper;
public boolean mClipToPadding;
public boolean mDataSetHasChangedAfterLayout;
public boolean mDispatchItemsChangedEvent;
private int mDispatchScrollCounter;
private int mEatenAccessibilityChangeFlags;
@NonNull
private EdgeEffectFactory mEdgeEffectFactory;
public boolean mEnableFastScroller;
@VisibleForTesting
public boolean mFirstLayoutComplete;
public GapWorker mGapWorker;
public boolean mHasFixedSize;
private boolean mIgnoreMotionEventTillDown;
private int mInitialTouchX;
private int mInitialTouchY;
private int mInterceptRequestLayoutDepth;
private OnItemTouchListener mInterceptingOnItemTouchListener;
public boolean mIsAttached;
public ItemAnimator mItemAnimator;
private ItemAnimator.ItemAnimatorListener mItemAnimatorListener;
private Runnable mItemAnimatorRunner;
public final ArrayList<ItemDecoration> mItemDecorations;
public boolean mItemsAddedOrRemoved;
public boolean mItemsChanged;
private int mLastTouchX;
private int mLastTouchY;
@VisibleForTesting
public LayoutManager mLayout;
private int mLayoutOrScrollCounter;
public boolean mLayoutSuppressed;
public 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
public final List<ViewHolder> mPendingAccessibilityImportanceChange;
private SavedState mPendingSavedState;
public boolean mPostedAnimatorRunner;
public GapWorker.LayoutPrefetchRegistryImpl mPrefetchRegistry;
private boolean mPreserveFocusAfterLayout;
public final Recycler mRecycler;
public RecyclerListener mRecyclerListener;
public 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;
public final State mState;
public final Rect mTempRect;
private final Rect mTempRect2;
public final RectF mTempRectF;
private EdgeEffect mTopGlow;
private int mTouchSlop;
public final Runnable mUpdateChildViewsRunnable;
private VelocityTracker mVelocityTracker;
public final ViewFlinger mViewFlinger;
private final ViewInfoStore.ProcessCallback mViewInfoProcessCallback;
public final ViewInfoStore mViewInfoStore;
/* renamed from: androidx.recyclerview.widget.RecyclerView$1 reason: invalid class name */
public class AnonymousClass1 implements Runnable {
public AnonymousClass1() {
}
@Override // java.lang.Runnable
public void run() {
RecyclerView recyclerView = RecyclerView.this;
if (recyclerView.mFirstLayoutComplete && !recyclerView.isLayoutRequested()) {
RecyclerView recyclerView2 = RecyclerView.this;
if (!recyclerView2.mIsAttached) {
recyclerView2.requestLayout();
} else if (recyclerView2.mLayoutSuppressed) {
recyclerView2.mLayoutWasDefered = true;
} else {
recyclerView2.consumePendingUpdateOperations();
}
}
}
}
/* renamed from: androidx.recyclerview.widget.RecyclerView$2 reason: invalid class name */
public class AnonymousClass2 implements Runnable {
public AnonymousClass2() {
}
@Override // java.lang.Runnable
public void run() {
ItemAnimator itemAnimator = RecyclerView.this.mItemAnimator;
if (itemAnimator != null) {
itemAnimator.runPendingAnimations();
}
RecyclerView.this.mPostedAnimatorRunner = false;
}
}
/* renamed from: androidx.recyclerview.widget.RecyclerView$3 reason: invalid class name */
public static class AnonymousClass3 implements Interpolator {
@Override // android.animation.TimeInterpolator
public float getInterpolation(float f) {
float f2 = f - 1.0f;
return (f2 * f2 * f2 * f2 * f2) + 1.0f;
}
}
/* renamed from: androidx.recyclerview.widget.RecyclerView$4 reason: invalid class name */
public class AnonymousClass4 implements ViewInfoStore.ProcessCallback {
public AnonymousClass4() {
}
@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 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 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);
}
}
/* renamed from: androidx.recyclerview.widget.RecyclerView$5 reason: invalid class name */
public class AnonymousClass5 implements ChildHelper.Callback {
public AnonymousClass5() {
}
@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 void attachViewToParent(View view, int i, ViewGroup.LayoutParams layoutParams) {
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
if (childViewHolderInt != null) {
if (childViewHolderInt.isTmpDetached() || childViewHolderInt.shouldIgnore()) {
childViewHolderInt.clearTmpDetachFlag();
} else {
StringBuilder sb = new StringBuilder();
sb.append("Called attach on a child which is not detached: ");
sb.append(childViewHolderInt);
throw new IllegalArgumentException(a.h(RecyclerView.this, sb));
}
}
RecyclerView.access$000(RecyclerView.this, 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()) {
childViewHolderInt.addFlags(256);
} else {
StringBuilder sb = new StringBuilder();
sb.append("called detach on an already detached child ");
sb.append(childViewHolderInt);
throw new IllegalArgumentException(a.h(RecyclerView.this, sb));
}
}
RecyclerView.access$100(RecyclerView.this, i);
}
@Override // androidx.recyclerview.widget.ChildHelper.Callback
public View getChildAt(int i) {
return RecyclerView.this.getChildAt(i);
}
@Override // androidx.recyclerview.widget.ChildHelper.Callback
public int getChildCount() {
return RecyclerView.this.getChildCount();
}
@Override // androidx.recyclerview.widget.ChildHelper.Callback
public ViewHolder getChildViewHolder(View view) {
return RecyclerView.getChildViewHolderInt(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 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);
}
}
@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 void removeViewAt(int i) {
View childAt = RecyclerView.this.getChildAt(i);
if (childAt != null) {
RecyclerView.this.dispatchChildDetached(childAt);
childAt.clearAnimation();
}
RecyclerView.this.removeViewAt(i);
}
}
/* renamed from: androidx.recyclerview.widget.RecyclerView$6 reason: invalid class name */
public class AnonymousClass6 implements AdapterHelper.Callback {
public AnonymousClass6() {
}
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);
} else 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) {
RecyclerView recyclerView4 = RecyclerView.this;
recyclerView4.mLayout.onItemsMoved(recyclerView4, updateOp.positionStart, updateOp.itemCount, 1);
}
}
@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 findViewHolderForPosition;
}
return null;
}
@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 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 // 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 onDispatchFirstPass(AdapterHelper.UpdateOp updateOp) {
dispatchUpdate(updateOp);
}
@Override // androidx.recyclerview.widget.AdapterHelper.Callback
public void onDispatchSecondPass(AdapterHelper.UpdateOp updateOp) {
dispatchUpdate(updateOp);
}
}
public static abstract class Adapter<VH extends ViewHolder> {
private boolean mHasStableIds = false;
private final AdapterDataObservable mObservable = new AdapterDataObservable();
public final void bindViewHolder(@NonNull VH vh, int i) {
vh.mPosition = i;
if (hasStableIds()) {
vh.mItemId = getItemId(i);
}
vh.setFlags(1, 519);
TraceCompat.beginSection("RV OnBindView");
onBindViewHolder(vh, i, vh.getUnmodifiedPayloads());
vh.clearPayload();
ViewGroup.LayoutParams layoutParams = vh.itemView.getLayoutParams();
if (layoutParams instanceof LayoutParams) {
((LayoutParams) layoutParams).mInsetsDirty = true;
}
TraceCompat.endSection();
}
@NonNull
public final VH createViewHolder(@NonNull ViewGroup viewGroup, int i) {
try {
TraceCompat.beginSection("RV CreateView");
VH onCreateViewHolder = onCreateViewHolder(viewGroup, i);
if (onCreateViewHolder.itemView.getParent() == null) {
onCreateViewHolder.mItemViewType = i;
return onCreateViewHolder;
}
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)");
} finally {
TraceCompat.endSection();
}
}
public abstract int getItemCount();
public long getItemId(int i) {
return -1;
}
public int getItemViewType(int i) {
return 0;
}
public final boolean hasObservers() {
return this.mObservable.hasObservers();
}
public final boolean hasStableIds() {
return this.mHasStableIds;
}
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 notifyItemInserted(int i) {
this.mObservable.notifyItemRangeInserted(i, 1);
}
public final void notifyItemMoved(int i, int i2) {
this.mObservable.notifyItemMoved(i, i2);
}
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 notifyItemRangeInserted(int i, int i2) {
this.mObservable.notifyItemRangeInserted(i, i2);
}
public final void notifyItemRangeRemoved(int i, int i2) {
this.mObservable.notifyItemRangeRemoved(i, i2);
}
public final void notifyItemRemoved(int i) {
this.mObservable.notifyItemRangeRemoved(i, 1);
}
public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) {
}
public abstract void onBindViewHolder(@NonNull VH vh, int i);
public void onBindViewHolder(@NonNull VH vh, int i, @NonNull List<Object> list) {
onBindViewHolder(vh, 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 registerAdapterDataObserver(@NonNull AdapterDataObserver adapterDataObserver) {
this.mObservable.registerObserver(adapterDataObserver);
}
public void setHasStableIds(boolean z2) {
if (!hasObservers()) {
this.mHasStableIds = z2;
return;
}
throw new IllegalStateException("Cannot change whether this adapter has stable IDs while the adapter has registered observers.");
}
public void unregisterAdapterDataObserver(@NonNull AdapterDataObserver adapterDataObserver) {
this.mObservable.unregisterObserver(adapterDataObserver);
}
}
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 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);
}
}
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 static abstract class AdapterDataObserver {
public void onChanged() {
}
public void onItemRangeChanged(int i, int i2) {
}
public void onItemRangeChanged(int i, int i2, @Nullable Object obj) {
onItemRangeChanged(i, 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 interface ChildDrawingOrderCallback {
int onGetChildDrawingOrder(int i, int i2);
}
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 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 long mAddDuration = 120;
private long mChangeDuration = 250;
private ArrayList<ItemAnimatorFinishedListener> mFinishedListeners = new ArrayList<>();
private ItemAnimatorListener mListener = null;
private long mMoveDuration = 250;
private long mRemoveDuration = 120;
@Retention(RetentionPolicy.SOURCE)
public @interface AdapterChanges {
}
public interface ItemAnimatorFinishedListener {
void onAnimationsFinished();
}
public interface ItemAnimatorListener {
void onAnimationFinished(@NonNull ViewHolder viewHolder);
}
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;
}
}
public static int buildAdapterChangeFlagsForAnimations(ViewHolder viewHolder) {
int i = viewHolder.mFlags & 14;
if (viewHolder.isInvalid()) {
return 4;
}
if ((i & 4) != 0) {
return i;
}
int oldPosition = viewHolder.getOldPosition();
int adapterPosition = viewHolder.getAdapterPosition();
return (oldPosition == -1 || adapterPosition == -1 || oldPosition == adapterPosition) ? i : i | 2048;
}
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 boolean canReuseUpdatedViewHolder(@NonNull ViewHolder viewHolder, @NonNull List<Object> list) {
return canReuseUpdatedViewHolder(viewHolder);
}
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 void dispatchAnimationsFinished() {
int size = this.mFinishedListeners.size();
for (int i = 0; i < size; i++) {
this.mFinishedListeners.get(i).onAnimationsFinished();
}
this.mFinishedListeners.clear();
}
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 final boolean isRunning(@Nullable ItemAnimatorFinishedListener itemAnimatorFinishedListener) {
boolean isRunning = isRunning();
if (itemAnimatorFinishedListener != null) {
if (!isRunning) {
itemAnimatorFinishedListener.onAnimationsFinished();
} else {
this.mFinishedListeners.add(itemAnimatorFinishedListener);
}
}
return isRunning;
}
@NonNull
public ItemHolderInfo obtainHolderInfo() {
return new ItemHolderInfo();
}
public void onAnimationFinished(@NonNull ViewHolder viewHolder) {
}
public void onAnimationStarted(@NonNull ViewHolder viewHolder) {
}
@NonNull
public ItemHolderInfo recordPostLayoutInformation(@NonNull State state, @NonNull ViewHolder viewHolder) {
return obtainHolderInfo().setFrom(viewHolder);
}
@NonNull
public ItemHolderInfo recordPreLayoutInformation(@NonNull State state, @NonNull ViewHolder viewHolder, int i, @NonNull List<Object> list) {
return obtainHolderInfo().setFrom(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;
}
}
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()) {
RecyclerView.this.removeDetachedView(viewHolder.itemView, false);
}
}
}
public static abstract class ItemDecoration {
@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);
}
@Deprecated
public void onDraw(@NonNull Canvas canvas, @NonNull RecyclerView recyclerView) {
}
public void onDraw(@NonNull Canvas canvas, @NonNull RecyclerView recyclerView, @NonNull State state) {
onDraw(canvas, recyclerView);
}
@Deprecated
public void onDrawOver(@NonNull Canvas canvas, @NonNull RecyclerView recyclerView) {
}
public void onDrawOver(@NonNull Canvas canvas, @NonNull RecyclerView recyclerView, @NonNull State state) {
onDrawOver(canvas, recyclerView);
}
}
public static abstract class LayoutManager {
public boolean mAutoMeasure = false;
public ChildHelper mChildHelper;
private int mHeight;
private int mHeightMode;
public ViewBoundsCheck mHorizontalBoundCheck;
private final ViewBoundsCheck.Callback mHorizontalBoundCheckCallback;
public boolean mIsAttachedToWindow = false;
private boolean mItemPrefetchEnabled = true;
private boolean mMeasurementCacheEnabled = true;
public int mPrefetchMaxCountObserved;
public boolean mPrefetchMaxObservedInInitialPrefetch;
public RecyclerView mRecyclerView;
public boolean mRequestedSimpleAnimations = false;
@Nullable
public SmoothScroller mSmoothScroller;
public ViewBoundsCheck mVerticalBoundCheck;
private final ViewBoundsCheck.Callback mVerticalBoundCheckCallback;
private int mWidth;
private int mWidthMode;
/* renamed from: androidx.recyclerview.widget.RecyclerView$LayoutManager$1 reason: invalid class name */
public class AnonymousClass1 implements ViewBoundsCheck.Callback {
public AnonymousClass1() {
}
@Override // androidx.recyclerview.widget.ViewBoundsCheck.Callback
public View getChildAt(int i) {
return LayoutManager.this.getChildAt(i);
}
@Override // androidx.recyclerview.widget.ViewBoundsCheck.Callback
public int getChildEnd(View view) {
return LayoutManager.this.getDecoratedRight(view) + ((ViewGroup.MarginLayoutParams) ((LayoutParams) view.getLayoutParams())).rightMargin;
}
@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 getParentEnd() {
return LayoutManager.this.getWidth() - LayoutManager.this.getPaddingRight();
}
@Override // androidx.recyclerview.widget.ViewBoundsCheck.Callback
public int getParentStart() {
return LayoutManager.this.getPaddingLeft();
}
}
/* renamed from: androidx.recyclerview.widget.RecyclerView$LayoutManager$2 reason: invalid class name */
public class AnonymousClass2 implements ViewBoundsCheck.Callback {
public AnonymousClass2() {
}
@Override // androidx.recyclerview.widget.ViewBoundsCheck.Callback
public View getChildAt(int i) {
return LayoutManager.this.getChildAt(i);
}
@Override // androidx.recyclerview.widget.ViewBoundsCheck.Callback
public int getChildEnd(View view) {
return LayoutManager.this.getDecoratedBottom(view) + ((ViewGroup.MarginLayoutParams) ((LayoutParams) view.getLayoutParams())).bottomMargin;
}
@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 getParentEnd() {
return LayoutManager.this.getHeight() - LayoutManager.this.getPaddingBottom();
}
@Override // androidx.recyclerview.widget.ViewBoundsCheck.Callback
public int getParentStart() {
return LayoutManager.this.getPaddingTop();
}
}
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 LayoutManager() {
AnonymousClass1 r0 = new AnonymousClass1();
this.mHorizontalBoundCheckCallback = r0;
AnonymousClass2 r1 = new AnonymousClass2();
this.mVerticalBoundCheckCallback = r1;
this.mHorizontalBoundCheck = new ViewBoundsCheck(r0);
this.mVerticalBoundCheck = new ViewBoundsCheck(r1);
}
private void addViewInt(View view, int i, boolean z2) {
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
if (z2 || 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) {
StringBuilder L = a.L("Added View has RecyclerView as parent but view is not a real child. Unfiltered index:");
L.append(this.mRecyclerView.indexOfChild(view));
throw new IllegalStateException(a.h(this.mRecyclerView, L));
} else 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 static int chooseSize(int i, int i2, int i3) {
int mode = View.MeasureSpec.getMode(i);
int size = View.MeasureSpec.getSize(i);
return mode != Integer.MIN_VALUE ? mode != 1073741824 ? Math.max(i2, i3) : size : Math.min(size, Math.max(i2, i3));
}
private void detachViewInternal(int i, @NonNull View view) {
this.mChildHelper.detachViewFromParent(i);
}
/* JADX WARNING: Code restructure failed: missing block: B:6:0x0017, code lost:
if (r5 == 1073741824) goto L_0x0021;
*/
public static int getChildMeasureSpec(int i, int i2, int i3, int i4, boolean z2) {
int max = Math.max(0, i - i3);
if (z2) {
if (i4 < 0) {
if (i4 == -1) {
if (i2 != Integer.MIN_VALUE) {
if (i2 != 0) {
}
}
i4 = max;
return View.MeasureSpec.makeMeasureSpec(i4, i2);
}
i2 = 0;
i4 = 0;
return View.MeasureSpec.makeMeasureSpec(i4, i2);
}
} else if (i4 < 0) {
if (i4 != -1) {
if (i4 == -2) {
i2 = (i2 == Integer.MIN_VALUE || i2 == 1073741824) ? Integer.MIN_VALUE : 0;
}
i2 = 0;
i4 = 0;
return View.MeasureSpec.makeMeasureSpec(i4, i2);
}
i4 = max;
return View.MeasureSpec.makeMeasureSpec(i4, i2);
}
i2 = 1073741824;
return View.MeasureSpec.makeMeasureSpec(i4, i2);
}
/* JADX WARNING: Code restructure failed: missing block: B:2:0x000a, code lost:
if (r3 >= 0) goto L_0x0011;
*/
@Deprecated
public static int getChildMeasureSpec(int i, int i2, int i3, boolean z2) {
int i4 = i - i2;
int i5 = 0;
int max = Math.max(0, i4);
if (!z2) {
if (i3 < 0) {
if (i3 == -1) {
i5 = 1073741824;
} else if (i3 == -2) {
i5 = Integer.MIN_VALUE;
}
i3 = max;
return View.MeasureSpec.makeMeasureSpec(i3, i5);
}
i5 = 1073741824;
return View.MeasureSpec.makeMeasureSpec(i3, i5);
}
i3 = 0;
return View.MeasureSpec.makeMeasureSpec(i3, i5);
}
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x0072: APUT (r0v1 int[]), (0 ??[int, short, byte, char]), (r3v3 int) */
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 static Properties getProperties(@NonNull Context context, @Nullable AttributeSet attributeSet, int i, int i2) {
Properties properties = new Properties();
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.RecyclerView, i, i2);
properties.orientation = obtainStyledAttributes.getInt(R.styleable.RecyclerView_android_orientation, 1);
properties.spanCount = obtainStyledAttributes.getInt(R.styleable.RecyclerView_spanCount, 1);
properties.reverseLayout = obtainStyledAttributes.getBoolean(R.styleable.RecyclerView_reverseLayout, false);
properties.stackFromEnd = obtainStyledAttributes.getBoolean(R.styleable.RecyclerView_stackFromEnd, false);
obtainStyledAttributes.recycle();
return properties;
}
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;
}
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;
}
private void scrapOrRecycleView(Recycler recycler, int i, View view) {
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
if (!childViewHolderInt.shouldIgnore()) {
if (!childViewHolderInt.isInvalid() || childViewHolderInt.isRemoved() || this.mRecyclerView.mAdapter.hasStableIds()) {
detachViewAt(i);
recycler.scrapView(view);
this.mRecyclerView.mViewInfoStore.onViewDetached(childViewHolderInt);
return;
}
removeViewAt(i);
recycler.recycleViewHolderInternal(childViewHolderInt);
}
}
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);
}
public void assertInLayoutOrScroll(String str) {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
recyclerView.assertInLayoutOrScroll(str);
}
}
public void assertNotInLayoutOrScroll(String str) {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
recyclerView.assertNotInLayoutOrScroll(str);
}
}
public void attachView(@NonNull View view) {
attachView(view, -1);
}
public void attachView(@NonNull View view, int i) {
attachView(view, i, (LayoutParams) view.getLayoutParams());
}
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 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 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 void detachAndScrapAttachedViews(@NonNull Recycler recycler) {
for (int childCount = getChildCount() - 1; childCount >= 0; childCount--) {
scrapOrRecycleView(recycler, childCount, getChildAt(childCount));
}
}
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 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));
}
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 endAnimation(View view) {
ItemAnimator itemAnimator = this.mRecyclerView.mItemAnimator;
if (itemAnimator != null) {
itemAnimator.endAnimation(RecyclerView.getChildViewHolderInt(view));
}
}
@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 abstract LayoutParams generateDefaultLayoutParams();
public LayoutParams generateLayoutParams(Context context, AttributeSet attributeSet) {
return new LayoutParams(context, attributeSet);
}
public LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
return layoutParams instanceof LayoutParams ? new LayoutParams((LayoutParams) layoutParams) : layoutParams instanceof ViewGroup.MarginLayoutParams ? new LayoutParams((ViewGroup.MarginLayoutParams) layoutParams) : new LayoutParams(layoutParams);
}
public int getBaseline() {
return -1;
}
public int getBottomDecorationHeight(@NonNull View view) {
return ((LayoutParams) view.getLayoutParams()).mDecorInsets.bottom;
}
@Nullable
public View getChildAt(int i) {
ChildHelper childHelper = this.mChildHelper;
if (childHelper != null) {
return childHelper.getChildAt(i);
}
return null;
}
public int getChildCount() {
ChildHelper childHelper = this.mChildHelper;
if (childHelper != null) {
return childHelper.getChildCount();
}
return 0;
}
public boolean getClipToPadding() {
RecyclerView recyclerView = this.mRecyclerView;
return recyclerView != null && recyclerView.mClipToPadding;
}
public int getColumnCountForAccessibility(@NonNull Recycler recycler, @NonNull State state) {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView == null || recyclerView.mAdapter == null || !canScrollHorizontally()) {
return 1;
}
return this.mRecyclerView.mAdapter.getItemCount();
}
public int getDecoratedBottom(@NonNull View view) {
return getBottomDecorationHeight(view) + view.getBottom();
}
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 getDecoratedMeasuredHeight(@NonNull View view) {
Rect rect = ((LayoutParams) view.getLayoutParams()).mDecorInsets;
return view.getMeasuredHeight() + rect.top + rect.bottom;
}
public int getDecoratedMeasuredWidth(@NonNull View view) {
Rect rect = ((LayoutParams) view.getLayoutParams()).mDecorInsets;
return view.getMeasuredWidth() + rect.left + rect.right;
}
public int getDecoratedRight(@NonNull View view) {
return getRightDecorationWidth(view) + view.getRight();
}
public int getDecoratedTop(@NonNull View view) {
return view.getTop() - getTopDecorationHeight(view);
}
@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;
}
@Px
public int getHeight() {
return this.mHeight;
}
public int getHeightMode() {
return this.mHeightMode;
}
public int getItemCount() {
RecyclerView recyclerView = this.mRecyclerView;
Adapter adapter = recyclerView != null ? recyclerView.getAdapter() : null;
if (adapter != null) {
return adapter.getItemCount();
}
return 0;
}
public int getItemViewType(@NonNull View view) {
return RecyclerView.getChildViewHolderInt(view).getItemViewType();
}
public int getLayoutDirection() {
return ViewCompat.getLayoutDirection(this.mRecyclerView);
}
public int getLeftDecorationWidth(@NonNull View view) {
return ((LayoutParams) view.getLayoutParams()).mDecorInsets.left;
}
@Px
public int getMinimumHeight() {
return ViewCompat.getMinimumHeight(this.mRecyclerView);
}
@Px
public int getMinimumWidth() {
return ViewCompat.getMinimumWidth(this.mRecyclerView);
}
@Px
public int getPaddingBottom() {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
return recyclerView.getPaddingBottom();
}
return 0;
}
@Px
public int getPaddingEnd() {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
return ViewCompat.getPaddingEnd(recyclerView);
}
return 0;
}
@Px
public int getPaddingLeft() {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
return recyclerView.getPaddingLeft();
}
return 0;
}
@Px
public int getPaddingRight() {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
return recyclerView.getPaddingRight();
}
return 0;
}
@Px
public int getPaddingStart() {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
return ViewCompat.getPaddingStart(recyclerView);
}
return 0;
}
@Px
public int getPaddingTop() {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
return recyclerView.getPaddingTop();
}
return 0;
}
public int getPosition(@NonNull View view) {
return ((LayoutParams) view.getLayoutParams()).getViewLayoutPosition();
}
public int getRightDecorationWidth(@NonNull View view) {
return ((LayoutParams) view.getLayoutParams()).mDecorInsets.right;
}
public int getRowCountForAccessibility(@NonNull Recycler recycler, @NonNull State state) {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView == null || recyclerView.mAdapter == null || !canScrollVertically()) {
return 1;
}
return this.mRecyclerView.mAdapter.getItemCount();
}
public int getSelectionModeForAccessibility(@NonNull Recycler recycler, @NonNull State state) {
return 0;
}
public int getTopDecorationHeight(@NonNull View view) {
return ((LayoutParams) view.getLayoutParams()).mDecorInsets.top;
}
public void getTransformedBoundingBox(@NonNull View view, boolean z2, @NonNull Rect rect) {
Matrix matrix;
if (z2) {
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((double) rectF.left), (int) Math.floor((double) rectF.top), (int) Math.ceil((double) rectF.right), (int) Math.ceil((double) rectF.bottom));
}
rect.offset(view.getLeft(), view.getTop());
}
@Px
public int getWidth() {
return this.mWidth;
}
public int getWidthMode() {
return this.mWidthMode;
}
public boolean hasFlexibleChildInBothOrientations() {
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
ViewGroup.LayoutParams layoutParams = getChildAt(i).getLayoutParams();
if (layoutParams.width < 0 && layoutParams.height < 0) {
return true;
}
}
return false;
}
public boolean hasFocus() {
RecyclerView recyclerView = this.mRecyclerView;
return recyclerView != null && recyclerView.hasFocus();
}
public void ignoreView(@NonNull View view) {
ViewParent parent = view.getParent();
RecyclerView recyclerView = this.mRecyclerView;
if (parent != recyclerView || recyclerView.indexOfChild(view) == -1) {
throw new IllegalArgumentException(a.h(this.mRecyclerView, a.L("View should be fully attached to be ignored")));
}
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
childViewHolderInt.addFlags(128);
this.mRecyclerView.mViewInfoStore.removeViewHolder(childViewHolderInt);
}
public boolean isAttachedToWindow() {
return this.mIsAttachedToWindow;
}
public boolean isAutoMeasureEnabled() {
return this.mAutoMeasure;
}
public boolean isFocused() {
RecyclerView recyclerView = this.mRecyclerView;
return recyclerView != null && recyclerView.isFocused();
}
public final boolean isItemPrefetchEnabled() {
return this.mItemPrefetchEnabled;
}
public boolean isLayoutHierarchical(@NonNull Recycler recycler, @NonNull State state) {
return false;
}
public boolean isMeasurementCacheEnabled() {
return this.mMeasurementCacheEnabled;
}
public boolean isSmoothScrolling() {
SmoothScroller smoothScroller = this.mSmoothScroller;
return smoothScroller != null && smoothScroller.isRunning();
}
public boolean isViewPartiallyVisible(@NonNull View view, boolean z2, boolean z3) {
boolean z4 = this.mHorizontalBoundCheck.isViewWithinBoundFlags(view, 24579) && this.mVerticalBoundCheck.isViewWithinBoundFlags(view, 24579);
return z2 ? z4 : !z4;
}
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 measureChild(@NonNull View view, int i, int i2) {
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
Rect itemDecorInsetsForChild = this.mRecyclerView.getItemDecorInsetsForChild(view);
int i3 = itemDecorInsetsForChild.left + itemDecorInsetsForChild.right + i;
int i4 = itemDecorInsetsForChild.top + itemDecorInsetsForChild.bottom + i2;
int childMeasureSpec = getChildMeasureSpec(getWidth(), getWidthMode(), getPaddingRight() + getPaddingLeft() + i3, ((ViewGroup.MarginLayoutParams) layoutParams).width, canScrollHorizontally());
int childMeasureSpec2 = getChildMeasureSpec(getHeight(), getHeightMode(), getPaddingBottom() + getPaddingTop() + i4, ((ViewGroup.MarginLayoutParams) layoutParams).height, canScrollVertically());
if (shouldMeasureChild(view, childMeasureSpec, childMeasureSpec2, layoutParams)) {
view.measure(childMeasureSpec, childMeasureSpec2);
}
}
public void measureChildWithMargins(@NonNull View view, int i, int i2) {
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
Rect itemDecorInsetsForChild = this.mRecyclerView.getItemDecorInsetsForChild(view);
int i3 = itemDecorInsetsForChild.left + itemDecorInsetsForChild.right + i;
int i4 = itemDecorInsetsForChild.top + itemDecorInsetsForChild.bottom + i2;
int childMeasureSpec = getChildMeasureSpec(getWidth(), getWidthMode(), getPaddingRight() + getPaddingLeft() + ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin + i3, ((ViewGroup.MarginLayoutParams) layoutParams).width, canScrollHorizontally());
int childMeasureSpec2 = getChildMeasureSpec(getHeight(), getHeightMode(), getPaddingBottom() + getPaddingTop() + ((ViewGroup.MarginLayoutParams) layoutParams).topMargin + ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin + i4, ((ViewGroup.MarginLayoutParams) layoutParams).height, canScrollVertically());
if (shouldMeasureChild(view, childMeasureSpec, childMeasureSpec2, layoutParams)) {
view.measure(childMeasureSpec, childMeasureSpec2);
}
}
public void moveView(int i, int i2) {
View childAt = getChildAt(i);
if (childAt != null) {
detachViewAt(i);
attachView(childAt, i2);
return;
}
throw new IllegalArgumentException("Cannot move a child from non-existing index:" + i + this.mRecyclerView.toString());
}
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 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) {
}
@CallSuper
public void onDetachedFromWindow(RecyclerView recyclerView, Recycler recycler) {
onDetachedFromWindow(recyclerView);
}
@Nullable
public View onFocusSearchFailed(@NonNull View view, int i, @NonNull Recycler recycler, @NonNull State state) {
return null;
}
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) {
boolean z2 = true;
if (!recyclerView.canScrollVertically(1) && !this.mRecyclerView.canScrollVertically(-1) && !this.mRecyclerView.canScrollHorizontally(-1) && !this.mRecyclerView.canScrollHorizontally(1)) {
z2 = false;
}
accessibilityEvent.setScrollable(z2);
Adapter adapter = this.mRecyclerView.mAdapter;
if (adapter != null) {
accessibilityEvent.setItemCount(adapter.getItemCount());
}
}
}
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 onInitializeAccessibilityNodeInfoForItem(View view, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) {
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
if (childViewHolderInt != null && !childViewHolderInt.isRemoved() && !this.mChildHelper.isHidden(childViewHolderInt.itemView)) {
RecyclerView recyclerView = this.mRecyclerView;
onInitializeAccessibilityNodeInfoForItem(recyclerView.mRecycler, recyclerView.mState, view, accessibilityNodeInfoCompat);
}
}
public void onInitializeAccessibilityNodeInfoForItem(@NonNull Recycler recycler, @NonNull State state, @NonNull View view, @NonNull AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) {
accessibilityNodeInfoCompat.setCollectionItemInfo(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain(canScrollVertically() ? getPosition(view) : 0, 1, canScrollHorizontally() ? getPosition(view) : 0, 1, false, false));
}
@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 onItemsUpdated(@NonNull RecyclerView recyclerView, int i, int i2, @Nullable Object obj) {
onItemsUpdated(recyclerView, i, i2);
}
public void onLayoutChildren(Recycler recycler, State state) {
Log.e("RecyclerView", "You must override onLayoutChildren(Recycler recycler, State state) ");
}
public void onLayoutCompleted(State state) {
}
public void onMeasure(@NonNull Recycler recycler, @NonNull State state, int i, int i2) {
this.mRecyclerView.defaultOnMeasure(i, i2);
}
@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 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 performAccessibilityAction(int i, @Nullable Bundle bundle) {
RecyclerView recyclerView = this.mRecyclerView;
return performAccessibilityAction(recyclerView.mRecycler, recyclerView.mState, i, bundle);
}
/* JADX WARNING: Removed duplicated region for block: B:25:0x0075 A[ADDED_TO_REGION] */
public boolean performAccessibilityAction(@NonNull Recycler recycler, @NonNull State state, int i, @Nullable Bundle bundle) {
int i2;
int i3;
int i4;
int i5;
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView == null) {
return false;
}
if (i == 4096) {
i4 = recyclerView.canScrollVertically(1) ? (getHeight() - getPaddingTop()) - getPaddingBottom() : 0;
if (this.mRecyclerView.canScrollHorizontally(1)) {
i5 = (getWidth() - getPaddingLeft()) - getPaddingRight();
}
i2 = i4;
i3 = 0;
if (i2 != 0) {
}
this.mRecyclerView.smoothScrollBy(i3, i2, null, Integer.MIN_VALUE, true);
return true;
} else if (i != 8192) {
i3 = 0;
i2 = 0;
if (i2 != 0 && i3 == 0) {
return false;
}
this.mRecyclerView.smoothScrollBy(i3, i2, null, Integer.MIN_VALUE, true);
return true;
} else {
i4 = recyclerView.canScrollVertically(-1) ? -((getHeight() - getPaddingTop()) - getPaddingBottom()) : 0;
if (this.mRecyclerView.canScrollHorizontally(-1)) {
i5 = -((getWidth() - getPaddingLeft()) - getPaddingRight());
}
i2 = i4;
i3 = 0;
if (i2 != 0) {
}
this.mRecyclerView.smoothScrollBy(i3, i2, null, Integer.MIN_VALUE, true);
return true;
}
i2 = i4;
i3 = i5;
if (i2 != 0) {
}
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 boolean performAccessibilityActionForItem(@NonNull Recycler recycler, @NonNull State state, @NonNull View view, int i, @Nullable Bundle bundle) {
return false;
}
public void postOnAnimation(Runnable runnable) {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
ViewCompat.postOnAnimation(recyclerView, runnable);
}
}
public void removeAllViews() {
for (int childCount = getChildCount() - 1; childCount >= 0; childCount--) {
this.mChildHelper.removeViewAt(childCount);
}
}
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 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 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 boolean removeCallbacks(Runnable runnable) {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
return recyclerView.removeCallbacks(runnable);
}
return false;
}
public void removeDetachedView(@NonNull View view) {
this.mRecyclerView.removeDetachedView(view, false);
}
public void removeView(View view) {
this.mChildHelper.removeView(view);
}
public void removeViewAt(int i) {
if (getChildAt(i) != null) {
this.mChildHelper.removeViewAt(i);
}
}
public boolean requestChildRectangleOnScreen(@NonNull RecyclerView recyclerView, @NonNull View view, @NonNull Rect rect, boolean z2) {
return requestChildRectangleOnScreen(recyclerView, view, rect, z2, false);
}
public boolean requestChildRectangleOnScreen(@NonNull RecyclerView recyclerView, @NonNull View view, @NonNull Rect rect, boolean z2, boolean z3) {
int[] childRectangleOnScreenScrollAmount = getChildRectangleOnScreenScrollAmount(view, rect);
int i = childRectangleOnScreenScrollAmount[0];
int i2 = childRectangleOnScreenScrollAmount[1];
if ((z3 && !isFocusedChildVisibleAfterScrolling(recyclerView, i, i2)) || (i == 0 && i2 == 0)) {
return false;
}
if (z2) {
recyclerView.scrollBy(i, i2);
} else {
recyclerView.smoothScrollBy(i, i2);
}
return true;
}
public void requestLayout() {
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
recyclerView.requestLayout();
}
}
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 z2) {
this.mAutoMeasure = z2;
}
public void setExactMeasureSpecsFrom(RecyclerView recyclerView) {
setMeasureSpecs(View.MeasureSpec.makeMeasureSpec(recyclerView.getWidth(), 1073741824), View.MeasureSpec.makeMeasureSpec(recyclerView.getHeight(), 1073741824));
}
public final void setItemPrefetchEnabled(boolean z2) {
if (z2 != this.mItemPrefetchEnabled) {
this.mItemPrefetchEnabled = z2;
this.mPrefetchMaxCountObserved = 0;
RecyclerView recyclerView = this.mRecyclerView;
if (recyclerView != null) {
recyclerView.mRecycler.updateViewCacheSize();
}
}
}
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) {
this.mHeight = 0;
}
}
public void setMeasuredDimension(int i, int i2) {
RecyclerView.access$300(this.mRecyclerView, i, i2);
}
public void setMeasuredDimension(Rect rect, int i, int i2) {
setMeasuredDimension(chooseSize(i, getPaddingRight() + getPaddingLeft() + rect.width(), getMinimumWidth()), chooseSize(i2, getPaddingBottom() + getPaddingTop() + rect.height(), getMinimumHeight()));
}
public void setMeasuredDimensionFromChildren(int i, int i2) {
int childCount = getChildCount();
if (childCount == 0) {
this.mRecyclerView.defaultOnMeasure(i, i2);
return;
}
int i3 = Integer.MIN_VALUE;
int i4 = Integer.MIN_VALUE;
int i5 = Integer.MAX_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 < i5) {
i5 = i8;
}
int i9 = rect.right;
if (i9 > i3) {
i3 = i9;
}
int i10 = rect.top;
if (i10 < i6) {
i6 = i10;
}
int i11 = rect.bottom;
if (i11 > i4) {
i4 = i11;
}
}
this.mRecyclerView.mTempRect.set(i5, i6, i3, i4);
setMeasuredDimension(this.mRecyclerView.mTempRect, i, i2);
}
public void setMeasurementCacheEnabled(boolean z2) {
this.mMeasurementCacheEnabled = z2;
}
public void setRecyclerView(RecyclerView recyclerView) {
if (recyclerView == null) {
this.mRecyclerView = null;
this.mChildHelper = null;
this.mWidth = 0;
this.mHeight = 0;
} else {
this.mRecyclerView = recyclerView;
this.mChildHelper = recyclerView.mChildHelper;
this.mWidth = recyclerView.getWidth();
this.mHeight = recyclerView.getHeight();
}
this.mWidthMode = 1073741824;
this.mHeightMode = 1073741824;
}
public boolean shouldMeasureChild(View view, int i, int i2, LayoutParams layoutParams) {
return view.isLayoutRequested() || !this.mMeasurementCacheEnabled || !isMeasurementUpToDate(view.getWidth(), i, ((ViewGroup.MarginLayoutParams) layoutParams).width) || !isMeasurementUpToDate(view.getHeight(), i2, ((ViewGroup.MarginLayoutParams) layoutParams).height);
}
public boolean shouldMeasureTwice() {
return false;
}
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);
}
public void smoothScrollToPosition(RecyclerView recyclerView, State state, int i) {
Log.e("RecyclerView", "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 void stopIgnoringView(@NonNull View view) {
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
childViewHolderInt.stopIgnoring();
childViewHolderInt.resetInternal();
childViewHolderInt.addFlags(4);
}
public void stopSmoothScroller() {
SmoothScroller smoothScroller = this.mSmoothScroller;
if (smoothScroller != null) {
smoothScroller.stop();
}
}
public boolean supportsPredictiveItemAnimations() {
return false;
}
}
public static class LayoutParams extends ViewGroup.MarginLayoutParams {
public final Rect mDecorInsets = new Rect();
public boolean mInsetsDirty = true;
public boolean mPendingInvalidate = false;
public ViewHolder mViewHolder;
public LayoutParams(int i, int i2) {
super(i, i2);
}
public LayoutParams(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
public LayoutParams(ViewGroup.LayoutParams layoutParams) {
super(layoutParams);
}
public LayoutParams(ViewGroup.MarginLayoutParams marginLayoutParams) {
super(marginLayoutParams);
}
public LayoutParams(LayoutParams layoutParams) {
super((ViewGroup.LayoutParams) layoutParams);
}
public int getViewAdapterPosition() {
return this.mViewHolder.getAdapterPosition();
}
public int getViewLayoutPosition() {
return this.mViewHolder.getLayoutPosition();
}
@Deprecated
public int getViewPosition() {
return this.mViewHolder.getPosition();
}
public boolean isItemChanged() {
return this.mViewHolder.isUpdated();
}
public boolean isItemRemoved() {
return this.mViewHolder.isRemoved();
}
public boolean isViewInvalid() {
return this.mViewHolder.isInvalid();
}
public boolean viewNeedsUpdate() {
return this.mViewHolder.needsUpdate();
}
}
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 z2);
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 static class RecycledViewPool {
private static final int DEFAULT_MAX_SCRAP = 5;
private int mAttachCount = 0;
public SparseArray<ScrapData> mScrap = new SparseArray<>();
public static class ScrapData {
public long mBindRunningAverageNs = 0;
public long mCreateRunningAverageNs = 0;
public int mMaxScrap = 5;
public final ArrayList<ViewHolder> mScrapHeap = new ArrayList<>();
}
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;
}
public void attach() {
this.mAttachCount++;
}
public void clear() {
for (int i = 0; i < this.mScrap.size(); i++) {
this.mScrap.valueAt(i).mScrapHeap.clear();
}
}
public void detach() {
this.mAttachCount--;
}
public void factorInBindTime(int i, long j) {
ScrapData scrapDataForType = getScrapDataForType(i);
scrapDataForType.mBindRunningAverageNs = runningAverage(scrapDataForType.mBindRunningAverageNs, j);
}
public void factorInCreateTime(int i, long j) {
ScrapData scrapDataForType = getScrapDataForType(i);
scrapDataForType.mCreateRunningAverageNs = runningAverage(scrapDataForType.mCreateRunningAverageNs, j);
}
@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 getRecycledViewCount(int i) {
return getScrapDataForType(i).mScrapHeap.size();
}
public void onAdapterChanged(Adapter adapter, Adapter adapter2, boolean z2) {
if (adapter != null) {
detach();
}
if (!z2 && this.mAttachCount == 0) {
clear();
}
if (adapter2 != null) {
attach();
}
}
public void putRecycledView(ViewHolder viewHolder) {
int itemViewType = viewHolder.getItemViewType();
ArrayList<ViewHolder> arrayList = getScrapDataForType(itemViewType).mScrapHeap;
if (this.mScrap.get(itemViewType).mMaxScrap > arrayList.size()) {
viewHolder.resetInternal();
arrayList.add(viewHolder);
}
}
public long runningAverage(long j, long j2) {
if (j == 0) {
return j2;
}
return (j2 / 4) + ((j / 4) * 3);
}
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 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() + i;
}
}
return i;
}
public boolean willBindInTime(int i, long j, long j2) {
long j3 = getScrapDataForType(i).mBindRunningAverageNs;
return j3 == 0 || j + j3 < j2;
}
public boolean willCreateInTime(int i, long j, long j2) {
long j3 = getScrapDataForType(i).mCreateRunningAverageNs;
return j3 == 0 || j + j3 < j2;
}
}
public final class Recycler {
public static final int DEFAULT_CACHE_SIZE = 2;
public final ArrayList<ViewHolder> mAttachedScrap;
public final ArrayList<ViewHolder> mCachedViews = new ArrayList<>();
public ArrayList<ViewHolder> mChangedScrap = null;
public RecycledViewPool mRecyclerPool;
private int mRequestedCacheMax;
private final List<ViewHolder> mUnmodifiableAttachedScrap;
private ViewCacheExtension mViewCacheExtension;
public int mViewCacheMax;
public Recycler() {
ArrayList<ViewHolder> arrayList = new ArrayList<>();
this.mAttachedScrap = arrayList;
this.mUnmodifiableAttachedScrap = Collections.unmodifiableList(arrayList);
this.mRequestedCacheMax = 2;
this.mViewCacheMax = 2;
}
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) {
AccessibilityDelegateCompat itemDelegate = recyclerViewAccessibilityDelegate.getItemDelegate();
if (itemDelegate instanceof RecyclerViewAccessibilityDelegate.ItemDelegate) {
((RecyclerViewAccessibilityDelegate.ItemDelegate) itemDelegate).saveOriginalDelegate(view);
}
ViewCompat.setAccessibilityDelegate(view, itemDelegate);
}
}
}
private void invalidateDisplayListInt(ViewGroup viewGroup, boolean z2) {
for (int childCount = viewGroup.getChildCount() - 1; childCount >= 0; childCount--) {
View childAt = viewGroup.getChildAt(childCount);
if (childAt instanceof ViewGroup) {
invalidateDisplayListInt((ViewGroup) childAt, true);
}
}
if (z2) {
if (viewGroup.getVisibility() == 4) {
viewGroup.setVisibility(0);
viewGroup.setVisibility(4);
return;
}
int visibility = viewGroup.getVisibility();
viewGroup.setVisibility(4);
viewGroup.setVisibility(visibility);
}
}
private void invalidateDisplayListInt(ViewHolder viewHolder) {
View view = viewHolder.itemView;
if (view instanceof ViewGroup) {
invalidateDisplayListInt((ViewGroup) view, false);
}
}
private boolean tryBindViewHolderByDeadline(@NonNull ViewHolder viewHolder, int i, int i2, long j) {
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 addViewHolderToRecycledViewPool(@NonNull ViewHolder viewHolder, boolean z2) {
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 (z2) {
dispatchViewRecycled(viewHolder);
}
viewHolder.mOwnerRecyclerView = null;
getRecycledViewPool().putRecycledView(viewHolder);
}
public void bindViewToPosition(@NonNull View view, int i) {
LayoutParams layoutParams;
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
if (childViewHolderInt != null) {
int findPositionOffset = RecyclerView.this.mAdapterHelper.findPositionOffset(i);
if (findPositionOffset < 0 || findPositionOffset >= RecyclerView.this.mAdapter.getItemCount()) {
StringBuilder N = a.N("Inconsistency detected. Invalid item position ", i, "(offset:", findPositionOffset, ").state:");
N.append(RecyclerView.this.mState.getItemCount());
throw new IndexOutOfBoundsException(a.h(RecyclerView.this, N));
}
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;
}
boolean z2 = true;
layoutParams.mInsetsDirty = true;
layoutParams.mViewHolder = childViewHolderInt;
if (childViewHolderInt.itemView.getParent() != null) {
z2 = false;
}
layoutParams.mPendingInvalidate = z2;
return;
}
throw new IllegalArgumentException(a.h(RecyclerView.this, a.L("The view does not have a ViewHolder. You cannot pass arbitrary views to this method, they should be created by the Adapter")));
}
public void clear() {
this.mAttachedScrap.clear();
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 clearScrap() {
this.mAttachedScrap.clear();
ArrayList<ViewHolder> arrayList = this.mChangedScrap;
if (arrayList != null) {
arrayList.clear();
}
}
public int convertPreLayoutPositionToPostLayout(int i) {
if (i >= 0 && i < RecyclerView.this.mState.getItemCount()) {
return !RecyclerView.this.mState.isPreLayout() ? i : RecyclerView.this.mAdapterHelper.findPositionOffset(i);
}
StringBuilder M = a.M("invalid position ", i, ". State item count is ");
M.append(RecyclerView.this.mState.getItemCount());
throw new IndexOutOfBoundsException(a.h(RecyclerView.this, M));
}
public void dispatchViewRecycled(@NonNull ViewHolder viewHolder) {
RecyclerListener recyclerListener = RecyclerView.this.mRecyclerListener;
if (recyclerListener != null) {
recyclerListener.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 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 RecycledViewPool getRecycledViewPool() {
if (this.mRecyclerPool == null) {
this.mRecyclerPool = new RecycledViewPool();
}
return this.mRecyclerPool;
}
public int getScrapCount() {
return this.mAttachedScrap.size();
}
@NonNull
public List<ViewHolder> getScrapList() {
return this.mUnmodifiableAttachedScrap;
}
public ViewHolder getScrapOrCachedViewForId(long j, int i, boolean z2) {
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;
} else if (!z2) {
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 (!z2) {
this.mCachedViews.remove(size2);
}
return viewHolder2;
} else if (!z2) {
recycleCachedViewAt(size2);
return null;
}
}
}
}
public ViewHolder getScrapOrHiddenOrCachedHolderForPosition(int i, boolean z2) {
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 (z2 || (findHiddenNonRemovedView = RecyclerView.this.mChildHelper.findHiddenNonRemovedView(i)) == null) {
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 (!z2) {
this.mCachedViews.remove(i3);
}
return viewHolder2;
}
}
return null;
}
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(findHiddenNonRemovedView);
RecyclerView.this.mChildHelper.unhide(findHiddenNonRemovedView);
int indexOfChild = RecyclerView.this.mChildHelper.indexOfChild(findHiddenNonRemovedView);
if (indexOfChild != -1) {
RecyclerView.this.mChildHelper.detachViewFromParent(indexOfChild);
scrapView(findHiddenNonRemovedView);
childViewHolderInt.addFlags(8224);
return childViewHolderInt;
}
StringBuilder sb = new StringBuilder();
sb.append("layout index should not be -1 after unhiding a view:");
sb.append(childViewHolderInt);
throw new IllegalStateException(a.h(RecyclerView.this, sb));
}
public View getScrapViewAt(int i) {
return this.mAttachedScrap.get(i).itemView;
}
@NonNull
public View getViewForPosition(int i) {
return getViewForPosition(i, false);
}
public View getViewForPosition(int i, boolean z2) {
return tryGetViewHolderForPositionByDeadline(i, z2, Long.MAX_VALUE).itemView;
}
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 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 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, true);
}
}
}
public void offsetPositionRecordsForMove(int i, int i2) {
int i3;
int i4;
int i5;
int i6;
if (i < i2) {
i5 = -1;
i4 = i;
i3 = i2;
} else {
i5 = 1;
i3 = i;
i4 = 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) >= i4 && i6 <= i3) {
if (i6 == i) {
viewHolder.offsetPosition(i2 - i, false);
} else {
viewHolder.offsetPosition(i5, false);
}
}
}
}
public void offsetPositionRecordsForRemove(int i, int i2, boolean z2) {
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, z2);
} else if (i4 >= i) {
viewHolder.addFlags(8);
recycleCachedViewAt(size);
}
}
}
}
public void onAdapterChanged(Adapter adapter, Adapter adapter2, boolean z2) {
clear();
getRecycledViewPool().onAdapterChanged(adapter, adapter2, z2);
}
public void quickRecycleScrapView(View view) {
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
childViewHolderInt.mScrapContainer = null;
childViewHolderInt.mInChangeScrap = false;
childViewHolderInt.clearReturnedFromScrapFlag();
recycleViewHolderInternal(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 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()) {
RecyclerView.this.mItemAnimator.endAnimation(childViewHolderInt);
}
}
public void recycleViewHolderInternal(ViewHolder viewHolder) {
boolean z2 = false;
boolean z3 = true;
if (viewHolder.isScrap() || viewHolder.itemView.getParent() != null) {
StringBuilder L = a.L("Scrapped or attached views may not be recycled. isScrap:");
L.append(viewHolder.isScrap());
L.append(" isAttached:");
if (viewHolder.itemView.getParent() != null) {
z2 = true;
}
L.append(z2);
throw new IllegalArgumentException(a.h(RecyclerView.this, L));
} else if (viewHolder.isTmpDetached()) {
StringBuilder sb = new StringBuilder();
sb.append("Tmp detached view should be removed from RecyclerView before it can be recycled: ");
sb.append(viewHolder);
throw new IllegalArgumentException(a.h(RecyclerView.this, sb));
} else if (!viewHolder.shouldIgnore()) {
boolean doesTransientStatePreventRecycling = viewHolder.doesTransientStatePreventRecycling();
Adapter adapter = RecyclerView.this.mAdapter;
if ((adapter != null && doesTransientStatePreventRecycling && adapter.onFailedToRecycleView(viewHolder)) || viewHolder.isRecyclable()) {
if (this.mViewCacheMax <= 0 || viewHolder.hasAnyOfTheFlags(526)) {
z2 = 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)) {
do {
size--;
if (size < 0) {
break;
}
} while (RecyclerView.this.mPrefetchRegistry.lastPrefetchIncludedPosition(this.mCachedViews.get(size).mPosition));
size++;
}
this.mCachedViews.add(size, viewHolder);
z2 = true;
}
if (!z2) {
addViewHolderToRecycledViewPool(viewHolder, true);
RecyclerView.this.mViewInfoStore.removeViewHolder(viewHolder);
if (!z2 && !z3 && doesTransientStatePreventRecycling) {
viewHolder.mOwnerRecyclerView = null;
return;
}
return;
}
}
z3 = false;
RecyclerView.this.mViewInfoStore.removeViewHolder(viewHolder);
if (!z2) {
}
} else {
throw new IllegalArgumentException(a.h(RecyclerView.this, a.L("Trying to recycle an ignored view holder. You should first call stopIgnoringView(view) before calling recycle.")));
}
}
public void scrapView(View view) {
ViewHolder childViewHolderInt = RecyclerView.getChildViewHolderInt(view);
if (!childViewHolderInt.hasAnyOfTheFlags(12) && childViewHolderInt.isUpdated() && !RecyclerView.this.canReuseUpdatedViewHolder(childViewHolderInt)) {
if (this.mChangedScrap == null) {
this.mChangedScrap = new ArrayList<>();
}
childViewHolderInt.setScrapContainer(this, true);
this.mChangedScrap.add(childViewHolderInt);
} else if (!childViewHolderInt.isInvalid() || childViewHolderInt.isRemoved() || RecyclerView.this.mAdapter.hasStableIds()) {
childViewHolderInt.setScrapContainer(this, false);
this.mAttachedScrap.add(childViewHolderInt);
} else {
throw new IllegalArgumentException(a.h(RecyclerView.this, a.L("Called scrap view with an invalid view. Invalid views cannot be reused from scrap, they should rebound from recycler pool.")));
}
}
public void setRecycledViewPool(RecycledViewPool recycledViewPool) {
RecycledViewPool recycledViewPool2 = this.mRecyclerPool;
if (recycledViewPool2 != null) {
recycledViewPool2.detach();
}
this.mRecyclerPool = recycledViewPool;
if (recycledViewPool != null && RecyclerView.this.getAdapter() != null) {
this.mRecyclerPool.attach();
}
}
public void setViewCacheExtension(ViewCacheExtension viewCacheExtension) {
this.mViewCacheExtension = viewCacheExtension;
}
public void setViewCacheSize(int i) {
this.mRequestedCacheMax = i;
updateViewCacheSize();
}
/* JADX WARNING: Removed duplicated region for block: B:16:0x0037 */
/* JADX WARNING: Removed duplicated region for block: B:25:0x005c */
/* JADX WARNING: Removed duplicated region for block: B:27:0x005f */
/* JADX WARNING: Removed duplicated region for block: B:79:0x0176 */
/* JADX WARNING: Removed duplicated region for block: B:82:0x0199 */
/* JADX WARNING: Removed duplicated region for block: B:95:0x01d2 */
/* JADX WARNING: Removed duplicated region for block: B:96:0x01e0 */
@Nullable
public ViewHolder tryGetViewHolderForPositionByDeadline(int i, boolean z2, long j) {
boolean z3;
ViewHolder viewHolder;
ViewHolder viewHolder2;
boolean z4;
ViewGroup.LayoutParams layoutParams;
LayoutParams layoutParams2;
RecyclerView findNestedRecyclerView;
ViewCacheExtension viewCacheExtension;
View viewForPositionAndType;
if (i < 0 || i >= RecyclerView.this.mState.getItemCount()) {
StringBuilder N = a.N("Invalid item position ", i, "(", i, "). Item count:");
N.append(RecyclerView.this.mState.getItemCount());
throw new IndexOutOfBoundsException(a.h(RecyclerView.this, N));
}
boolean z5 = true;
if (RecyclerView.this.mState.isPreLayout()) {
viewHolder = getChangedScrapViewForPosition(i);
if (viewHolder != null) {
z3 = true;
if (viewHolder == null && (viewHolder = getScrapOrHiddenOrCachedHolderForPosition(i, z2)) != null) {
if (validateViewHolderForOffsetPosition(viewHolder)) {
if (!z2) {
viewHolder.addFlags(4);
if (viewHolder.isScrap()) {
RecyclerView.this.removeDetachedView(viewHolder.itemView, false);
viewHolder.unScrap();
} else if (viewHolder.wasReturnedFromScrap()) {
viewHolder.clearReturnedFromScrapFlag();
}
recycleViewHolderInternal(viewHolder);
}
viewHolder = null;
} else {
z3 = true;
}
}
if (viewHolder == null) {
int findPositionOffset = RecyclerView.this.mAdapterHelper.findPositionOffset(i);
if (findPositionOffset < 0 || findPositionOffset >= RecyclerView.this.mAdapter.getItemCount()) {
StringBuilder N2 = a.N("Inconsistency detected. Invalid item position ", i, "(offset:", findPositionOffset, ").state:");
N2.append(RecyclerView.this.mState.getItemCount());
throw new IndexOutOfBoundsException(a.h(RecyclerView.this, N2));
}
int itemViewType = RecyclerView.this.mAdapter.getItemViewType(findPositionOffset);
if (RecyclerView.this.mAdapter.hasStableIds() && (viewHolder = getScrapOrCachedViewForId(RecyclerView.this.mAdapter.getItemId(findPositionOffset), itemViewType, z2)) != null) {
viewHolder.mPosition = findPositionOffset;
z3 = true;
}
if (!(viewHolder != null || (viewCacheExtension = this.mViewCacheExtension) == null || (viewForPositionAndType = viewCacheExtension.getViewForPositionAndType(this, i, itemViewType)) == null)) {
viewHolder = RecyclerView.this.getChildViewHolder(viewForPositionAndType);
if (viewHolder == null) {
throw new IllegalArgumentException(a.h(RecyclerView.this, a.L("getViewForPositionAndType returned a view which does not have a ViewHolder")));
} else if (viewHolder.shouldIgnore()) {
throw new IllegalArgumentException(a.h(RecyclerView.this, a.L("getViewForPositionAndType returned a view that is ignored. You must call stopIgnoring before returning this view.")));
}
}
if (viewHolder == null) {
ViewHolder recycledView = getRecycledViewPool().getRecycledView(itemViewType);
if (recycledView != null) {
recycledView.resetInternal();
if (RecyclerView.FORCE_INVALIDATE_DISPLAY_LIST) {
invalidateDisplayListInt(recycledView);
}
}
viewHolder = recycledView;
}
if (viewHolder == null) {
long nanoTime = RecyclerView.this.getNanoTime();
if (j != Long.MAX_VALUE && !this.mRecyclerPool.willCreateInTime(itemViewType, nanoTime, j)) {
return null;
}
RecyclerView recyclerView = RecyclerView.this;
ViewHolder createViewHolder = recyclerView.mAdapter.createViewHolder(recyclerView, itemViewType);
if (RecyclerView.ALLOW_THREAD_GAP_WORK && (findNestedRecyclerView = RecyclerView.findNestedRecyclerView(createViewHolder.itemView)) != null) {
createViewHolder.mNestedRecyclerView = new WeakReference<>(findNestedRecyclerView);
}
this.mRecyclerPool.factorInCreateTime(itemViewType, RecyclerView.this.getNanoTime() - nanoTime);
viewHolder2 = createViewHolder;
if (z3 && !RecyclerView.this.mState.isPreLayout() && viewHolder2.hasAnyOfTheFlags(8192)) {
viewHolder2.setFlags(0, 8192);
if (RecyclerView.this.mState.mRunSimpleAnimations) {
RecyclerView recyclerView2 = RecyclerView.this;
RecyclerView.this.recordAnimationInfoIfBouncedHiddenView(viewHolder2, recyclerView2.mItemAnimator.recordPreLayoutInformation(recyclerView2.mState, viewHolder2, ItemAnimator.buildAdapterChangeFlagsForAnimations(viewHolder2) | 4096, viewHolder2.getUnmodifiedPayloads()));
}
}
if (!RecyclerView.this.mState.isPreLayout() && viewHolder2.isBound()) {
viewHolder2.mPreLayoutPosition = i;
} else if (!viewHolder2.isBound() || viewHolder2.needsUpdate() || viewHolder2.isInvalid()) {
z4 = tryBindViewHolderByDeadline(viewHolder2, RecyclerView.this.mAdapterHelper.findPositionOffset(i), i, j);
layoutParams = viewHolder2.itemView.getLayoutParams();
if (layoutParams != null) {
layoutParams2 = (LayoutParams) RecyclerView.this.generateDefaultLayoutParams();
viewHolder2.itemView.setLayoutParams(layoutParams2);
} else if (!RecyclerView.this.checkLayoutParams(layoutParams)) {
layoutParams2 = (LayoutParams) RecyclerView.this.generateLayoutParams(layoutParams);
viewHolder2.itemView.setLayoutParams(layoutParams2);
} else {
layoutParams2 = (LayoutParams) layoutParams;
}
layoutParams2.mViewHolder = viewHolder2;
if (!z3 || !z4) {
z5 = false;
}
layoutParams2.mPendingInvalidate = z5;
return viewHolder2;
}
z4 = false;
layoutParams = viewHolder2.itemView.getLayoutParams();
if (layoutParams != null) {
}
layoutParams2.mViewHolder = viewHolder2;
z5 = false;
layoutParams2.mPendingInvalidate = z5;
return viewHolder2;
}
}
viewHolder2 = viewHolder;
viewHolder2.setFlags(0, 8192);
if (RecyclerView.this.mState.mRunSimpleAnimations) {
}
if (!RecyclerView.this.mState.isPreLayout()) {
}
z4 = tryBindViewHolderByDeadline(viewHolder2, RecyclerView.this.mAdapterHelper.findPositionOffset(i), i, j);
layoutParams = viewHolder2.itemView.getLayoutParams();
if (layoutParams != null) {
}
layoutParams2.mViewHolder = viewHolder2;
z5 = false;
layoutParams2.mPendingInvalidate = z5;
return viewHolder2;
}
} else {
viewHolder = null;
}
z3 = false;
if (validateViewHolderForOffsetPosition(viewHolder)) {
}
if (viewHolder == null) {
}
viewHolder2 = viewHolder;
viewHolder2.setFlags(0, 8192);
if (RecyclerView.this.mState.mRunSimpleAnimations) {
}
if (!RecyclerView.this.mState.isPreLayout()) {
}
z4 = tryBindViewHolderByDeadline(viewHolder2, RecyclerView.this.mAdapterHelper.findPositionOffset(i), i, j);
layoutParams = viewHolder2.itemView.getLayoutParams();
if (layoutParams != null) {
}
layoutParams2.mViewHolder = viewHolder2;
z5 = false;
layoutParams2.mPendingInvalidate = z5;
return viewHolder2;
}
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 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()) {
StringBuilder sb = new StringBuilder();
sb.append("Inconsistency detected. Invalid view holder adapter position");
sb.append(viewHolder);
throw new IndexOutOfBoundsException(a.h(RecyclerView.this, sb));
} else 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);
} else {
return false;
}
}
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 interface RecyclerListener {
void onViewRecycled(@NonNull ViewHolder viewHolder);
}
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()) {
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 onItemRangeMoved(int i, int i2, int i3) {
RecyclerView.this.assertNotInLayoutOrScroll(null);
if (RecyclerView.this.mAdapterHelper.onItemRangeMoved(i, i2, i3)) {
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();
}
}
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();
}
}
@RestrictTo({RestrictTo.Scope.LIBRARY})
public static class SavedState extends AbsSavedState {
public static final Parcelable.Creator<SavedState> CREATOR = new AnonymousClass1();
public Parcelable mLayoutState;
/* renamed from: androidx.recyclerview.widget.RecyclerView$SavedState$1 reason: invalid class name */
public static class AnonymousClass1 implements Parcelable.ClassLoaderCreator<SavedState> {
@Override // android.os.Parcelable.Creator
public SavedState createFromParcel(Parcel parcel) {
return new SavedState(parcel, null);
}
@Override // android.os.Parcelable.ClassLoaderCreator
public SavedState createFromParcel(Parcel parcel, ClassLoader classLoader) {
return new SavedState(parcel, classLoader);
}
@Override // android.os.Parcelable.Creator
public SavedState[] newArray(int i) {
return new SavedState[i];
}
}
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);
}
public void copyFrom(SavedState savedState) {
this.mLayoutState = savedState.mLayoutState;
}
@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 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 z2) {
}
@Override // androidx.recyclerview.widget.RecyclerView.OnItemTouchListener
public void onTouchEvent(@NonNull RecyclerView recyclerView, @NonNull MotionEvent motionEvent) {
}
}
public static abstract class SmoothScroller {
private LayoutManager mLayoutManager;
private boolean mPendingInitialRun;
private RecyclerView mRecyclerView;
private final Action mRecyclingAction = new Action(0, 0);
private boolean mRunning;
private boolean mStarted;
private int mTargetPosition = -1;
private View mTargetView;
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 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;
}
private void validate() {
if (this.mInterpolator != null && this.mDuration < 1) {
throw new IllegalStateException("If you provide an interpolator, you must set a positive duration");
} else if (this.mDuration < 1) {
throw new IllegalStateException("Scroll duration must be a positive number");
}
}
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 runIfNecessary(RecyclerView recyclerView) {
int i = this.mJumpToPosition;
if (i >= 0) {
this.mJumpToPosition = -1;
recyclerView.jumpToPositionForSmoothScroller(i);
this.mChanged = false;
} else if (this.mChanged) {
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", "Smooth Scroll action is being updated too frequently. Make sure you are not changing it unless necessary");
}
this.mChanged = false;
} else {
this.mConsecutiveUpdates = 0;
}
}
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 interface ScrollVectorProvider {
@Nullable
PointF computeScrollVectorForPosition(int i);
}
@Nullable
public PointF computeScrollVectorForPosition(int i) {
LayoutManager layoutManager = getLayoutManager();
if (layoutManager instanceof ScrollVectorProvider) {
return ((ScrollVectorProvider) layoutManager).computeScrollVectorForPosition(i);
}
StringBuilder L = a.L("You should override computeScrollVectorForPosition when the LayoutManager does not implement ");
L.append(ScrollVectorProvider.class.getCanonicalName());
Log.w("RecyclerView", L.toString());
return null;
}
public View findViewByPosition(int i) {
return this.mRecyclerView.mLayout.findViewByPosition(i);
}
public int getChildCount() {
return this.mRecyclerView.mLayout.getChildCount();
}
public int getChildPosition(View view) {
return this.mRecyclerView.getChildLayoutPosition(view);
}
@Nullable
public LayoutManager getLayoutManager() {
return this.mLayoutManager;
}
public int getTargetPosition() {
return this.mTargetPosition;
}
@Deprecated
public void instantScrollToPosition(int i) {
this.mRecyclerView.scrollToPosition(i);
}
public boolean isPendingInitialRun() {
return this.mPendingInitialRun;
}
public boolean isRunning() {
return this.mRunning;
}
public void normalize(@NonNull PointF pointF) {
float f = pointF.x;
float f2 = pointF.y;
float sqrt = (float) Math.sqrt((double) ((f2 * f2) + (f * f)));
pointF.x /= sqrt;
pointF.y /= sqrt;
}
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", "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 void onChildAttachedToWindow(View view) {
if (getChildPosition(view) == getTargetPosition()) {
this.mTargetView = view;
}
}
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) {
StringBuilder L = a.L("An instance of ");
L.append(getClass().getSimpleName());
L.append(" was started more than once. Each instance of");
L.append(getClass().getSimpleName());
L.append(" is intended to only be used once. You should create a new instance for each use.");
Log.w("RecyclerView", L.toString());
}
this.mRecyclerView = recyclerView;
this.mLayoutManager = layoutManager;
int i = this.mTargetPosition;
if (i != -1) {
recyclerView.mState.mTargetPosition = i;
this.mRunning = true;
this.mPendingInitialRun = true;
this.mTargetView = findViewByPosition(getTargetPosition());
onStart();
this.mRecyclerView.mViewFlinger.postOnAnimation();
this.mStarted = true;
return;
}
throw new IllegalArgumentException("Invalid target position");
}
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 static class State {
public static final int STEP_ANIMATIONS = 4;
public static final int STEP_LAYOUT = 2;
public static final int STEP_START = 1;
private SparseArray<Object> mData;
public int mDeletedInvisibleItemCountSincePreviousLayout = 0;
public long mFocusedItemId;
public int mFocusedItemPosition;
public int mFocusedSubChildId;
public boolean mInPreLayout = false;
public boolean mIsMeasuring = false;
public int mItemCount = 0;
public int mLayoutStep = 1;
public int mPreviousLayoutItemCount = 0;
public int mRemainingScrollHorizontal;
public int mRemainingScrollVertical;
public boolean mRunPredictiveAnimations = false;
public boolean mRunSimpleAnimations = false;
public boolean mStructureChanged = false;
public int mTargetPosition = -1;
public boolean mTrackOldChangeHolders = false;
public void assertLayoutStep(int i) {
if ((this.mLayoutStep & i) == 0) {
StringBuilder L = a.L("Layout state should be one of ");
L.append(Integer.toBinaryString(i));
L.append(" but it is ");
L.append(Integer.toBinaryString(this.mLayoutStep));
throw new IllegalStateException(L.toString());
}
}
public boolean didStructureChange() {
return this.mStructureChanged;
}
public <T> T get(int i) {
SparseArray<Object> sparseArray = this.mData;
if (sparseArray == null) {
return null;
}
return (T) sparseArray.get(i);
}
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 void prepareForNestedPrefetch(Adapter adapter) {
this.mLayoutStep = 1;
this.mItemCount = adapter.getItemCount();
this.mInPreLayout = false;
this.mTrackOldChangeHolders = false;
this.mIsMeasuring = false;
}
public void put(int i, Object obj) {
if (this.mData == null) {
this.mData = new SparseArray<>();
}
this.mData.put(i, obj);
}
public void remove(int i) {
SparseArray<Object> sparseArray = this.mData;
if (sparseArray != null) {
sparseArray.remove(i);
}
}
public String toString() {
StringBuilder L = a.L("State{mTargetPosition=");
L.append(this.mTargetPosition);
L.append(", mData=");
L.append(this.mData);
L.append(", mItemCount=");
L.append(this.mItemCount);
L.append(", mIsMeasuring=");
L.append(this.mIsMeasuring);
L.append(", mPreviousLayoutItemCount=");
L.append(this.mPreviousLayoutItemCount);
L.append(", mDeletedInvisibleItemCountSincePreviousLayout=");
L.append(this.mDeletedInvisibleItemCountSincePreviousLayout);
L.append(", mStructureChanged=");
L.append(this.mStructureChanged);
L.append(", mInPreLayout=");
L.append(this.mInPreLayout);
L.append(", mRunSimpleAnimations=");
L.append(this.mRunSimpleAnimations);
L.append(", mRunPredictiveAnimations=");
L.append(this.mRunPredictiveAnimations);
L.append('}');
return L.toString();
}
public boolean willRunPredictiveAnimations() {
return this.mRunPredictiveAnimations;
}
public boolean willRunSimpleAnimations() {
return this.mRunSimpleAnimations;
}
}
public static abstract class ViewCacheExtension {
@Nullable
public abstract View getViewForPositionAndType(@NonNull Recycler recycler, int i, int i2);
}
public class ViewFlinger implements Runnable {
private boolean mEatRunOnAnimationRequest = false;
public Interpolator mInterpolator;
private int mLastFlingX;
private int mLastFlingY;
public OverScroller mOverScroller;
private boolean mReSchedulePostAnimationCallback = false;
public ViewFlinger() {
Interpolator interpolator = RecyclerView.sQuinticInterpolator;
this.mInterpolator = interpolator;
this.mOverScroller = new OverScroller(RecyclerView.this.getContext(), interpolator);
}
private int computeScrollDuration(int i, int i2, int i3, int i4) {
int i5;
int abs = Math.abs(i);
int abs2 = Math.abs(i2);
boolean z2 = abs > abs2;
int sqrt = (int) Math.sqrt((double) ((i4 * i4) + (i3 * i3)));
int sqrt2 = (int) Math.sqrt((double) ((i2 * i2) + (i * i)));
RecyclerView recyclerView = RecyclerView.this;
int width = z2 ? recyclerView.getWidth() : recyclerView.getHeight();
int i6 = width / 2;
float f = (float) width;
float f2 = (float) i6;
float distanceInfluenceForSnapDuration = (distanceInfluenceForSnapDuration(Math.min(1.0f, (((float) sqrt2) * 1.0f) / f)) * f2) + f2;
if (sqrt > 0) {
i5 = Math.round(Math.abs(distanceInfluenceForSnapDuration / ((float) sqrt)) * 1000.0f) * 4;
} else {
if (!z2) {
abs = abs2;
}
i5 = (int) (((((float) abs) / f) + 1.0f) * 300.0f);
}
return Math.min(i5, 2000);
}
private float distanceInfluenceForSnapDuration(float f) {
return (float) Math.sin((double) ((f - 0.5f) * 0.47123894f));
}
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 postOnAnimation() {
if (this.mEatRunOnAnimationRequest) {
this.mReSchedulePostAnimationCallback = true;
} else {
internalPostOnAnimation();
}
}
@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;
i = iArr4[0];
i2 = iArr4[1];
i3 -= i;
i4 -= i2;
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(i, i2);
} else {
smoothScroller.onAnimation(i, i2);
}
}
} else {
i2 = 0;
i = 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(i, i2, i3, i4, null, 1, iArr5);
RecyclerView recyclerView6 = RecyclerView.this;
int[] iArr6 = recyclerView6.mReusableIntPair;
int i5 = i3 - iArr6[0];
int i6 = i4 - iArr6[1];
if (!(i == 0 && i2 == 0)) {
recyclerView6.dispatchOnScrolled(i, i2);
}
if (!RecyclerView.access$200(RecyclerView.this)) {
RecyclerView.this.invalidate();
}
boolean z2 = 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()) || !z2) {
postOnAnimation();
RecyclerView recyclerView7 = RecyclerView.this;
GapWorker gapWorker = recyclerView7.mGapWorker;
if (gapWorker != null) {
gapWorker.postFromTraversal(recyclerView7, i, i2);
}
} else {
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();
}
}
}
SmoothScroller smoothScroller3 = RecyclerView.this.mLayout.mSmoothScroller;
if (smoothScroller3 != null && smoothScroller3.isPendingInitialRun()) {
smoothScroller3.onAnimation(0, 0);
}
this.mEatRunOnAnimationRequest = false;
if (this.mReSchedulePostAnimationCallback) {
internalPostOnAnimation();
return;
}
RecyclerView.this.setScrollState(0);
RecyclerView.this.stopNestedScroll(1);
}
public void smoothScrollBy(int i, int i2, int i3, @Nullable Interpolator interpolator) {
if (i3 == Integer.MIN_VALUE) {
i3 = computeScrollDuration(i, i2, 0, 0);
}
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, i3);
if (Build.VERSION.SDK_INT < 23) {
this.mOverScroller.computeScrollOffset();
}
postOnAnimation();
}
public void stop() {
RecyclerView.this.removeCallbacks(this);
this.mOverScroller.abortAnimation();
}
}
public static abstract class ViewHolder {
public static final int FLAG_ADAPTER_FULLUPDATE = 1024;
public static final int FLAG_ADAPTER_POSITION_UNKNOWN = 512;
public static final int FLAG_APPEARED_IN_PRE_LAYOUT = 4096;
public static final int FLAG_BOUNCED_FROM_HIDDEN_LIST = 8192;
public static final int FLAG_BOUND = 1;
public static final int FLAG_IGNORE = 128;
public static final int FLAG_INVALID = 4;
public static final int FLAG_MOVED = 2048;
public static final int FLAG_NOT_RECYCLABLE = 16;
public static final int FLAG_REMOVED = 8;
public static final int FLAG_RETURNED_FROM_SCRAP = 32;
public static final int FLAG_TMP_DETACHED = 256;
public static final int FLAG_UPDATE = 2;
private static final List<Object> FULLUPDATE_PAYLOADS = Collections.emptyList();
public static final int PENDING_ACCESSIBILITY_STATE_NOT_SET = -1;
@NonNull
public final View itemView;
public int mFlags;
public boolean mInChangeScrap = false;
private int mIsRecyclableCount = 0;
public long mItemId = -1;
public int mItemViewType = -1;
public WeakReference<RecyclerView> mNestedRecyclerView;
public int mOldPosition = -1;
public RecyclerView mOwnerRecyclerView;
public List<Object> mPayloads = null;
@VisibleForTesting
public int mPendingAccessibilityState = -1;
public int mPosition = -1;
public int mPreLayoutPosition = -1;
public Recycler mScrapContainer = null;
public ViewHolder mShadowedHolder = null;
public ViewHolder mShadowingHolder = null;
public List<Object> mUnmodifiedPayloads = null;
private int mWasImportantForAccessibilityBeforeHidden = 0;
public ViewHolder(@NonNull View view) {
if (view != null) {
this.itemView = view;
return;
}
throw new IllegalArgumentException("itemView may not be null");
}
private void createPayloadsIfNeeded() {
if (this.mPayloads == null) {
ArrayList arrayList = new ArrayList();
this.mPayloads = arrayList;
this.mUnmodifiedPayloads = Collections.unmodifiableList(arrayList);
}
}
public void addChangePayload(Object obj) {
if (obj == null) {
addFlags(1024);
} else if ((1024 & this.mFlags) == 0) {
createPayloadsIfNeeded();
this.mPayloads.add(obj);
}
}
public void addFlags(int i) {
this.mFlags = i | this.mFlags;
}
public void clearOldPosition() {
this.mOldPosition = -1;
this.mPreLayoutPosition = -1;
}
public void clearPayload() {
List<Object> list = this.mPayloads;
if (list != null) {
list.clear();
}
this.mFlags &= -1025;
}
public void clearReturnedFromScrapFlag() {
this.mFlags &= -33;
}
public void clearTmpDetachFlag() {
this.mFlags &= -257;
}
public boolean doesTransientStatePreventRecycling() {
return (this.mFlags & 16) == 0 && ViewCompat.hasTransientState(this.itemView);
}
public void flagRemovedAndOffsetPosition(int i, int i2, boolean z2) {
addFlags(8);
offsetPosition(i2, z2);
this.mPosition = i;
}
public final int getAdapterPosition() {
RecyclerView recyclerView = this.mOwnerRecyclerView;
if (recyclerView == null) {
return -1;
}
return recyclerView.getAdapterPositionFor(this);
}
public final long getItemId() {
return this.mItemId;
}
public final int getItemViewType() {
return this.mItemViewType;
}
public final int getLayoutPosition() {
int i = this.mPreLayoutPosition;
return i == -1 ? this.mPosition : i;
}
public final int getOldPosition() {
return this.mOldPosition;
}
@Deprecated
public final int getPosition() {
int i = this.mPreLayoutPosition;
return i == -1 ? this.mPosition : i;
}
public List<Object> getUnmodifiedPayloads() {
if ((this.mFlags & 1024) != 0) {
return FULLUPDATE_PAYLOADS;
}
List<Object> list = this.mPayloads;
return (list == null || list.size() == 0) ? FULLUPDATE_PAYLOADS : this.mUnmodifiedPayloads;
}
public boolean hasAnyOfTheFlags(int i) {
return (i & this.mFlags) != 0;
}
public boolean isAdapterPositionUnknown() {
return (this.mFlags & 512) != 0 || isInvalid();
}
public boolean isAttachedToTransitionOverlay() {
return (this.itemView.getParent() == null || this.itemView.getParent() == this.mOwnerRecyclerView) ? false : true;
}
public boolean isBound() {
return (this.mFlags & 1) != 0;
}
public boolean isInvalid() {
return (this.mFlags & 4) != 0;
}
public final boolean isRecyclable() {
return (this.mFlags & 16) == 0 && !ViewCompat.hasTransientState(this.itemView);
}
public boolean isRemoved() {
return (this.mFlags & 8) != 0;
}
public boolean isScrap() {
return this.mScrapContainer != null;
}
public boolean isTmpDetached() {
return (this.mFlags & 256) != 0;
}
public boolean isUpdated() {
return (this.mFlags & 2) != 0;
}
public boolean needsUpdate() {
return (this.mFlags & 2) != 0;
}
public void offsetPosition(int i, boolean z2) {
if (this.mOldPosition == -1) {
this.mOldPosition = this.mPosition;
}
if (this.mPreLayoutPosition == -1) {
this.mPreLayoutPosition = this.mPosition;
}
if (z2) {
this.mPreLayoutPosition += i;
}
this.mPosition += i;
if (this.itemView.getLayoutParams() != null) {
((LayoutParams) this.itemView.getLayoutParams()).mInsetsDirty = true;
}
}
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 void resetInternal() {
this.mFlags = 0;
this.mPosition = -1;
this.mOldPosition = -1;
this.mItemId = -1;
this.mPreLayoutPosition = -1;
this.mIsRecyclableCount = 0;
this.mShadowedHolder = null;
this.mShadowingHolder = null;
clearPayload();
this.mWasImportantForAccessibilityBeforeHidden = 0;
this.mPendingAccessibilityState = -1;
RecyclerView.clearNestedRecyclerViewIfNotNested(this);
}
public void saveOldPosition() {
if (this.mOldPosition == -1) {
this.mOldPosition = this.mPosition;
}
}
public void setFlags(int i, int i2) {
this.mFlags = (i & i2) | (this.mFlags & (~i2));
}
public final void setIsRecyclable(boolean z2) {
int i = this.mIsRecyclableCount;
int i2 = z2 ? 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);
} else if (!z2 && i2 == 1) {
this.mFlags |= 16;
} else if (z2 && i2 == 0) {
this.mFlags &= -17;
}
}
public void setScrapContainer(Recycler recycler, boolean z2) {
this.mScrapContainer = recycler;
this.mInChangeScrap = z2;
}
public boolean shouldBeKeptAsChild() {
return (this.mFlags & 16) != 0;
}
public boolean shouldIgnore() {
return (this.mFlags & 128) != 0;
}
public void stopIgnoring() {
this.mFlags &= -129;
}
public String toString() {
StringBuilder P = a.P(getClass().isAnonymousClass() ? "ViewHolder" : getClass().getSimpleName(), "{");
P.append(Integer.toHexString(hashCode()));
P.append(" position=");
P.append(this.mPosition);
P.append(" id=");
P.append(this.mItemId);
P.append(", oldPos=");
P.append(this.mOldPosition);
P.append(", pLpos:");
P.append(this.mPreLayoutPosition);
StringBuilder sb = new StringBuilder(P.toString());
if (isScrap()) {
sb.append(" scrap ");
sb.append(this.mInChangeScrap ? "[changeScrap]" : "[attachedScrap]");
}
if (isInvalid()) {
sb.append(" invalid");
}
if (!isBound()) {
sb.append(" unbound");
}
if (needsUpdate()) {
sb.append(" update");
}
if (isRemoved()) {
sb.append(" removed");
}
if (shouldIgnore()) {
sb.append(" ignored");
}
if (isTmpDetached()) {
sb.append(" tmpDetached");
}
if (!isRecyclable()) {
StringBuilder L = a.L(" not recyclable(");
L.append(this.mIsRecyclableCount);
L.append(")");
sb.append(L.toString());
}
if (isAdapterPositionUnknown()) {
sb.append(" undefined adapter position");
}
if (this.itemView.getParent() == null) {
sb.append(" no parent");
}
sb.append("}");
return sb.toString();
}
public void unScrap() {
this.mScrapContainer.unscrapView(this);
}
public boolean wasReturnedFromScrap() {
return (this.mFlags & 32) != 0;
}
}
static {
Class<?> cls = Integer.TYPE;
LAYOUT_MANAGER_CONSTRUCTOR_SIGNATURE = new Class[]{Context.class, AttributeSet.class, cls, cls};
}
public RecyclerView(@NonNull Context context) {
this(context, null);
}
public RecyclerView(@NonNull Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, 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 AnonymousClass1();
this.mTempRect = new Rect();
this.mTempRect2 = new Rect();
this.mTempRectF = new RectF();
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 AnonymousClass2();
this.mViewInfoProcessCallback = new AnonymousClass4();
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));
int[] iArr = R.styleable.RecyclerView;
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, iArr, i, 0);
int i2 = Build.VERSION.SDK_INT;
if (i2 >= 29) {
saveAttributeDataForStyleable(context, iArr, attributeSet, obtainStyledAttributes, i, 0);
}
String string = obtainStyledAttributes.getString(R.styleable.RecyclerView_layoutManager);
if (obtainStyledAttributes.getInt(R.styleable.RecyclerView_android_descendantFocusability, -1) == -1) {
setDescendantFocusability(262144);
}
this.mClipToPadding = obtainStyledAttributes.getBoolean(R.styleable.RecyclerView_android_clipToPadding, true);
boolean z2 = obtainStyledAttributes.getBoolean(R.styleable.RecyclerView_fastScrollEnabled, false);
this.mEnableFastScroller = z2;
if (z2) {
initFastScroller((StateListDrawable) obtainStyledAttributes.getDrawable(R.styleable.RecyclerView_fastScrollVerticalThumbDrawable), obtainStyledAttributes.getDrawable(R.styleable.RecyclerView_fastScrollVerticalTrackDrawable), (StateListDrawable) obtainStyledAttributes.getDrawable(R.styleable.RecyclerView_fastScrollHorizontalThumbDrawable), obtainStyledAttributes.getDrawable(R.styleable.RecyclerView_fastScrollHorizontalTrackDrawable));
}
obtainStyledAttributes.recycle();
createLayoutManager(context, string, attributeSet, i, 0);
int[] iArr2 = NESTED_SCROLLING_ATTRS;
TypedArray obtainStyledAttributes2 = context.obtainStyledAttributes(attributeSet, iArr2, i, 0);
if (i2 >= 29) {
saveAttributeDataForStyleable(context, iArr2, attributeSet, obtainStyledAttributes2, i, 0);
}
boolean z3 = obtainStyledAttributes2.getBoolean(0, true);
obtainStyledAttributes2.recycle();
setNestedScrollingEnabled(z3);
}
public static /* synthetic */ void access$000(RecyclerView recyclerView, View view, int i, ViewGroup.LayoutParams layoutParams) {
recyclerView.attachViewToParent(view, i, layoutParams);
}
public static /* synthetic */ void access$100(RecyclerView recyclerView, int i) {
recyclerView.detachViewFromParent(i);
}
public static /* synthetic */ boolean access$200(RecyclerView recyclerView) {
return recyclerView.awakenScrollBars();
}
public static /* synthetic */ void access$300(RecyclerView recyclerView, int i, int i2) {
recyclerView.setMeasuredDimension(i, i2);
}
private void addAnimatingView(ViewHolder viewHolder) {
View view = viewHolder.itemView;
boolean z2 = view.getParent() == this;
this.mRecycler.unscrapView(getChildViewHolder(view));
if (viewHolder.isTmpDetached()) {
this.mChildHelper.attachViewToParent(view, -1, view.getLayoutParams(), true);
} else if (!z2) {
this.mChildHelper.addView(view, true);
} else {
this.mChildHelper.hide(view);
}
}
private void animateChange(@NonNull ViewHolder viewHolder, @NonNull ViewHolder viewHolder2, @NonNull ItemAnimator.ItemHolderInfo itemHolderInfo, @NonNull ItemAnimator.ItemHolderInfo itemHolderInfo2, boolean z2, boolean z3) {
viewHolder.setIsRecyclable(false);
if (z2) {
addAnimatingView(viewHolder);
}
if (viewHolder != viewHolder2) {
if (z3) {
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();
}
}
private void cancelScroll() {
resetScroll();
setScrollState(0);
}
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) {
ViewParent parent = recyclerView.getParent();
recyclerView = parent instanceof View ? (View) parent : null;
} else {
return;
}
}
viewHolder.mNestedRecyclerView = null;
}
}
private void createLayoutManager(Context context, String str, AttributeSet attributeSet, int i, int i2) {
Constructor constructor;
if (str != null) {
String trim = str.trim();
if (!trim.isEmpty()) {
String fullClassName = getFullClassName(context, trim);
try {
Class<? extends U> asSubclass = Class.forName(fullClassName, false, isInEditMode() ? getClass().getClassLoader() : context.getClassLoader()).asSubclass(LayoutManager.class);
Object[] objArr = null;
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]);
} 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 (ClassNotFoundException e3) {
throw new IllegalStateException(attributeSet.getPositionDescription() + ": Unable to find LayoutManager " + fullClassName, e3);
} catch (InvocationTargetException e4) {
throw new IllegalStateException(attributeSet.getPositionDescription() + ": Could not instantiate the LayoutManager: " + fullClassName, e4);
} catch (InstantiationException e5) {
throw new IllegalStateException(attributeSet.getPositionDescription() + ": Could not instantiate the LayoutManager: " + fullClassName, e5);
} catch (IllegalAccessException e6) {
throw new IllegalStateException(attributeSet.getPositionDescription() + ": Cannot access non-public constructor " + fullClassName, e6);
} catch (ClassCastException e7) {
throw new IllegalStateException(attributeSet.getPositionDescription() + ": Class is not a LayoutManager " + fullClassName, e7);
}
}
}
}
private boolean didChildRangeChange(int i, int i2) {
findMinMaxChildLayoutPositions(this.mMinMaxLayoutPositions);
int[] iArr = this.mMinMaxLayoutPositions;
return (iArr[0] == i && iArr[1] == i2) ? false : true;
}
private void dispatchContentChangedIfNecessary() {
int i = this.mEatenAccessibilityChangeFlags;
this.mEatenAccessibilityChangeFlags = 0;
if (i != 0 && isAccessibilityEnabled()) {
AccessibilityEvent obtain = AccessibilityEvent.obtain();
obtain.setEventType(2048);
AccessibilityEventCompat.setContentChangeTypes(obtain, i);
sendAccessibilityEventUnchecked(obtain);
}
}
private void dispatchLayoutStep1() {
boolean z2 = true;
this.mState.assertLayoutStep(1);
fillRemainingScrollValues(this.mState);
this.mState.mIsMeasuring = false;
startInterceptRequestLayout();
this.mViewInfoStore.clear();
onEnterLayoutOrScroll();
processAdapterUpdatesAndSetAnimationFlags();
saveFocusInfo();
State state = this.mState;
if (!state.mRunSimpleAnimations || !this.mItemsChanged) {
z2 = false;
}
state.mTrackOldChangeHolders = z2;
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 z3 = state2.mStructureChanged;
state2.mStructureChanged = false;
this.mLayout.onLayoutChildren(this.mRecycler, state2);
this.mState.mStructureChanged = z3;
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();
State state = this.mState;
state.mDeletedInvisibleItemCountSincePreviousLayout = 0;
state.mInPreLayout = false;
this.mLayout.onLayoutChildren(this.mRecycler, state);
State state2 = this.mState;
state2.mStructureChanged = false;
this.mPendingSavedState = null;
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()) {
this.mViewInfoStore.addToPostLayout(childViewHolderInt, recordPostLayoutInformation);
} else {
boolean isDisappearing = this.mViewInfoStore.isDisappearing(fromOldChangeHolders);
boolean isDisappearing2 = this.mViewInfoStore.isDisappearing(childViewHolderInt);
if (!isDisappearing || fromOldChangeHolders != childViewHolderInt) {
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 boolean dispatchToOnItemTouchListeners(MotionEvent motionEvent) {
OnItemTouchListener onItemTouchListener = this.mInterceptingOnItemTouchListener;
if (onItemTouchListener != null) {
onItemTouchListener.onTouchEvent(this, motionEvent);
int action = motionEvent.getAction();
if (action == 3 || action == 1) {
this.mInterceptingOnItemTouchListener = null;
}
return true;
} else if (motionEvent.getAction() == 0) {
return false;
} else {
return findInterceptingOnItemTouchListener(motionEvent);
}
}
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;
}
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;
}
@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;
}
@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;
} else if (findViewHolderForAdapterPosition2.itemView.hasFocusable()) {
return findViewHolderForAdapterPosition2.itemView;
}
}
int min = Math.min(itemCount, i);
while (true) {
min--;
if (min < 0 || (findViewHolderForAdapterPosition = findViewHolderForAdapterPosition(min)) == null) {
return null;
}
if (findViewHolderForAdapterPosition.itemView.hasFocusable()) {
return findViewHolderForAdapterPosition.itemView;
}
}
}
public static ViewHolder getChildViewHolderInt(View view) {
if (view == null) {
return null;
}
return ((LayoutParams) view.getLayoutParams()).mViewHolder;
}
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);
}
private int getDeepestFocusedViewWithId(View view) {
int id2 = view.getId();
while (!view.isFocused() && (view instanceof ViewGroup) && view.hasFocus()) {
view = ((ViewGroup) view).getFocusedChild();
if (view.getId() != -1) {
id2 = view.getId();
}
}
return id2;
}
private String getFullClassName(Context context, String str) {
if (str.charAt(0) == '.') {
return context.getPackageName() + str;
} else if (str.contains(".")) {
return str;
} else {
return RecyclerView.class.getPackage().getName() + '.' + str;
}
}
private NestedScrollingChildHelper getScrollingChildHelper() {
if (this.mScrollingChildHelper == null) {
this.mScrollingChildHelper = new NestedScrollingChildHelper(this);
}
return this.mScrollingChildHelper;
}
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()) {
StringBuilder sb = new StringBuilder();
sb.append("Two different ViewHolders have the same change ID. This might happen due to inconsistent Adapter update events or if the LayoutManager lays out the same View multiple times.\n ViewHolder 1:");
sb.append(childViewHolderInt);
sb.append(" \n View Holder 2:");
sb.append(viewHolder);
throw new IllegalStateException(a.h(this, sb));
}
StringBuilder sb2 = new StringBuilder();
sb2.append("Two different ViewHolders have the same stable ID. Stable IDs in your adapter MUST BE unique and SHOULD NOT change.\n ViewHolder 1:");
sb2.append(childViewHolderInt);
sb2.append(" \n View Holder 2:");
sb2.append(viewHolder);
throw new IllegalStateException(a.h(this, sb2));
}
}
Log.e("RecyclerView", "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());
}
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;
}
@SuppressLint({"InlinedApi"})
private void initAutofill() {
if (ViewCompat.getImportantForAutofill(this) == 0) {
ViewCompat.setImportantForAutofill(this, 8);
}
}
private void initChildrenHelper() {
this.mChildHelper = new ChildHelper(new AnonymousClass5());
}
private boolean isPreferredNextFocus(View view, View view2, int i) {
int i2;
if (view2 == null || view2 == this || 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 c2 = 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) {
c2 = 1;
} else {
int i10 = rect.bottom;
int i11 = rect2.bottom;
if ((i10 <= i11 && i8 < i11) || i8 <= i9) {
c2 = 0;
}
}
if (i == 1) {
return c2 < 0 || (c2 == 0 && i2 * i3 <= 0);
}
if (i == 2) {
return c2 > 0 || (c2 == 0 && i2 * i3 >= 0);
}
if (i == 17) {
return i2 < 0;
}
if (i == 33) {
return c2 < 0;
}
if (i == 66) {
return i2 > 0;
}
if (i == 130) {
return c2 > 0;
}
StringBuilder sb = new StringBuilder();
sb.append("Invalid direction: ");
sb.append(i);
throw new IllegalArgumentException(a.h(this, sb));
}
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 x2 = (int) (motionEvent.getX(i) + 0.5f);
this.mLastTouchX = x2;
this.mInitialTouchX = x2;
int y2 = (int) (motionEvent.getY(i) + 0.5f);
this.mLastTouchY = y2;
this.mInitialTouchY = y2;
}
}
private boolean predictiveItemAnimationsEnabled() {
return this.mItemAnimator != null && this.mLayout.supportsPredictiveItemAnimations();
}
private void processAdapterUpdatesAndSetAnimationFlags() {
boolean z2;
if (this.mDataSetHasChangedAfterLayout) {
this.mAdapterHelper.reset();
if (this.mDispatchItemsChangedEvent) {
this.mLayout.onItemsChanged(this);
}
}
if (predictiveItemAnimationsEnabled()) {
this.mAdapterHelper.preProcess();
} else {
this.mAdapterHelper.consumeUpdatesInOnePass();
}
boolean z3 = false;
boolean z4 = this.mItemsAddedOrRemoved || this.mItemsChanged;
this.mState.mRunSimpleAnimations = this.mFirstLayoutComplete && this.mItemAnimator != null && ((z2 = this.mDataSetHasChangedAfterLayout) || z4 || this.mLayout.mRequestedSimpleAnimations) && (!z2 || this.mAdapter.hasStableIds());
State state = this.mState;
if (state.mRunSimpleAnimations && z4 && !this.mDataSetHasChangedAfterLayout && predictiveItemAnimationsEnabled()) {
z3 = true;
}
state.mRunPredictiveAnimations = z3;
}
/* JADX WARNING: Removed duplicated region for block: B:10:0x0040 */
/* JADX WARNING: Removed duplicated region for block: B:11:0x0056 */
private void pullGlows(float f, float f2, float f3, float f4) {
boolean z2;
boolean z3 = true;
if (f2 < 0.0f) {
ensureLeftGlow();
EdgeEffectCompat.onPull(this.mLeftGlow, (-f2) / ((float) getWidth()), 1.0f - (f3 / ((float) getHeight())));
} else if (f2 > 0.0f) {
ensureRightGlow();
EdgeEffectCompat.onPull(this.mRightGlow, f2 / ((float) getWidth()), f3 / ((float) getHeight()));
} else {
z2 = false;
if (f4 >= 0.0f) {
ensureTopGlow();
EdgeEffectCompat.onPull(this.mTopGlow, (-f4) / ((float) getHeight()), f / ((float) getWidth()));
} else if (f4 > 0.0f) {
ensureBottomGlow();
EdgeEffectCompat.onPull(this.mBottomGlow, f4 / ((float) getHeight()), 1.0f - (f / ((float) getWidth())));
} else {
z3 = z2;
}
if (!z3 || f2 != 0.0f || f4 != 0.0f) {
ViewCompat.postInvalidateOnAnimation(this);
}
return;
}
z2 = true;
if (f4 >= 0.0f) {
}
if (!z3) {
}
ViewCompat.postInvalidateOnAnimation(this);
}
private void recoverFocusFromState() {
View findViewById;
if (this.mPreserveFocusAfterLayout && this.mAdapter != null && hasFocus() && getDescendantFocusability() != 393216) {
if (getDescendantFocusability() != 131072 || !isFocused()) {
if (!isFocused()) {
View focusedChild = getFocusedChild();
if (!IGNORE_DETACHED_FOCUSED_CHILD || (focusedChild.getParent() != null && focusedChild.hasFocus())) {
if (!this.mChildHelper.isHidden(focusedChild)) {
return;
}
} else if (this.mChildHelper.getChildCount() == 0) {
requestFocus();
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()) {
view = findViewHolderForItemId.itemView;
} else if (this.mChildHelper.getChildCount() > 0) {
view = findNextViewToFocus();
}
if (view != null) {
int i = this.mState.mFocusedSubChildId;
if (!(((long) i) == -1 || (findViewById = view.findViewById(i)) == null || !findViewById.isFocusable())) {
view = findViewById;
}
view.requestFocus();
}
}
}
}
private void releaseGlows() {
boolean z2;
EdgeEffect edgeEffect = this.mLeftGlow;
if (edgeEffect != null) {
edgeEffect.onRelease();
z2 = this.mLeftGlow.isFinished();
} else {
z2 = false;
}
EdgeEffect edgeEffect2 = this.mTopGlow;
if (edgeEffect2 != null) {
edgeEffect2.onRelease();
z2 |= this.mTopGlow.isFinished();
}
EdgeEffect edgeEffect3 = this.mRightGlow;
if (edgeEffect3 != null) {
edgeEffect3.onRelease();
z2 |= this.mRightGlow.isFinished();
}
EdgeEffect edgeEffect4 = this.mBottomGlow;
if (edgeEffect4 != null) {
edgeEffect4.onRelease();
z2 |= this.mBottomGlow.isFinished();
}
if (z2) {
ViewCompat.postInvalidateOnAnimation(this);
}
}
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);
}
private void resetFocusInfo() {
State state = this.mState;
state.mFocusedItemId = -1;
state.mFocusedItemPosition = -1;
state.mFocusedSubChildId = -1;
}
private void resetScroll() {
VelocityTracker velocityTracker = this.mVelocityTracker;
if (velocityTracker != null) {
velocityTracker.clear();
}
stopNestedScroll(0);
releaseGlows();
}
private void saveFocusInfo() {
ViewHolder viewHolder = null;
View focusedChild = (!this.mPreserveFocusAfterLayout || !hasFocus() || this.mAdapter == null) ? null : getFocusedChild();
if (focusedChild != null) {
viewHolder = findContainingViewHolder(focusedChild);
}
if (viewHolder == null) {
resetFocusInfo();
return;
}
this.mState.mFocusedItemId = this.mAdapter.hasStableIds() ? viewHolder.getItemId() : -1;
this.mState.mFocusedItemPosition = this.mDataSetHasChangedAfterLayout ? -1 : viewHolder.isRemoved() ? viewHolder.mOldPosition : viewHolder.getAdapterPosition();
this.mState.mFocusedSubChildId = getDeepestFocusedViewWithId(viewHolder.itemView);
}
private void setAdapterInternal(@Nullable Adapter adapter, boolean z2, boolean z3) {
Adapter adapter2 = this.mAdapter;
if (adapter2 != null) {
adapter2.unregisterAdapterDataObserver(this.mObserver);
this.mAdapter.onDetachedFromRecyclerView(this);
}
if (!z2 || z3) {
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, z2);
this.mState.mStructureChanged = true;
}
private void stopScrollersInternal() {
this.mViewFlinger.stop();
LayoutManager layoutManager = this.mLayout;
if (layoutManager != null) {
layoutManager.stopSmoothScroller();
}
}
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) {
ViewCompat.postInvalidateOnAnimation(this);
}
}
@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);
}
}
public void addItemDecoration(@NonNull ItemDecoration itemDecoration) {
addItemDecoration(itemDecoration, -1);
}
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 addOnChildAttachStateChangeListener(@NonNull OnChildAttachStateChangeListener onChildAttachStateChangeListener) {
if (this.mOnChildAttachStateListeners == null) {
this.mOnChildAttachStateListeners = new ArrayList();
}
this.mOnChildAttachStateListeners.add(onChildAttachStateChangeListener);
}
public void addOnItemTouchListener(@NonNull OnItemTouchListener onItemTouchListener) {
this.mOnItemTouchListeners.add(onItemTouchListener);
}
public void addOnScrollListener(@NonNull OnScrollListener onScrollListener) {
if (this.mScrollListeners == null) {
this.mScrollListeners = new ArrayList();
}
this.mScrollListeners.add(onScrollListener);
}
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();
}
}
public void assertInLayoutOrScroll(String str) {
if (isComputingLayout()) {
return;
}
if (str == null) {
throw new IllegalStateException(a.h(this, a.L("Cannot call this method unless RecyclerView is computing a layout or scrolling")));
}
throw new IllegalStateException(a.h(this, a.L(str)));
}
public void assertNotInLayoutOrScroll(String str) {
if (isComputingLayout()) {
if (str == null) {
throw new IllegalStateException(a.h(this, a.L("Cannot call this method while RecyclerView is computing a layout or scrolling")));
}
throw new IllegalStateException(str);
} else if (this.mDispatchScrollCounter > 0) {
Log.w("RecyclerView", "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(a.h(this, a.L(""))));
}
}
public boolean canReuseUpdatedViewHolder(ViewHolder viewHolder) {
ItemAnimator itemAnimator = this.mItemAnimator;
return itemAnimator == null || itemAnimator.canReuseUpdatedViewHolder(viewHolder, viewHolder.getUnmodifiedPayloads());
}
@Override // android.view.ViewGroup
public boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
return (layoutParams instanceof LayoutParams) && this.mLayout.checkLayoutParams((LayoutParams) layoutParams);
}
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 clearOnChildAttachStateChangeListeners() {
List<OnChildAttachStateChangeListener> list = this.mOnChildAttachStateListeners;
if (list != null) {
list.clear();
}
}
public void clearOnScrollListeners() {
List<OnScrollListener> list = this.mScrollListeners;
if (list != null) {
list.clear();
}
}
@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 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 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 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 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 computeVerticalScrollRange() {
LayoutManager layoutManager = this.mLayout;
if (layoutManager != null && layoutManager.canScrollVertically()) {
return this.mLayout.computeVerticalScrollRange(this.mState);
}
return 0;
}
public void considerReleasingGlowsOnScroll(int i, int i2) {
boolean z2;
EdgeEffect edgeEffect = this.mLeftGlow;
if (edgeEffect == null || edgeEffect.isFinished() || i <= 0) {
z2 = false;
} else {
this.mLeftGlow.onRelease();
z2 = this.mLeftGlow.isFinished();
}
EdgeEffect edgeEffect2 = this.mRightGlow;
if (edgeEffect2 != null && !edgeEffect2.isFinished() && i < 0) {
this.mRightGlow.onRelease();
z2 |= this.mRightGlow.isFinished();
}
EdgeEffect edgeEffect3 = this.mTopGlow;
if (edgeEffect3 != null && !edgeEffect3.isFinished() && i2 > 0) {
this.mTopGlow.onRelease();
z2 |= this.mTopGlow.isFinished();
}
EdgeEffect edgeEffect4 = this.mBottomGlow;
if (edgeEffect4 != null && !edgeEffect4.isFinished() && i2 < 0) {
this.mBottomGlow.onRelease();
z2 |= this.mBottomGlow.isFinished();
}
if (z2) {
ViewCompat.postInvalidateOnAnimation(this);
}
}
public void consumePendingUpdateOperations() {
if (!this.mFirstLayoutComplete || this.mDataSetHasChangedAfterLayout) {
TraceCompat.beginSection("RV FullInvalidate");
dispatchLayout();
TraceCompat.endSection();
} else if (this.mAdapterHelper.hasPendingUpdates()) {
if (this.mAdapterHelper.hasAnyUpdateTypes(4) && !this.mAdapterHelper.hasAnyUpdateTypes(11)) {
TraceCompat.beginSection("RV PartialInvalidate");
startInterceptRequestLayout();
onEnterLayoutOrScroll();
this.mAdapterHelper.preProcess();
if (!this.mLayoutWasDefered) {
if (hasUpdatedView()) {
dispatchLayout();
} else {
this.mAdapterHelper.consumePostponedUpdates();
}
}
stopInterceptRequestLayout(true);
onExitLayoutOrScroll();
TraceCompat.endSection();
} else if (this.mAdapterHelper.hasPendingUpdates()) {
TraceCompat.beginSection("RV FullInvalidate");
dispatchLayout();
TraceCompat.endSection();
}
}
}
public void defaultOnMeasure(int i, int i2) {
setMeasuredDimension(LayoutManager.chooseSize(i, getPaddingRight() + getPaddingLeft(), ViewCompat.getMinimumWidth(this)), LayoutManager.chooseSize(i2, getPaddingBottom() + getPaddingTop(), ViewCompat.getMinimumHeight(this)));
}
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 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 dispatchLayout() {
if (this.mAdapter == null) {
Log.e("RecyclerView", "No adapter attached; skipping layout");
} else if (this.mLayout == null) {
Log.e("RecyclerView", "No layout manager attached; skipping layout");
} else {
State state = this.mState;
state.mIsMeasuring = false;
if (state.mLayoutStep == 1) {
dispatchLayoutStep1();
this.mLayout.setExactMeasureSpecsFrom(this);
dispatchLayoutStep2();
} else if (!this.mAdapterHelper.hasUpdates() && this.mLayout.getWidth() == getWidth() && this.mLayout.getHeight() == getHeight()) {
this.mLayout.setExactMeasureSpecsFrom(this);
} else {
this.mLayout.setExactMeasureSpecsFrom(this);
dispatchLayoutStep2();
}
dispatchLayoutStep3();
}
}
@Override // android.view.View, androidx.core.view.NestedScrollingChild
public boolean dispatchNestedFling(float f, float f2, boolean z2) {
return getScrollingChildHelper().dispatchNestedFling(f, f2, z2);
}
@Override // android.view.View, androidx.core.view.NestedScrollingChild
public boolean dispatchNestedPreFling(float f, float f2) {
return getScrollingChildHelper().dispatchNestedPreFling(f, f2);
}
@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 // 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 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);
}
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 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 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();
}
@Override // android.view.View
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
onPopulateAccessibilityEvent(accessibilityEvent);
return true;
}
@Override // android.view.ViewGroup, android.view.View
public void dispatchRestoreInstanceState(SparseArray<Parcelable> sparseArray) {
dispatchThawSelfOnly(sparseArray);
}
@Override // android.view.ViewGroup, android.view.View
public void dispatchSaveInstanceState(SparseArray<Parcelable> sparseArray) {
dispatchFreezeSelfOnly(sparseArray);
}
@Override // android.view.View
public void draw(Canvas canvas) {
boolean z2;
super.draw(canvas);
int size = this.mItemDecorations.size();
boolean z3 = false;
for (int i = 0; i < size; i++) {
this.mItemDecorations.get(i).onDrawOver(canvas, this, this.mState);
}
EdgeEffect edgeEffect = this.mLeftGlow;
boolean z4 = true;
if (edgeEffect == null || edgeEffect.isFinished()) {
z2 = false;
} else {
int save = canvas.save();
int paddingBottom = this.mClipToPadding ? getPaddingBottom() : 0;
canvas.rotate(270.0f);
canvas.translate((float) ((-getHeight()) + paddingBottom), 0.0f);
EdgeEffect edgeEffect2 = this.mLeftGlow;
z2 = 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((float) getPaddingLeft(), (float) getPaddingTop());
}
EdgeEffect edgeEffect4 = this.mTopGlow;
z2 |= 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((float) (-paddingTop), (float) (-width));
EdgeEffect edgeEffect6 = this.mRightGlow;
z2 |= 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((float) (getPaddingRight() + (-getWidth())), (float) (getPaddingBottom() + (-getHeight())));
} else {
canvas.translate((float) (-getWidth()), (float) (-getHeight()));
}
EdgeEffect edgeEffect8 = this.mBottomGlow;
if (edgeEffect8 != null && edgeEffect8.draw(canvas)) {
z3 = true;
}
z2 |= z3;
canvas.restoreToCount(save4);
}
if (z2 || this.mItemAnimator == null || this.mItemDecorations.size() <= 0 || !this.mItemAnimator.isRunning()) {
z4 = z2;
}
if (z4) {
ViewCompat.postInvalidateOnAnimation(this);
}
}
@Override // android.view.ViewGroup
public boolean drawChild(Canvas canvas, View view, long j) {
return super.drawChild(canvas, view, j);
}
public void ensureBottomGlow() {
if (this.mBottomGlow == null) {
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 ensureLeftGlow() {
if (this.mLeftGlow == null) {
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) {
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) {
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 String exceptionLabel() {
StringBuilder L = a.L(" ");
L.append(super.toString());
L.append(", adapter:");
L.append(this.mAdapter);
L.append(", layout:");
L.append(this.mLayout);
L.append(", context:");
L.append(getContext());
return L.toString();
}
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();
return;
}
state.mRemainingScrollHorizontal = 0;
state.mRemainingScrollVertical = 0;
}
@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 >= ((float) childAt.getLeft()) + translationX && f <= ((float) childAt.getRight()) + translationX && f2 >= ((float) childAt.getTop()) + translationY && f2 <= ((float) childAt.getBottom()) + translationY) {
return childAt;
}
}
return null;
}
@Nullable
public View findContainingItemView(@NonNull View view) {
ViewParent parent = view.getParent();
while (parent != null && parent != this && (parent instanceof View)) {
view = (View) parent;
parent = view.getParent();
}
if (parent == this) {
return view;
}
return null;
}
@Nullable
public ViewHolder findContainingViewHolder(@NonNull View view) {
View findContainingItemView = findContainingItemView(view);
if (findContainingItemView == null) {
return null;
}
return getChildViewHolder(findContainingItemView);
}
@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() && getAdapterPositionFor(childViewHolderInt) == i) {
if (!this.mChildHelper.isHidden(childViewHolderInt.itemView)) {
return childViewHolderInt;
}
viewHolder = childViewHolderInt;
}
}
return 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 ViewHolder findViewHolderForLayoutPosition(int i) {
return findViewHolderForPosition(i, false);
}
@Nullable
@Deprecated
public ViewHolder findViewHolderForPosition(int i) {
return findViewHolderForPosition(i, false);
}
@Nullable
public ViewHolder findViewHolderForPosition(int i, boolean z2) {
int unfilteredChildCount = this.mChildHelper.getUnfilteredChildCount();
ViewHolder viewHolder = null;
for (int i2 = 0; i2 < unfilteredChildCount; i2++) {
ViewHolder childViewHolderInt = getChildViewHolderInt(this.mChildHelper.getUnfilteredChildAt(i2));
if (childViewHolderInt != null && !childViewHolderInt.isRemoved()) {
if (z2) {
if (childViewHolderInt.mPosition != i) {
continue;
}
} else if (childViewHolderInt.getLayoutPosition() != i) {
continue;
}
if (!this.mChildHelper.isHidden(childViewHolderInt.itemView)) {
return childViewHolderInt;
}
viewHolder = childViewHolderInt;
}
}
return viewHolder;
}
public boolean fling(int i, int i2) {
LayoutManager layoutManager = this.mLayout;
int i3 = 0;
if (layoutManager == null) {
Log.e("RecyclerView", "Cannot fling without a LayoutManager set. Call setLayoutManager with a non-null argument.");
return false;
} else if (this.mLayoutSuppressed) {
return false;
} else {
boolean canScrollHorizontally = layoutManager.canScrollHorizontally();
boolean canScrollVertically = this.mLayout.canScrollVertically();
if (!canScrollHorizontally || 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 = (float) i;
float f2 = (float) i2;
if (!dispatchNestedPreFling(f, f2)) {
boolean z2 = canScrollHorizontally || canScrollVertically;
dispatchNestedFling(f, f2, z2);
OnFlingListener onFlingListener = this.mOnFlingListener;
if (onFlingListener != null && onFlingListener.onFling(i, i2)) {
return true;
}
if (z2) {
if (canScrollHorizontally) {
i3 = 1;
}
if (canScrollVertically) {
i3 |= 2;
}
startNestedScroll(i3, 1);
int i4 = this.mMaxFlingVelocity;
int max = Math.max(-i4, Math.min(i, i4));
int i5 = this.mMaxFlingVelocity;
this.mViewFlinger.fling(max, Math.max(-i5, Math.min(i2, i5)));
return true;
}
}
return false;
}
}
@Override // android.view.ViewGroup, android.view.ViewParent
public View focusSearch(View view, int i) {
View view2;
boolean z2;
View onInterceptFocusSearch = this.mLayout.onInterceptFocusSearch(view, i);
if (onInterceptFocusSearch != null) {
return onInterceptFocusSearch;
}
boolean z3 = true;
boolean z4 = this.mAdapter != null && this.mLayout != null && !isComputingLayout() && !this.mLayoutSuppressed;
FocusFinder instance = FocusFinder.getInstance();
if (!z4 || !(i == 2 || i == 1)) {
View findNextFocus = instance.findNextFocus(this, view, i);
if (findNextFocus != null || !z4) {
view2 = findNextFocus;
} else {
consumePendingUpdateOperations();
if (findContainingItemView(view) == null) {
return null;
}
startInterceptRequestLayout();
view2 = this.mLayout.onFocusSearchFailed(view, i, this.mRecycler, this.mState);
stopInterceptRequestLayout(false);
}
} else {
if (this.mLayout.canScrollVertically()) {
int i2 = i == 2 ? 130 : 33;
z2 = instance.findNextFocus(this, view, i2) == null;
if (FORCE_ABS_FOCUS_SEARCH_DIRECTION) {
i = i2;
}
} else {
z2 = false;
}
if (!z2 && this.mLayout.canScrollHorizontally()) {
int i3 = (this.mLayout.getLayoutDirection() == 1) ^ (i == 2) ? 66 : 17;
if (instance.findNextFocus(this, view, i3) != null) {
z3 = false;
}
if (FORCE_ABS_FOCUS_SEARCH_DIRECTION) {
i = i3;
}
z2 = z3;
}
if (z2) {
consumePendingUpdateOperations();
if (findContainingItemView(view) == null) {
return null;
}
startInterceptRequestLayout();
this.mLayout.onFocusSearchFailed(view, i, this.mRecycler, this.mState);
stopInterceptRequestLayout(false);
}
view2 = instance.findNextFocus(this, view, i);
}
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;
}
@Override // android.view.ViewGroup
public ViewGroup.LayoutParams generateDefaultLayoutParams() {
LayoutManager layoutManager = this.mLayout;
if (layoutManager != null) {
return layoutManager.generateDefaultLayoutParams();
}
throw new IllegalStateException(a.h(this, a.L("RecyclerView has no LayoutManager")));
}
@Override // android.view.ViewGroup
public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
LayoutManager layoutManager = this.mLayout;
if (layoutManager != null) {
return layoutManager.generateLayoutParams(getContext(), attributeSet);
}
throw new IllegalStateException(a.h(this, a.L("RecyclerView has no LayoutManager")));
}
@Override // android.view.ViewGroup
public ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
LayoutManager layoutManager = this.mLayout;
if (layoutManager != null) {
return layoutManager.generateLayoutParams(layoutParams);
}
throw new IllegalStateException(a.h(this, a.L("RecyclerView has no LayoutManager")));
}
@Override // android.view.ViewGroup, android.view.View
public CharSequence getAccessibilityClassName() {
return "androidx.recyclerview.widget.RecyclerView";
}
@Nullable
public Adapter getAdapter() {
return this.mAdapter;
}
public int getAdapterPositionFor(ViewHolder viewHolder) {
if (viewHolder.hasAnyOfTheFlags(524) || !viewHolder.isBound()) {
return -1;
}
return this.mAdapterHelper.applyPendingUpdatesToPosition(viewHolder.mPosition);
}
@Override // android.view.View
public int getBaseline() {
LayoutManager layoutManager = this.mLayout;
return layoutManager != null ? layoutManager.getBaseline() : super.getBaseline();
}
public long getChangedHolderKey(ViewHolder viewHolder) {
return this.mAdapter.hasStableIds() ? viewHolder.getItemId() : (long) viewHolder.mPosition;
}
public int getChildAdapterPosition(@NonNull View view) {
ViewHolder childViewHolderInt = getChildViewHolderInt(view);
if (childViewHolderInt != null) {
return childViewHolderInt.getAdapterPosition();
}
return -1;
}
@Override // android.view.ViewGroup
public int getChildDrawingOrder(int i, int i2) {
ChildDrawingOrderCallback childDrawingOrderCallback = this.mChildDrawingOrderCallback;
return childDrawingOrderCallback == null ? super.getChildDrawingOrder(i, i2) : childDrawingOrderCallback.onGetChildDrawingOrder(i, i2);
}
public long getChildItemId(@NonNull View view) {
ViewHolder childViewHolderInt;
Adapter adapter = this.mAdapter;
if (adapter == null || !adapter.hasStableIds() || (childViewHolderInt = getChildViewHolderInt(view)) == null) {
return -1;
}
return childViewHolderInt.getItemId();
}
public int getChildLayoutPosition(@NonNull View view) {
ViewHolder childViewHolderInt = getChildViewHolderInt(view);
if (childViewHolderInt != null) {
return childViewHolderInt.getLayoutPosition();
}
return -1;
}
@Deprecated
public int getChildPosition(@NonNull View view) {
return getChildAdapterPosition(view);
}
public ViewHolder getChildViewHolder(@NonNull View view) {
ViewParent parent = view.getParent();
if (parent == null || parent == this) {
return getChildViewHolderInt(view);
}
throw new IllegalArgumentException("View " + view + " is not a direct child of " + this);
}
@Override // android.view.ViewGroup
public boolean getClipToPadding() {
return this.mClipToPadding;
}
@Nullable
public RecyclerViewAccessibilityDelegate getCompatAccessibilityDelegate() {
return this.mAccessibilityDelegate;
}
public void getDecoratedBoundsWithMargins(@NonNull View view, @NonNull Rect rect) {
getDecoratedBoundsWithMarginsInt(view, rect);
}
@NonNull
public EdgeEffectFactory getEdgeEffectFactory() {
return this.mEdgeEffectFactory;
}
@Nullable
public ItemAnimator getItemAnimator() {
return this.mItemAnimator;
}
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;
}
@NonNull
public ItemDecoration getItemDecorationAt(int i) {
int itemDecorationCount = getItemDecorationCount();
if (i >= 0 && i < itemDecorationCount) {
return this.mItemDecorations.get(i);
}
throw new IndexOutOfBoundsException(i + " is an invalid index for size " + itemDecorationCount);
}
public int getItemDecorationCount() {
return this.mItemDecorations.size();
}
@Nullable
public LayoutManager getLayoutManager() {
return this.mLayout;
}
public int getMaxFlingVelocity() {
return this.mMaxFlingVelocity;
}
public int getMinFlingVelocity() {
return this.mMinFlingVelocity;
}
public long getNanoTime() {
if (ALLOW_THREAD_GAP_WORK) {
return System.nanoTime();
}
return 0;
}
@Nullable
public OnFlingListener getOnFlingListener() {
return this.mOnFlingListener;
}
public boolean getPreserveFocusAfterLayout() {
return this.mPreserveFocusAfterLayout;
}
@NonNull
public RecycledViewPool getRecycledViewPool() {
return this.mRecycler.getRecycledViewPool();
}
public int getScrollState() {
return this.mScrollState;
}
public boolean hasFixedSize() {
return this.mHasFixedSize;
}
@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);
}
public boolean hasPendingAdapterUpdates() {
return !this.mFirstLayoutComplete || this.mDataSetHasChangedAfterLayout || this.mAdapterHelper.hasPendingUpdates();
}
public void initAdapterManager() {
this.mAdapterHelper = new AdapterHelper(new AnonymousClass6());
}
@VisibleForTesting
public void initFastScroller(StateListDrawable stateListDrawable, Drawable drawable, StateListDrawable stateListDrawable2, Drawable drawable2) {
if (stateListDrawable == null || drawable == null || stateListDrawable2 == null || drawable2 == null) {
throw new IllegalArgumentException(a.h(this, a.L("Trying to set fast scroller without both required drawables.")));
}
Resources resources = getContext().getResources();
new FastScroller(this, stateListDrawable, drawable, stateListDrawable2, drawable2, resources.getDimensionPixelSize(R.dimen.fastscroll_default_thickness), resources.getDimensionPixelSize(R.dimen.fastscroll_minimum_range), resources.getDimensionPixelOffset(R.dimen.fastscroll_margin));
}
public void invalidateGlows() {
this.mBottomGlow = null;
this.mTopGlow = null;
this.mRightGlow = null;
this.mLeftGlow = null;
}
public void invalidateItemDecorations() {
if (this.mItemDecorations.size() != 0) {
LayoutManager layoutManager = this.mLayout;
if (layoutManager != null) {
layoutManager.assertNotInLayoutOrScroll("Cannot invalidate item decorations during a scroll or layout");
}
markItemDecorInsetsDirty();
requestLayout();
}
}
public boolean isAccessibilityEnabled() {
AccessibilityManager accessibilityManager = this.mAccessibilityManager;
return accessibilityManager != null && accessibilityManager.isEnabled();
}
public boolean isAnimating() {
ItemAnimator itemAnimator = this.mItemAnimator;
return itemAnimator != null && itemAnimator.isRunning();
}
@Override // android.view.View
public boolean isAttachedToWindow() {
return this.mIsAttached;
}
public boolean isComputingLayout() {
return this.mLayoutOrScrollCounter > 0;
}
@Deprecated
public boolean isLayoutFrozen() {
return isLayoutSuppressed();
}
@Override // android.view.ViewGroup
public final boolean isLayoutSuppressed() {
return this.mLayoutSuppressed;
}
@Override // android.view.View, androidx.core.view.NestedScrollingChild
public boolean isNestedScrollingEnabled() {
return getScrollingChildHelper().isNestedScrollingEnabled();
}
public void jumpToPositionForSmoothScroller(int i) {
if (this.mLayout != null) {
setScrollState(2);
this.mLayout.scrollToPosition(i);
awakenScrollBars();
}
}
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();
}
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 offsetChildrenHorizontal(@Px int i) {
int childCount = this.mChildHelper.getChildCount();
for (int i2 = 0; i2 < childCount; i2++) {
this.mChildHelper.getChildAt(i2).offsetLeftAndRight(i);
}
}
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 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 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 offsetPositionRecordsForRemove(int i, int i2, boolean z2) {
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, z2);
this.mState.mStructureChanged = true;
} else if (i5 >= i) {
childViewHolderInt.flagRemovedAndOffsetPosition(i - 1, -i2, z2);
this.mState.mStructureChanged = true;
}
}
}
this.mRecycler.offsetPositionRecordsForRemove(i, i2, z2);
requestLayout();
}
@Override // android.view.ViewGroup, android.view.View
public void onAttachedToWindow() {
super.onAttachedToWindow();
this.mLayoutOrScrollCounter = 0;
boolean z2 = true;
this.mIsAttached = true;
if (!this.mFirstLayoutComplete || isLayoutRequested()) {
z2 = false;
}
this.mFirstLayoutComplete = z2;
LayoutManager layoutManager = this.mLayout;
if (layoutManager != null) {
layoutManager.dispatchAttachedToWindow(this);
}
this.mPostedAnimatorRunner = false;
if (ALLOW_THREAD_GAP_WORK) {
ThreadLocal<GapWorker> threadLocal = GapWorker.sGapWorker;
GapWorker gapWorker = threadLocal.get();
this.mGapWorker = gapWorker;
if (gapWorker == null) {
this.mGapWorker = new GapWorker();
Display display = ViewCompat.getDisplay(this);
float f = 60.0f;
if (!isInEditMode() && display != null) {
float refreshRate = display.getRefreshRate();
if (refreshRate >= 30.0f) {
f = refreshRate;
}
}
GapWorker gapWorker2 = this.mGapWorker;
gapWorker2.mFrameIntervalNs = (long) (1.0E9f / f);
threadLocal.set(gapWorker2);
}
this.mGapWorker.add(this);
}
}
public void onChildAttachedToWindow(@NonNull View view) {
}
public void onChildDetachedFromWindow(@NonNull View view) {
}
@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) {
gapWorker.remove(this);
this.mGapWorker = null;
}
}
@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);
}
}
public void onEnterLayoutOrScroll() {
this.mLayoutOrScrollCounter++;
}
public void onExitLayoutOrScroll() {
onExitLayoutOrScroll(true);
}
public void onExitLayoutOrScroll(boolean z2) {
int i = this.mLayoutOrScrollCounter - 1;
this.mLayoutOrScrollCounter = i;
if (i < 1) {
this.mLayoutOrScrollCounter = 0;
if (z2) {
dispatchContentChangedIfNecessary();
dispatchPendingImportantForAccessibilityChanges();
}
}
}
@Override // android.view.View
public boolean onGenericMotionEvent(MotionEvent motionEvent) {
float f;
float f2;
if (this.mLayout != null && !this.mLayoutSuppressed && motionEvent.getAction() == 8) {
if ((motionEvent.getSource() & 2) != 0) {
f2 = this.mLayout.canScrollVertically() ? -motionEvent.getAxisValue(9) : 0.0f;
if (this.mLayout.canScrollHorizontally()) {
f = motionEvent.getAxisValue(10);
if (!(f2 == 0.0f && f == 0.0f)) {
scrollByInternal((int) (f * this.mScaledHorizontalScrollFactor), (int) (f2 * this.mScaledVerticalScrollFactor), motionEvent);
}
}
} else {
if ((motionEvent.getSource() & 4194304) != 0) {
float axisValue = motionEvent.getAxisValue(26);
if (this.mLayout.canScrollVertically()) {
f2 = -axisValue;
} else if (this.mLayout.canScrollHorizontally()) {
f = axisValue;
f2 = 0.0f;
scrollByInternal((int) (f * this.mScaledHorizontalScrollFactor), (int) (f2 * this.mScaledVerticalScrollFactor), motionEvent);
}
}
f2 = 0.0f;
}
f = 0.0f;
scrollByInternal((int) (f * this.mScaledHorizontalScrollFactor), (int) (f2 * this.mScaledVerticalScrollFactor), motionEvent);
}
return false;
}
@Override // android.view.ViewGroup
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
boolean z2;
if (this.mLayoutSuppressed) {
return false;
}
this.mInterceptingOnItemTouchListener = null;
if (findInterceptingOnItemTouchListener(motionEvent)) {
cancelScroll();
return true;
}
LayoutManager layoutManager = this.mLayout;
if (layoutManager == null) {
return false;
}
boolean canScrollHorizontally = layoutManager.canScrollHorizontally();
boolean canScrollVertically = this.mLayout.canScrollVertically();
if (this.mVelocityTracker == null) {
this.mVelocityTracker = VelocityTracker.obtain();
}
this.mVelocityTracker.addMovement(motionEvent);
int actionMasked = motionEvent.getActionMasked();
int actionIndex = motionEvent.getActionIndex();
if (actionMasked == 0) {
if (this.mIgnoreMotionEventTillDown) {
this.mIgnoreMotionEventTillDown = false;
}
this.mScrollPointerId = motionEvent.getPointerId(0);
int x2 = (int) (motionEvent.getX() + 0.5f);
this.mLastTouchX = x2;
this.mInitialTouchX = x2;
int y2 = (int) (motionEvent.getY() + 0.5f);
this.mLastTouchY = y2;
this.mInitialTouchY = y2;
if (this.mScrollState == 2) {
getParent().requestDisallowInterceptTouchEvent(true);
setScrollState(1);
stopNestedScroll(1);
}
int[] iArr = this.mNestedOffsets;
iArr[1] = 0;
iArr[0] = 0;
if (canScrollVertically) {
boolean z3 = canScrollHorizontally ? 1 : 0;
char c2 = canScrollHorizontally ? 1 : 0;
canScrollHorizontally = z3 | true;
}
int i = canScrollHorizontally ? 1 : 0;
int i2 = canScrollHorizontally ? 1 : 0;
int i3 = canScrollHorizontally ? 1 : 0;
startNestedScroll(i, 0);
} else if (actionMasked == 1) {
this.mVelocityTracker.clear();
stopNestedScroll(0);
} else if (actionMasked == 2) {
int findPointerIndex = motionEvent.findPointerIndex(this.mScrollPointerId);
if (findPointerIndex < 0) {
StringBuilder L = a.L("Error processing scroll; pointer index for id ");
L.append(this.mScrollPointerId);
L.append(" not found. Did any MotionEvents get skipped?");
Log.e("RecyclerView", L.toString());
return false;
}
int x3 = (int) (motionEvent.getX(findPointerIndex) + 0.5f);
int y3 = (int) (motionEvent.getY(findPointerIndex) + 0.5f);
if (this.mScrollState != 1) {
int i4 = x3 - this.mInitialTouchX;
int i5 = y3 - this.mInitialTouchY;
if (!canScrollHorizontally || Math.abs(i4) <= this.mTouchSlop) {
z2 = false;
} else {
this.mLastTouchX = x3;
z2 = true;
}
if (canScrollVertically && Math.abs(i5) > this.mTouchSlop) {
this.mLastTouchY = y3;
z2 = true;
}
if (z2) {
setScrollState(1);
}
}
} else if (actionMasked == 3) {
cancelScroll();
} else if (actionMasked == 5) {
this.mScrollPointerId = motionEvent.getPointerId(actionIndex);
int x4 = (int) (motionEvent.getX(actionIndex) + 0.5f);
this.mLastTouchX = x4;
this.mInitialTouchX = x4;
int y4 = (int) (motionEvent.getY(actionIndex) + 0.5f);
this.mLastTouchY = y4;
this.mInitialTouchY = y4;
} else if (actionMasked == 6) {
onPointerUp(motionEvent);
}
return this.mScrollState == 1;
}
@Override // android.view.ViewGroup, android.view.View
public void onLayout(boolean z2, int i, int i2, int i3, int i4) {
TraceCompat.beginSection("RV OnLayout");
dispatchLayout();
TraceCompat.endSection();
this.mFirstLayoutComplete = true;
}
@Override // android.view.View
public void onMeasure(int i, int i2) {
LayoutManager layoutManager = this.mLayout;
if (layoutManager == null) {
defaultOnMeasure(i, i2);
return;
}
boolean z2 = 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) {
z2 = true;
}
if (!z2 && this.mAdapter != null) {
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);
}
}
} else if (this.mHasFixedSize) {
this.mLayout.onMeasure(this.mRecycler, this.mState, i, i2);
} else {
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;
}
}
@Override // android.view.ViewGroup
public boolean onRequestFocusInDescendants(int i, Rect rect) {
if (isComputingLayout()) {
return false;
}
return super.onRequestFocusInDescendants(i, rect);
}
@Override // android.view.View
public void onRestoreInstanceState(Parcelable parcelable) {
Parcelable parcelable2;
if (!(parcelable instanceof SavedState)) {
super.onRestoreInstanceState(parcelable);
return;
}
SavedState savedState = (SavedState) parcelable;
this.mPendingSavedState = savedState;
super.onRestoreInstanceState(savedState.getSuperState());
LayoutManager layoutManager = this.mLayout;
if (layoutManager != null && (parcelable2 = this.mPendingSavedState.mLayoutState) != null) {
layoutManager.onRestoreInstanceState(parcelable2);
}
}
@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;
}
public void onScrollStateChanged(int i) {
}
public void onScrolled(@Px int i, @Px int i2) {
}
@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) {
invalidateGlows();
}
}
/* JADX WARNING: Removed duplicated region for block: B:45:0x00de */
/* JADX WARNING: Removed duplicated region for block: B:51:0x00f4 */
@Override // android.view.View
public boolean onTouchEvent(MotionEvent motionEvent) {
boolean z2;
boolean z3 = false;
if (this.mLayoutSuppressed || this.mIgnoreMotionEventTillDown) {
return false;
}
if (dispatchToOnItemTouchListeners(motionEvent)) {
cancelScroll();
return true;
}
LayoutManager layoutManager = this.mLayout;
if (layoutManager == null) {
return false;
}
boolean canScrollHorizontally = layoutManager.canScrollHorizontally();
boolean canScrollVertically = this.mLayout.canScrollVertically();
if (this.mVelocityTracker == null) {
this.mVelocityTracker = VelocityTracker.obtain();
}
int actionMasked = motionEvent.getActionMasked();
int actionIndex = motionEvent.getActionIndex();
if (actionMasked == 0) {
int[] iArr = this.mNestedOffsets;
iArr[1] = 0;
iArr[0] = 0;
}
MotionEvent obtain = MotionEvent.obtain(motionEvent);
int[] iArr2 = this.mNestedOffsets;
obtain.offsetLocation((float) iArr2[0], (float) iArr2[1]);
if (actionMasked == 0) {
this.mScrollPointerId = motionEvent.getPointerId(0);
int x2 = (int) (motionEvent.getX() + 0.5f);
this.mLastTouchX = x2;
this.mInitialTouchX = x2;
int y2 = (int) (motionEvent.getY() + 0.5f);
this.mLastTouchY = y2;
this.mInitialTouchY = y2;
if (canScrollVertically) {
boolean z4 = canScrollHorizontally ? 1 : 0;
char c2 = canScrollHorizontally ? 1 : 0;
canScrollHorizontally = z4 | true;
}
int i = canScrollHorizontally ? 1 : 0;
int i2 = canScrollHorizontally ? 1 : 0;
int i3 = canScrollHorizontally ? 1 : 0;
startNestedScroll(i, 0);
} else if (actionMasked == 1) {
this.mVelocityTracker.addMovement(obtain);
this.mVelocityTracker.computeCurrentVelocity(1000, (float) this.mMaxFlingVelocity);
float f = canScrollHorizontally ? -this.mVelocityTracker.getXVelocity(this.mScrollPointerId) : 0.0f;
float f2 = canScrollVertically ? -this.mVelocityTracker.getYVelocity(this.mScrollPointerId) : 0.0f;
if ((f == 0.0f && f2 == 0.0f) || !fling((int) f, (int) f2)) {
setScrollState(0);
}
resetScroll();
z3 = true;
} else if (actionMasked == 2) {
int findPointerIndex = motionEvent.findPointerIndex(this.mScrollPointerId);
if (findPointerIndex < 0) {
StringBuilder L = a.L("Error processing scroll; pointer index for id ");
L.append(this.mScrollPointerId);
L.append(" not found. Did any MotionEvents get skipped?");
Log.e("RecyclerView", L.toString());
return false;
}
int x3 = (int) (motionEvent.getX(findPointerIndex) + 0.5f);
int y3 = (int) (motionEvent.getY(findPointerIndex) + 0.5f);
int i4 = this.mLastTouchX - x3;
int i5 = this.mLastTouchY - y3;
if (this.mScrollState != 1) {
if (canScrollHorizontally) {
i4 = i4 > 0 ? Math.max(0, i4 - this.mTouchSlop) : Math.min(0, i4 + this.mTouchSlop);
if (i4 != 0) {
z2 = true;
if (canScrollVertically) {
i5 = i5 > 0 ? Math.max(0, i5 - this.mTouchSlop) : Math.min(0, i5 + this.mTouchSlop);
if (i5 != 0) {
z2 = true;
}
}
if (z2) {
setScrollState(1);
}
}
}
z2 = false;
if (canScrollVertically) {
}
if (z2) {
}
}
int i6 = i4;
int i7 = i5;
if (this.mScrollState == 1) {
int[] iArr3 = this.mReusableIntPair;
iArr3[0] = 0;
iArr3[1] = 0;
if (dispatchNestedPreScroll(canScrollHorizontally ? i6 : 0, canScrollVertically ? i7 : 0, iArr3, this.mScrollOffset, 0)) {
int[] iArr4 = this.mReusableIntPair;
i6 -= iArr4[0];
i7 -= iArr4[1];
int[] iArr5 = this.mNestedOffsets;
int i8 = iArr5[0];
int[] iArr6 = this.mScrollOffset;
iArr5[0] = i8 + iArr6[0];
iArr5[1] = iArr5[1] + iArr6[1];
getParent().requestDisallowInterceptTouchEvent(true);
}
int[] iArr7 = this.mScrollOffset;
this.mLastTouchX = x3 - iArr7[0];
this.mLastTouchY = y3 - iArr7[1];
if (scrollByInternal(canScrollHorizontally ? i6 : 0, canScrollVertically ? i7 : 0, motionEvent)) {
getParent().requestDisallowInterceptTouchEvent(true);
}
GapWorker gapWorker = this.mGapWorker;
if (!(gapWorker == null || (i6 == 0 && i7 == 0))) {
gapWorker.postFromTraversal(this, i6, i7);
}
}
} else if (actionMasked == 3) {
cancelScroll();
} else if (actionMasked == 5) {
this.mScrollPointerId = motionEvent.getPointerId(actionIndex);
int x4 = (int) (motionEvent.getX(actionIndex) + 0.5f);
this.mLastTouchX = x4;
this.mInitialTouchX = x4;
int y4 = (int) (motionEvent.getY(actionIndex) + 0.5f);
this.mLastTouchY = y4;
this.mInitialTouchY = y4;
} else if (actionMasked == 6) {
onPointerUp(motionEvent);
}
if (!z3) {
this.mVelocityTracker.addMovement(obtain);
}
obtain.recycle();
return true;
}
public void postAnimationRunner() {
if (!this.mPostedAnimatorRunner && this.mIsAttached) {
ViewCompat.postOnAnimation(this, this.mItemAnimatorRunner);
this.mPostedAnimatorRunner = true;
}
}
public void processDataSetCompletelyChanged(boolean z2) {
this.mDispatchItemsChangedEvent = z2 | this.mDispatchItemsChangedEvent;
this.mDataSetHasChangedAfterLayout = true;
markKnownViewsInvalid();
}
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);
}
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();
}
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;
}
@Override // android.view.ViewGroup
public void removeDetachedView(View view, boolean z2) {
ViewHolder childViewHolderInt = getChildViewHolderInt(view);
if (childViewHolderInt != null) {
if (childViewHolderInt.isTmpDetached()) {
childViewHolderInt.clearTmpDetachFlag();
} else if (!childViewHolderInt.shouldIgnore()) {
StringBuilder sb = new StringBuilder();
sb.append("Called removeDetachedView with a view which is not flagged as tmp detached.");
sb.append(childViewHolderInt);
throw new IllegalArgumentException(a.h(this, sb));
}
}
view.clearAnimation();
dispatchChildDetached(view);
super.removeDetachedView(view, z2);
}
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 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 removeOnChildAttachStateChangeListener(@NonNull OnChildAttachStateChangeListener onChildAttachStateChangeListener) {
List<OnChildAttachStateChangeListener> list = this.mOnChildAttachStateListeners;
if (list != null) {
list.remove(onChildAttachStateChangeListener);
}
}
public void removeOnItemTouchListener(@NonNull OnItemTouchListener onItemTouchListener) {
this.mOnItemTouchListeners.remove(onItemTouchListener);
if (this.mInterceptingOnItemTouchListener == onItemTouchListener) {
this.mInterceptingOnItemTouchListener = null;
}
}
public void removeOnScrollListener(@NonNull OnScrollListener onScrollListener) {
List<OnScrollListener> list = this.mScrollListeners;
if (list != null) {
list.remove(onScrollListener);
}
}
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);
}
}
}
}
@Override // android.view.ViewGroup, android.view.ViewParent
public void requestChildFocus(View view, View view2) {
if (!this.mLayout.onRequestChildFocus(this, this.mState, view, view2) && view2 != null) {
requestChildOnScreen(view, view2);
}
super.requestChildFocus(view, view2);
}
@Override // android.view.ViewGroup, android.view.ViewParent
public boolean requestChildRectangleOnScreen(View view, Rect rect, boolean z2) {
return this.mLayout.requestChildRectangleOnScreen(this, view, rect, z2);
}
@Override // android.view.ViewGroup, android.view.ViewParent
public void requestDisallowInterceptTouchEvent(boolean z2) {
int size = this.mOnItemTouchListeners.size();
for (int i = 0; i < size; i++) {
this.mOnItemTouchListeners.get(i).onRequestDisallowInterceptTouchEvent(z2);
}
super.requestDisallowInterceptTouchEvent(z2);
}
@Override // android.view.ViewParent, android.view.View
public void requestLayout() {
if (this.mInterceptRequestLayoutDepth != 0 || this.mLayoutSuppressed) {
this.mLayoutWasDefered = true;
} else {
super.requestLayout();
}
}
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();
}
}
}
@Override // android.view.View
public void scrollBy(int i, int i2) {
LayoutManager layoutManager = this.mLayout;
if (layoutManager == null) {
Log.e("RecyclerView", "Cannot scroll without a LayoutManager set. Call setLayoutManager with a non-null argument.");
} else if (!this.mLayoutSuppressed) {
boolean canScrollHorizontally = layoutManager.canScrollHorizontally();
boolean canScrollVertically = this.mLayout.canScrollVertically();
if (canScrollHorizontally || canScrollVertically) {
if (!canScrollHorizontally) {
i = 0;
}
if (!canScrollVertically) {
i2 = 0;
}
scrollByInternal(i, i2, null);
}
}
}
public boolean scrollByInternal(int i, int i2, MotionEvent motionEvent) {
int i3;
int i4;
int i5;
int i6;
consumePendingUpdateOperations();
if (this.mAdapter != null) {
int[] iArr = this.mReusableIntPair;
iArr[0] = 0;
iArr[1] = 0;
scrollStep(i, i2, iArr);
int[] iArr2 = this.mReusableIntPair;
int i7 = iArr2[0];
int i8 = iArr2[1];
i6 = i8;
i5 = i7;
i4 = i - i7;
i3 = i2 - i8;
} else {
i6 = 0;
i5 = 0;
i4 = 0;
i3 = 0;
}
if (!this.mItemDecorations.isEmpty()) {
invalidate();
}
int[] iArr3 = this.mReusableIntPair;
iArr3[0] = 0;
iArr3[1] = 0;
dispatchNestedScroll(i5, i6, i4, i3, this.mScrollOffset, 0, iArr3);
int[] iArr4 = this.mReusableIntPair;
int i9 = i4 - iArr4[0];
int i10 = i3 - iArr4[1];
boolean z2 = (iArr4[0] == 0 && iArr4[1] == 0) ? false : true;
int i11 = this.mLastTouchX;
int[] iArr5 = this.mScrollOffset;
this.mLastTouchX = i11 - iArr5[0];
this.mLastTouchY -= iArr5[1];
int[] iArr6 = this.mNestedOffsets;
iArr6[0] = iArr6[0] + iArr5[0];
iArr6[1] = iArr6[1] + iArr5[1];
if (getOverScrollMode() != 2) {
if (motionEvent != null && !MotionEventCompat.isFromSource(motionEvent, 8194)) {
pullGlows(motionEvent.getX(), (float) i9, motionEvent.getY(), (float) i10);
}
considerReleasingGlowsOnScroll(i, i2);
}
if (!(i5 == 0 && i6 == 0)) {
dispatchOnScrolled(i5, i6);
}
if (!awakenScrollBars()) {
invalidate();
}
return (!z2 && i5 == 0 && i6 == 0) ? false : true;
}
public void scrollStep(int i, int i2, @Nullable int[] iArr) {
startInterceptRequestLayout();
onEnterLayoutOrScroll();
TraceCompat.beginSection("RV Scroll");
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;
}
}
@Override // android.view.View
public void scrollTo(int i, int i2) {
Log.w("RecyclerView", "RecyclerView does not support scrolling to an absolute position. Use scrollToPosition instead");
}
public void scrollToPosition(int i) {
if (!this.mLayoutSuppressed) {
stopScroll();
LayoutManager layoutManager = this.mLayout;
if (layoutManager == null) {
Log.e("RecyclerView", "Cannot scroll to position a LayoutManager set. Call setLayoutManager with a non-null argument.");
return;
}
layoutManager.scrollToPosition(i);
awakenScrollBars();
}
}
@Override // android.view.View, android.view.accessibility.AccessibilityEventSource
public void sendAccessibilityEventUnchecked(AccessibilityEvent accessibilityEvent) {
if (!shouldDeferAccessibilityEvent(accessibilityEvent)) {
super.sendAccessibilityEventUnchecked(accessibilityEvent);
}
}
public void setAccessibilityDelegateCompat(@Nullable RecyclerViewAccessibilityDelegate recyclerViewAccessibilityDelegate) {
this.mAccessibilityDelegate = recyclerViewAccessibilityDelegate;
ViewCompat.setAccessibilityDelegate(this, recyclerViewAccessibilityDelegate);
}
public void setAdapter(@Nullable Adapter adapter) {
setLayoutFrozen(false);
setAdapterInternal(adapter, false, true);
processDataSetCompletelyChanged(false);
requestLayout();
}
public void setChildDrawingOrderCallback(@Nullable ChildDrawingOrderCallback childDrawingOrderCallback) {
if (childDrawingOrderCallback != this.mChildDrawingOrderCallback) {
this.mChildDrawingOrderCallback = childDrawingOrderCallback;
setChildrenDrawingOrderEnabled(childDrawingOrderCallback != null);
}
}
@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;
}
@Override // android.view.ViewGroup
public void setClipToPadding(boolean z2) {
if (z2 != this.mClipToPadding) {
invalidateGlows();
}
this.mClipToPadding = z2;
super.setClipToPadding(z2);
if (this.mFirstLayoutComplete) {
requestLayout();
}
}
public void setEdgeEffectFactory(@NonNull EdgeEffectFactory edgeEffectFactory) {
Preconditions.checkNotNull(edgeEffectFactory);
this.mEdgeEffectFactory = edgeEffectFactory;
invalidateGlows();
}
public void setHasFixedSize(boolean z2) {
this.mHasFixedSize = z2;
}
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 setItemViewCacheSize(int i) {
this.mRecycler.setViewCacheSize(i);
}
@Deprecated
public void setLayoutFrozen(boolean z2) {
suppressLayout(z2);
}
public void setLayoutManager(@Nullable LayoutManager layoutManager) {
if (layoutManager != this.mLayout) {
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) {
layoutManager.setRecyclerView(this);
if (this.mIsAttached) {
this.mLayout.dispatchAttachedToWindow(this);
}
} else {
StringBuilder sb = new StringBuilder();
sb.append("LayoutManager ");
sb.append(layoutManager);
sb.append(" is already attached to a RecyclerView:");
throw new IllegalArgumentException(a.h(layoutManager.mRecyclerView, sb));
}
}
this.mRecycler.updateViewCacheSize();
requestLayout();
}
}
@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");
}
@Override // android.view.View, androidx.core.view.NestedScrollingChild
public void setNestedScrollingEnabled(boolean z2) {
getScrollingChildHelper().setNestedScrollingEnabled(z2);
}
public void setOnFlingListener(@Nullable OnFlingListener onFlingListener) {
this.mOnFlingListener = onFlingListener;
}
@Deprecated
public void setOnScrollListener(@Nullable OnScrollListener onScrollListener) {
this.mScrollListener = onScrollListener;
}
public void setPreserveFocusAfterLayout(boolean z2) {
this.mPreserveFocusAfterLayout = z2;
}
public void setRecycledViewPool(@Nullable RecycledViewPool recycledViewPool) {
this.mRecycler.setRecycledViewPool(recycledViewPool);
}
public void setRecyclerListener(@Nullable RecyclerListener recyclerListener) {
this.mRecyclerListener = recyclerListener;
}
public void setScrollState(int i) {
if (i != this.mScrollState) {
this.mScrollState = i;
if (i != 2) {
stopScrollersInternal();
}
dispatchOnScrollStateChanged(i);
}
}
public void setScrollingTouchSlop(int i) {
ViewConfiguration viewConfiguration = ViewConfiguration.get(getContext());
if (i != 0) {
if (i != 1) {
Log.w("RecyclerView", "setScrollingTouchSlop(): bad argument constant " + i + "; using default value");
} else {
this.mTouchSlop = viewConfiguration.getScaledPagingTouchSlop();
return;
}
}
this.mTouchSlop = viewConfiguration.getScaledTouchSlop();
}
public void setViewCacheExtension(@Nullable ViewCacheExtension viewCacheExtension) {
this.mRecycler.setViewCacheExtension(viewCacheExtension);
}
public boolean shouldDeferAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
int i = 0;
if (!isComputingLayout()) {
return false;
}
int contentChangeTypes = accessibilityEvent != null ? AccessibilityEventCompat.getContentChangeTypes(accessibilityEvent) : 0;
if (contentChangeTypes != 0) {
i = contentChangeTypes;
}
this.mEatenAccessibilityChangeFlags |= i;
return true;
}
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 z2) {
LayoutManager layoutManager = this.mLayout;
if (layoutManager == null) {
Log.e("RecyclerView", "Cannot smooth scroll without a LayoutManager set. Call setLayoutManager with a non-null argument.");
} else if (!this.mLayoutSuppressed) {
int i4 = 0;
if (!layoutManager.canScrollHorizontally()) {
i = 0;
}
if (!this.mLayout.canScrollVertically()) {
i2 = 0;
}
if (i != 0 || i2 != 0) {
if (i3 == Integer.MIN_VALUE || i3 > 0) {
if (z2) {
if (i != 0) {
i4 = 1;
}
if (i2 != 0) {
i4 |= 2;
}
startNestedScroll(i4, 1);
}
this.mViewFlinger.smoothScrollBy(i, i2, i3, interpolator);
return;
}
scrollBy(i, i2);
}
}
}
public void smoothScrollToPosition(int i) {
if (!this.mLayoutSuppressed) {
LayoutManager layoutManager = this.mLayout;
if (layoutManager == null) {
Log.e("RecyclerView", "Cannot smooth scroll without a LayoutManager set. Call setLayoutManager with a non-null argument.");
} else {
layoutManager.smoothScrollToPosition(this, this.mState, i);
}
}
}
public void startInterceptRequestLayout() {
int i = this.mInterceptRequestLayoutDepth + 1;
this.mInterceptRequestLayoutDepth = i;
if (i == 1 && !this.mLayoutSuppressed) {
this.mLayoutWasDefered = false;
}
}
@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);
}
public void stopInterceptRequestLayout(boolean z2) {
if (this.mInterceptRequestLayoutDepth < 1) {
this.mInterceptRequestLayoutDepth = 1;
}
if (!z2 && !this.mLayoutSuppressed) {
this.mLayoutWasDefered = false;
}
if (this.mInterceptRequestLayoutDepth == 1) {
if (z2 && this.mLayoutWasDefered && !this.mLayoutSuppressed && this.mLayout != null && this.mAdapter != null) {
dispatchLayout();
}
if (!this.mLayoutSuppressed) {
this.mLayoutWasDefered = false;
}
}
this.mInterceptRequestLayoutDepth--;
}
@Override // android.view.View, androidx.core.view.NestedScrollingChild
public void stopNestedScroll() {
getScrollingChildHelper().stopNestedScroll();
}
@Override // androidx.core.view.NestedScrollingChild2
public void stopNestedScroll(int i) {
getScrollingChildHelper().stopNestedScroll(i);
}
public void stopScroll() {
setScrollState(0);
stopScrollersInternal();
}
@Override // android.view.ViewGroup
public final void suppressLayout(boolean z2) {
if (z2 != this.mLayoutSuppressed) {
assertNotInLayoutOrScroll("Do not suppressLayout in layout or scroll");
if (!z2) {
this.mLayoutSuppressed = false;
if (!(!this.mLayoutWasDefered || this.mLayout == null || this.mAdapter == null)) {
requestLayout();
}
this.mLayoutWasDefered = false;
return;
}
long uptimeMillis = SystemClock.uptimeMillis();
onTouchEvent(MotionEvent.obtain(uptimeMillis, uptimeMillis, 3, 0.0f, 0.0f, 0));
this.mLayoutSuppressed = true;
this.mIgnoreMotionEventTillDown = true;
stopScroll();
}
}
public void swapAdapter(@Nullable Adapter adapter, boolean z2) {
setLayoutFrozen(false);
setAdapterInternal(adapter, true, z2);
processDataSetCompletelyChanged(true);
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);
}
}