Rabbit-R1/android (non root)/java/sources/com/chad/library/adapter/base/BaseQuickAdapter.java

1668 lines
87 KiB
Java
Raw Normal View History

2024-05-21 21:08:36 +00:00
package com.chad.library.adapter.base;
import android.animation.Animator;
import android.content.Context;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import androidx.exifinterface.media.ExifInterface;
import androidx.recyclerview.widget.DiffUtil;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import com.chad.library.adapter.base.animation.AlphaInAnimation;
import com.chad.library.adapter.base.animation.BaseAnimation;
import com.chad.library.adapter.base.animation.ScaleInAnimation;
import com.chad.library.adapter.base.animation.SlideInBottomAnimation;
import com.chad.library.adapter.base.animation.SlideInLeftAnimation;
import com.chad.library.adapter.base.animation.SlideInRightAnimation;
import com.chad.library.adapter.base.diff.BrvahAsyncDiffer;
import com.chad.library.adapter.base.diff.BrvahAsyncDifferConfig;
import com.chad.library.adapter.base.diff.BrvahListUpdateCallback;
import com.chad.library.adapter.base.listener.GridSpanSizeLookup;
import com.chad.library.adapter.base.listener.OnItemChildClickListener;
import com.chad.library.adapter.base.listener.OnItemChildLongClickListener;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.chad.library.adapter.base.listener.OnItemLongClickListener;
import com.chad.library.adapter.base.module.BaseDraggableModule;
import com.chad.library.adapter.base.module.BaseLoadMoreModule;
import com.chad.library.adapter.base.module.BaseUpFetchModule;
import com.chad.library.adapter.base.module.DraggableModule;
import com.chad.library.adapter.base.module.LoadMoreModule;
import com.chad.library.adapter.base.module.UpFetchModule;
import com.chad.library.adapter.base.util.AdapterUtilsKt;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import io.sentry.protocol.Device;
import java.lang.reflect.Constructor;
import java.lang.reflect.GenericSignatureFormatError;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.MalformedParameterizedTypeException;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import kotlin.Deprecated;
import kotlin.Metadata;
import kotlin.NoWhenBranchMatchedException;
import kotlin.ReplaceWith;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: BaseQuickAdapter.kt */
@Metadata(d1 = {"\u0000\u008e\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010!\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\u000b\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u001e\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\n\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0015\n\u0002\b\u0006\n\u0002\u0010\u001e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u000e\n\u0002\u0010 \n\u0002\u0010\u0000\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\f\n\u0002\u0010\t\n\u0002\b$\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0016\n\u0002\u0018\u0002\n\u0002\b\u0003\b&\u0018\u0000 ï\u0001*\u0004\b\u0000\u0010\u0001*\b\b\u0001\u0010\u0002*\u00020\u00032\b\u0012\u0004\u0012\u0002H\u00020\u0004:\u0004î\u0001ï\u0001B#\b\u0007\u0012\b\b\u0001\u0010\u0005\u001a\u00020\u0006\u0012\u0010\b\u0002\u0010\u0007\u001a\n\u0012\u0004\u0012\u00028\u0000\u0018\u00010\\u0006\u0002\u0010\tJ\u0010\u0010n\u001a\u00020o2\u0006\u0010p\u001a\u00020qH\u0002J\u0014\u0010r\u001a\u00020o2\f\b\u0001\u0010s\u001a\u00020t\"\u00020\u0006J\u0014\u0010u\u001a\u00020o2\f\b\u0001\u0010s\u001a\u00020t\"\u00020\u0006J\u0017\u0010v\u001a\u00020o2\b\b\u0001\u0010\u0007\u001a\u00028\u0000H\u0016¢\u0006\u0002\u0010wJ\u001f\u0010v\u001a\u00020o2\b\b\u0001\u0010x\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00028\u0000H\u0016¢\u0006\u0002\u0010yJ \u0010v\u001a\u00020o2\b\b\u0001\u0010x\u001a\u00020\u00062\f\u0010z\u001a\b\u0012\u0004\u0012\u00028\u00000{H\u0016J\u0018\u0010v\u001a\u00020o2\u000e\b\u0001\u0010z\u001a\b\u0012\u0004\u0012\u00028\u00000{H\u0016J%\u0010|\u001a\u00020\u00062\u0006\u0010}\u001a\u00020~2\b\b\u0002\u0010\u007f\u001a\u00020\u00062\t\b\u0002\u0010\u0080\u0001\u001a\u00020\u0006H\u0007J&\u0010\u0081\u0001\u001a\u00020\u00062\u0006\u0010}\u001a\u00020~2\b\b\u0002\u0010\u007f\u001a\u00020\u00062\t\b\u0002\u0010\u0080\u0001\u001a\u00020\u0006H\u0007J!\u0010\u0082\u0001\u001a\u00020o2\u0007\u0010\u0083\u0001\u001a\u00028\u00012\u0007\u0010\u0084\u0001\u001a\u00020\u0006H\u0014¢\u0006\u0003\u0010\u0085\u0001J\t\u0010\u0086\u0001\u001a\u00020oH\u0002J\u0012\u0010\u0087\u0001\u001a\u00020o2\u0007\u0010\u0088\u0001\u001a\u00020\u0006H\u0004J \u0010\u0089\u0001\u001a\u00020o2\u0006\u0010p\u001a\u00028\u00012\u0007\u0010\u008a\u0001\u001a\u00028\u0000H$¢\u0006\u0003\u0010\u008b\u0001J1\u0010\u0089\u0001\u001a\u00020o2\u0006\u0010p\u001a\u00028\u00012\u0007\u0010\u008a\u0001\u001a\u00028\u00002\u000f\u0010\u008c\u0001\u001a\n\u0012\u0005\u0012\u00030\u008e\u00010\u008d\u0001H\u0014¢\u0006\u0003\u0010\u008f\u0001J'\u0010\u0090\u0001\u001a\u0004\u0018\u00018\u00012\f\u0010\u0091\u0001\u001a\u0007\u0012\u0002\b\u00030\u0092\u00012\u0006\u0010}\u001a\u00020~H\u0002¢\u0006\u0003\u0010\u0093\u0001J\u0017\u0010\u0094\u0001\u001a\u00028\u00012\u0006\u0010}\u001a\u00020~H\u0014¢\u0006\u0003\u0010\u0095\u0001J#\u0010\u0094\u0001\u001a\u00028\u00012\b\u0010\u0096\u0001\u001a\u00030\u0097\u00012\b\b\u0001\u0010\u0005\u001a\u00020\u0006H\u0014¢\u0006\u0003\u0010\u0098\u0001J\r\u0010\u0099\u0001\u001a\b\u0012\u0004\u0012\u00020\u00060\u0018J\r\u0010\u009a\u0001\u001a\b\u0012\u0004\u0012\u00020\u00060\u0018J\t\u0010\u009b\u0001\u001a\u00020\u0006H\u0014J\u0011\u0010\u009c\u0001\u001a\u00020\u00062\u0006\u0010x\u001a\u00020\u0006H\u0014J\u000f\u0010\u009d\u0001\u001a\b\u0012\u0004\u0012\u00028\u00000OH\u0007J\r\u0010\u009e\u0001\u001a\b\u0012\u0004\u0012\u00028\u00000OJ\u001e\u0010\u009f\u0001\u001a\t\u0012\u0002\b
/* loaded from: classes2.dex */
public abstract class BaseQuickAdapter<T, VH extends BaseViewHolder> extends RecyclerView.Adapter<VH> {
public static final int EMPTY_VIEW = 268436821;
public static final int FOOTER_VIEW = 268436275;
public static final int HEADER_VIEW = 268435729;
public static final int LOAD_MORE_VIEW = 268436002;
private BaseAnimation adapterAnimation;
private boolean animationEnable;
private final LinkedHashSet<Integer> childClickViewIds;
private final LinkedHashSet<Integer> childLongClickViewIds;
private List<T> data;
private boolean footerViewAsFlow;
private boolean footerWithEmptyEnable;
private boolean headerViewAsFlow;
private boolean headerWithEmptyEnable;
private boolean isAnimationFirstOnly;
private boolean isUseEmpty;
private final int layoutResId;
private BrvahAsyncDiffer<T> mDiffHelper;
private BaseDraggableModule mDraggableModule;
private FrameLayout mEmptyLayout;
private LinearLayout mFooterLayout;
private LinearLayout mHeaderLayout;
private int mLastPosition;
private BaseLoadMoreModule mLoadMoreModule;
private OnItemChildClickListener mOnItemChildClickListener;
private OnItemChildLongClickListener mOnItemChildLongClickListener;
private OnItemClickListener mOnItemClickListener;
private OnItemLongClickListener mOnItemLongClickListener;
private GridSpanSizeLookup mSpanSizeLookup;
private BaseUpFetchModule mUpFetchModule;
private RecyclerView recyclerViewOrNull;
/* compiled from: BaseQuickAdapter.kt */
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\b\u0007\b\u0086\u0001\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002j\u0002\b\u0003j\u0002\b\u0004j\u0002\b\u0005j\u0002\b\u0006j\u0002\b\u0007¨\u0006\b"}, d2 = {"Lcom/chad/library/adapter/base/BaseQuickAdapter$AnimationType;", "", "(Ljava/lang/String;I)V", "AlphaIn", "ScaleIn", "SlideInBottom", "SlideInLeft", "SlideInRight", "com.github.CymChad.brvah"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes2.dex */
public enum AnimationType {
AlphaIn,
ScaleIn,
SlideInBottom,
SlideInLeft,
SlideInRight
}
/* compiled from: BaseQuickAdapter.kt */
@Metadata(k = 3, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes2.dex */
public /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
static {
int[] iArr = new int[AnimationType.values().length];
try {
iArr[AnimationType.AlphaIn.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
iArr[AnimationType.ScaleIn.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
iArr[AnimationType.SlideInBottom.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
iArr[AnimationType.SlideInLeft.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
iArr[AnimationType.SlideInRight.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
$EnumSwitchMapping$0 = iArr;
}
}
/* JADX WARN: Multi-variable type inference failed */
public BaseQuickAdapter(int i) {
this(i, null, 2, 0 == true ? 1 : 0);
}
public final int addFooterView(View view) {
Intrinsics.checkNotNullParameter(view, "view");
return addFooterView$default(this, view, 0, 0, 6, null);
}
public final int addFooterView(View view, int i) {
Intrinsics.checkNotNullParameter(view, "view");
return addFooterView$default(this, view, i, 0, 4, null);
}
public final int addHeaderView(View view) {
Intrinsics.checkNotNullParameter(view, "view");
return addHeaderView$default(this, view, 0, 0, 6, null);
}
public final int addHeaderView(View view, int i) {
Intrinsics.checkNotNullParameter(view, "view");
return addHeaderView$default(this, view, i, 0, 4, null);
}
protected abstract void convert(VH holder, T item);
protected void convert(VH holder, T item, List<? extends Object> payloads) {
Intrinsics.checkNotNullParameter(holder, "holder");
Intrinsics.checkNotNullParameter(payloads, "payloads");
}
public final BaseAnimation getAdapterAnimation() {
return this.adapterAnimation;
}
public final boolean getAnimationEnable() {
return this.animationEnable;
}
public final LinkedHashSet<Integer> getChildClickViewIds() {
return this.childClickViewIds;
}
public final LinkedHashSet<Integer> getChildLongClickViewIds() {
return this.childLongClickViewIds;
}
public final List<T> getData() {
return this.data;
}
public final boolean getFooterViewAsFlow() {
return this.footerViewAsFlow;
}
public final boolean getFooterWithEmptyEnable() {
return this.footerWithEmptyEnable;
}
public final boolean getHeaderViewAsFlow() {
return this.headerViewAsFlow;
}
public final boolean getHeaderWithEmptyEnable() {
return this.headerWithEmptyEnable;
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public long getItemId(int position) {
return position;
}
/* renamed from: getMLoadMoreModule$com_github_CymChad_brvah, reason: from getter */
public final BaseLoadMoreModule getMLoadMoreModule() {
return this.mLoadMoreModule;
}
/* renamed from: getOnItemChildClickListener, reason: from getter */
public final OnItemChildClickListener getMOnItemChildClickListener() {
return this.mOnItemChildClickListener;
}
/* renamed from: getOnItemChildLongClickListener, reason: from getter */
public final OnItemChildLongClickListener getMOnItemChildLongClickListener() {
return this.mOnItemChildLongClickListener;
}
/* renamed from: getOnItemClickListener, reason: from getter */
public final OnItemClickListener getMOnItemClickListener() {
return this.mOnItemClickListener;
}
/* renamed from: getOnItemLongClickListener, reason: from getter */
public final OnItemLongClickListener getMOnItemLongClickListener() {
return this.mOnItemLongClickListener;
}
public final RecyclerView getRecyclerViewOrNull() {
return this.recyclerViewOrNull;
}
/* renamed from: isAnimationFirstOnly, reason: from getter */
public final boolean getIsAnimationFirstOnly() {
return this.isAnimationFirstOnly;
}
/* JADX INFO: Access modifiers changed from: protected */
public boolean isFixedViewType(int type) {
return type == 268436821 || type == 268435729 || type == 268436275 || type == 268436002;
}
/* renamed from: isUseEmpty, reason: from getter */
public final boolean getIsUseEmpty() {
return this.isUseEmpty;
}
protected void onItemViewHolderCreated(VH viewHolder, int viewType) {
Intrinsics.checkNotNullParameter(viewHolder, "viewHolder");
}
public final void setAdapterAnimation(BaseAnimation baseAnimation) {
this.animationEnable = true;
this.adapterAnimation = baseAnimation;
}
public final void setAnimationEnable(boolean z) {
this.animationEnable = z;
}
public final void setAnimationFirstOnly(boolean z) {
this.isAnimationFirstOnly = z;
}
public final void setData$com_github_CymChad_brvah(List<T> list) {
Intrinsics.checkNotNullParameter(list, "<set-?>");
this.data = list;
}
public final void setDiffNewData(List<T> list) {
setDiffNewData$default(this, list, null, 2, null);
}
public final int setFooterView(View view) {
Intrinsics.checkNotNullParameter(view, "view");
return setFooterView$default(this, view, 0, 0, 6, null);
}
public final int setFooterView(View view, int i) {
Intrinsics.checkNotNullParameter(view, "view");
return setFooterView$default(this, view, i, 0, 4, null);
}
public final void setFooterViewAsFlow(boolean z) {
this.footerViewAsFlow = z;
}
public final void setFooterWithEmptyEnable(boolean z) {
this.footerWithEmptyEnable = z;
}
public final void setGridSpanSizeLookup(GridSpanSizeLookup spanSizeLookup) {
this.mSpanSizeLookup = spanSizeLookup;
}
public final int setHeaderView(View view) {
Intrinsics.checkNotNullParameter(view, "view");
return setHeaderView$default(this, view, 0, 0, 6, null);
}
public final int setHeaderView(View view, int i) {
Intrinsics.checkNotNullParameter(view, "view");
return setHeaderView$default(this, view, i, 0, 4, null);
}
public final void setHeaderViewAsFlow(boolean z) {
this.headerViewAsFlow = z;
}
public final void setHeaderWithEmptyEnable(boolean z) {
this.headerWithEmptyEnable = z;
}
public final void setMLoadMoreModule$com_github_CymChad_brvah(BaseLoadMoreModule baseLoadMoreModule) {
this.mLoadMoreModule = baseLoadMoreModule;
}
public final void setOnItemChildClickListener(OnItemChildClickListener listener) {
this.mOnItemChildClickListener = listener;
}
public final void setOnItemChildLongClickListener(OnItemChildLongClickListener listener) {
this.mOnItemChildLongClickListener = listener;
}
public final void setOnItemClickListener(OnItemClickListener listener) {
this.mOnItemClickListener = listener;
}
public final void setOnItemLongClickListener(OnItemLongClickListener listener) {
this.mOnItemLongClickListener = listener;
}
public final void setUseEmpty(boolean z) {
this.isUseEmpty = z;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public /* bridge */ /* synthetic */ void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i, List list) {
onBindViewHolder((BaseQuickAdapter<T, VH>) viewHolder, i, (List<Object>) list);
}
public /* synthetic */ BaseQuickAdapter(int i, List list, int i2, DefaultConstructorMarker defaultConstructorMarker) {
this(i, (i2 & 2) != 0 ? null : list);
}
public BaseQuickAdapter(int i, ArrayList arrayList) {
this.layoutResId = i;
this.data = arrayList == null ? new ArrayList() : arrayList;
this.isUseEmpty = true;
this.isAnimationFirstOnly = true;
this.mLastPosition = -1;
checkModule();
this.childClickViewIds = new LinkedHashSet<>();
this.childLongClickViewIds = new LinkedHashSet<>();
}
public final BaseLoadMoreModule getLoadMoreModule() {
BaseLoadMoreModule baseLoadMoreModule = this.mLoadMoreModule;
if (baseLoadMoreModule == null) {
throw new IllegalStateException("Please first implements LoadMoreModule".toString());
}
Intrinsics.checkNotNull(baseLoadMoreModule);
return baseLoadMoreModule;
}
public final BaseUpFetchModule getUpFetchModule() {
BaseUpFetchModule baseUpFetchModule = this.mUpFetchModule;
if (baseUpFetchModule == null) {
throw new IllegalStateException("Please first implements UpFetchModule".toString());
}
Intrinsics.checkNotNull(baseUpFetchModule);
return baseUpFetchModule;
}
public final BaseDraggableModule getDraggableModule() {
BaseDraggableModule baseDraggableModule = this.mDraggableModule;
if (baseDraggableModule == null) {
throw new IllegalStateException("Please first implements DraggableModule".toString());
}
Intrinsics.checkNotNull(baseDraggableModule);
return baseDraggableModule;
}
public final RecyclerView getRecyclerView() {
RecyclerView recyclerView = this.recyclerViewOrNull;
if (recyclerView == null) {
throw new IllegalStateException("Please get it after onAttachedToRecyclerView()".toString());
}
Intrinsics.checkNotNull(recyclerView);
return recyclerView;
}
public final Context getContext() {
Context context = getRecyclerView().getContext();
Intrinsics.checkNotNullExpressionValue(context, "recyclerView.context");
return context;
}
/* JADX WARN: Multi-variable type inference failed */
private final void checkModule() {
if (this instanceof LoadMoreModule) {
this.mLoadMoreModule = ((LoadMoreModule) this).addLoadMoreModule(this);
}
if (this instanceof UpFetchModule) {
this.mUpFetchModule = ((UpFetchModule) this).addUpFetchModule(this);
}
if (this instanceof DraggableModule) {
this.mDraggableModule = ((DraggableModule) this).addDraggableModule(this);
}
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public VH onCreateViewHolder(ViewGroup parent, int viewType) {
VH createBaseViewHolder;
Intrinsics.checkNotNullParameter(parent, "parent");
KeyEvent.Callback callback = null;
switch (viewType) {
case HEADER_VIEW /* 268435729 */:
LinearLayout linearLayout = this.mHeaderLayout;
if (linearLayout == null) {
Intrinsics.throwUninitializedPropertyAccessException("mHeaderLayout");
linearLayout = null;
}
ViewParent parent2 = linearLayout.getParent();
if (parent2 instanceof ViewGroup) {
ViewGroup viewGroup = (ViewGroup) parent2;
LinearLayout linearLayout2 = this.mHeaderLayout;
if (linearLayout2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mHeaderLayout");
linearLayout2 = null;
}
viewGroup.removeView(linearLayout2);
}
KeyEvent.Callback callback2 = this.mHeaderLayout;
if (callback2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mHeaderLayout");
} else {
callback = callback2;
}
return createBaseViewHolder((View) callback);
case LOAD_MORE_VIEW /* 268436002 */:
BaseLoadMoreModule baseLoadMoreModule = this.mLoadMoreModule;
Intrinsics.checkNotNull(baseLoadMoreModule);
createBaseViewHolder = createBaseViewHolder(baseLoadMoreModule.getLoadMoreView().getRootView(parent));
BaseLoadMoreModule baseLoadMoreModule2 = this.mLoadMoreModule;
Intrinsics.checkNotNull(baseLoadMoreModule2);
baseLoadMoreModule2.setupViewHolder$com_github_CymChad_brvah(createBaseViewHolder);
break;
case FOOTER_VIEW /* 268436275 */:
LinearLayout linearLayout3 = this.mFooterLayout;
if (linearLayout3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mFooterLayout");
linearLayout3 = null;
}
ViewParent parent3 = linearLayout3.getParent();
if (parent3 instanceof ViewGroup) {
ViewGroup viewGroup2 = (ViewGroup) parent3;
LinearLayout linearLayout4 = this.mFooterLayout;
if (linearLayout4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mFooterLayout");
linearLayout4 = null;
}
viewGroup2.removeView(linearLayout4);
}
KeyEvent.Callback callback3 = this.mFooterLayout;
if (callback3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mFooterLayout");
} else {
callback = callback3;
}
return createBaseViewHolder((View) callback);
case EMPTY_VIEW /* 268436821 */:
FrameLayout frameLayout = this.mEmptyLayout;
if (frameLayout == null) {
Intrinsics.throwUninitializedPropertyAccessException("mEmptyLayout");
frameLayout = null;
}
ViewParent parent4 = frameLayout.getParent();
if (parent4 instanceof ViewGroup) {
ViewGroup viewGroup3 = (ViewGroup) parent4;
FrameLayout frameLayout2 = this.mEmptyLayout;
if (frameLayout2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mEmptyLayout");
frameLayout2 = null;
}
viewGroup3.removeView(frameLayout2);
}
KeyEvent.Callback callback4 = this.mEmptyLayout;
if (callback4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mEmptyLayout");
} else {
callback = callback4;
}
return createBaseViewHolder((View) callback);
default:
createBaseViewHolder = onCreateDefViewHolder(parent, viewType);
bindViewClickListener(createBaseViewHolder, viewType);
BaseDraggableModule baseDraggableModule = this.mDraggableModule;
if (baseDraggableModule != null) {
baseDraggableModule.initView$com_github_CymChad_brvah(createBaseViewHolder);
}
onItemViewHolderCreated(createBaseViewHolder, viewType);
break;
}
return createBaseViewHolder;
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public int getItemCount() {
if (hasEmptyView()) {
if (this.headerWithEmptyEnable && hasHeaderLayout()) {
r1 = 2;
}
return (this.footerWithEmptyEnable && hasFooterLayout()) ? r1 + 1 : r1;
}
BaseLoadMoreModule baseLoadMoreModule = this.mLoadMoreModule;
return getHeaderLayoutCount() + getDefItemCount() + getFooterLayoutCount() + ((baseLoadMoreModule == null || !baseLoadMoreModule.hasLoadMoreView()) ? 0 : 1);
}
/* JADX WARN: Type inference failed for: r4v1, types: [boolean] */
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public int getItemViewType(int position) {
if (hasEmptyView()) {
boolean z = this.headerWithEmptyEnable && hasHeaderLayout();
if (position != 0) {
return position != 1 ? FOOTER_VIEW : FOOTER_VIEW;
}
if (z) {
return HEADER_VIEW;
}
return EMPTY_VIEW;
}
boolean hasHeaderLayout = hasHeaderLayout();
if (hasHeaderLayout && position == 0) {
return HEADER_VIEW;
}
if (hasHeaderLayout) {
position--;
}
int size = this.data.size();
if (position < size) {
return getDefItemViewType(position);
}
return position - size < hasFooterLayout() ? FOOTER_VIEW : LOAD_MORE_VIEW;
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public void onBindViewHolder(VH holder, int position) {
Intrinsics.checkNotNullParameter(holder, "holder");
BaseUpFetchModule baseUpFetchModule = this.mUpFetchModule;
if (baseUpFetchModule != null) {
baseUpFetchModule.autoUpFetch$com_github_CymChad_brvah(position);
}
BaseLoadMoreModule baseLoadMoreModule = this.mLoadMoreModule;
if (baseLoadMoreModule != null) {
baseLoadMoreModule.autoLoadMore$com_github_CymChad_brvah(position);
}
switch (holder.getItemViewType()) {
case HEADER_VIEW /* 268435729 */:
case FOOTER_VIEW /* 268436275 */:
case EMPTY_VIEW /* 268436821 */:
return;
case LOAD_MORE_VIEW /* 268436002 */:
BaseLoadMoreModule baseLoadMoreModule2 = this.mLoadMoreModule;
if (baseLoadMoreModule2 != null) {
baseLoadMoreModule2.getLoadMoreView().convert(holder, position, baseLoadMoreModule2.getLoadMoreStatus());
return;
}
return;
default:
convert(holder, getItem(position - getHeaderLayoutCount()));
return;
}
}
public void onBindViewHolder(VH holder, int position, List<Object> payloads) {
Intrinsics.checkNotNullParameter(holder, "holder");
Intrinsics.checkNotNullParameter(payloads, "payloads");
if (payloads.isEmpty()) {
onBindViewHolder((BaseQuickAdapter<T, VH>) holder, position);
return;
}
BaseUpFetchModule baseUpFetchModule = this.mUpFetchModule;
if (baseUpFetchModule != null) {
baseUpFetchModule.autoUpFetch$com_github_CymChad_brvah(position);
}
BaseLoadMoreModule baseLoadMoreModule = this.mLoadMoreModule;
if (baseLoadMoreModule != null) {
baseLoadMoreModule.autoLoadMore$com_github_CymChad_brvah(position);
}
switch (holder.getItemViewType()) {
case HEADER_VIEW /* 268435729 */:
case FOOTER_VIEW /* 268436275 */:
case EMPTY_VIEW /* 268436821 */:
return;
case LOAD_MORE_VIEW /* 268436002 */:
BaseLoadMoreModule baseLoadMoreModule2 = this.mLoadMoreModule;
if (baseLoadMoreModule2 != null) {
baseLoadMoreModule2.getLoadMoreView().convert(holder, position, baseLoadMoreModule2.getLoadMoreStatus());
return;
}
return;
default:
convert(holder, getItem(position - getHeaderLayoutCount()), payloads);
return;
}
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public void onViewAttachedToWindow(VH holder) {
Intrinsics.checkNotNullParameter(holder, "holder");
VH vh = holder;
super.onViewAttachedToWindow((BaseQuickAdapter<T, VH>) vh);
if (isFixedViewType(holder.getItemViewType())) {
setFullSpan(vh);
} else {
addAnimation(vh);
}
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public void onAttachedToRecyclerView(RecyclerView recyclerView) {
Intrinsics.checkNotNullParameter(recyclerView, "recyclerView");
super.onAttachedToRecyclerView(recyclerView);
this.recyclerViewOrNull = recyclerView;
BaseDraggableModule baseDraggableModule = this.mDraggableModule;
if (baseDraggableModule != null) {
baseDraggableModule.attachToRecyclerView(recyclerView);
}
final RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
if (layoutManager instanceof GridLayoutManager) {
GridLayoutManager gridLayoutManager = (GridLayoutManager) layoutManager;
final GridLayoutManager.SpanSizeLookup spanSizeLookup = gridLayoutManager.getSpanSizeLookup();
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup(this) { // from class: com.chad.library.adapter.base.BaseQuickAdapter$onAttachedToRecyclerView$1
final /* synthetic */ BaseQuickAdapter<T, VH> this$0;
/* JADX INFO: Access modifiers changed from: package-private */
{
this.this$0 = this;
}
@Override // androidx.recyclerview.widget.GridLayoutManager.SpanSizeLookup
public int getSpanSize(int position) {
GridSpanSizeLookup gridSpanSizeLookup;
GridSpanSizeLookup gridSpanSizeLookup2;
int itemViewType = this.this$0.getItemViewType(position);
if (itemViewType == 268435729 && this.this$0.getHeaderViewAsFlow()) {
return 1;
}
if (itemViewType == 268436275 && this.this$0.getFooterViewAsFlow()) {
return 1;
}
gridSpanSizeLookup = ((BaseQuickAdapter) this.this$0).mSpanSizeLookup;
if (gridSpanSizeLookup == null) {
return this.this$0.isFixedViewType(itemViewType) ? ((GridLayoutManager) layoutManager).getSpanCount() : spanSizeLookup.getSpanSize(position);
}
if (!this.this$0.isFixedViewType(itemViewType)) {
gridSpanSizeLookup2 = ((BaseQuickAdapter) this.this$0).mSpanSizeLookup;
Intrinsics.checkNotNull(gridSpanSizeLookup2);
return gridSpanSizeLookup2.getSpanSize((GridLayoutManager) layoutManager, itemViewType, position - this.this$0.getHeaderLayoutCount());
}
return ((GridLayoutManager) layoutManager).getSpanCount();
}
});
}
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public void onDetachedFromRecyclerView(RecyclerView recyclerView) {
Intrinsics.checkNotNullParameter(recyclerView, "recyclerView");
super.onDetachedFromRecyclerView(recyclerView);
this.recyclerViewOrNull = null;
}
public T getItem(int position) {
return this.data.get(position);
}
public T getItemOrNull(int position) {
return (T) CollectionsKt.getOrNull(this.data, position);
}
public int getItemPosition(T item) {
if (item == null || !(!this.data.isEmpty())) {
return -1;
}
return this.data.indexOf(item);
}
public final void addChildClickViewIds(int... viewIds) {
Intrinsics.checkNotNullParameter(viewIds, "viewIds");
for (int i : viewIds) {
this.childClickViewIds.add(Integer.valueOf(i));
}
}
public final void addChildLongClickViewIds(int... viewIds) {
Intrinsics.checkNotNullParameter(viewIds, "viewIds");
for (int i : viewIds) {
this.childLongClickViewIds.add(Integer.valueOf(i));
}
}
/* JADX INFO: Access modifiers changed from: protected */
public void bindViewClickListener(final VH viewHolder, int viewType) {
Intrinsics.checkNotNullParameter(viewHolder, "viewHolder");
if (this.mOnItemClickListener != null) {
viewHolder.itemView.setOnClickListener(new View.OnClickListener() { // from class: com.chad.library.adapter.base.BaseQuickAdapter$$ExternalSyntheticLambda0
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
BaseQuickAdapter.bindViewClickListener$lambda$7$lambda$6(BaseViewHolder.this, this, view);
}
});
}
if (this.mOnItemLongClickListener != null) {
viewHolder.itemView.setOnLongClickListener(new View.OnLongClickListener() { // from class: com.chad.library.adapter.base.BaseQuickAdapter$$ExternalSyntheticLambda1
@Override // android.view.View.OnLongClickListener
public final boolean onLongClick(View view) {
boolean bindViewClickListener$lambda$9$lambda$8;
bindViewClickListener$lambda$9$lambda$8 = BaseQuickAdapter.bindViewClickListener$lambda$9$lambda$8(BaseViewHolder.this, this, view);
return bindViewClickListener$lambda$9$lambda$8;
}
});
}
if (this.mOnItemChildClickListener != null) {
Iterator<Integer> it = getChildClickViewIds().iterator();
while (it.hasNext()) {
Integer id = it.next();
View view = viewHolder.itemView;
Intrinsics.checkNotNullExpressionValue(id, "id");
View findViewById = view.findViewById(id.intValue());
if (findViewById != null) {
Intrinsics.checkNotNullExpressionValue(findViewById, "findViewById<View>(id)");
if (!findViewById.isClickable()) {
findViewById.setClickable(true);
}
findViewById.setOnClickListener(new View.OnClickListener() { // from class: com.chad.library.adapter.base.BaseQuickAdapter$$ExternalSyntheticLambda2
@Override // android.view.View.OnClickListener
public final void onClick(View view2) {
BaseQuickAdapter.bindViewClickListener$lambda$12$lambda$11$lambda$10(BaseViewHolder.this, this, view2);
}
});
}
}
}
if (this.mOnItemChildLongClickListener != null) {
Iterator<Integer> it2 = getChildLongClickViewIds().iterator();
while (it2.hasNext()) {
Integer id2 = it2.next();
View view2 = viewHolder.itemView;
Intrinsics.checkNotNullExpressionValue(id2, "id");
View findViewById2 = view2.findViewById(id2.intValue());
if (findViewById2 != null) {
Intrinsics.checkNotNullExpressionValue(findViewById2, "findViewById<View>(id)");
if (!findViewById2.isLongClickable()) {
findViewById2.setLongClickable(true);
}
findViewById2.setOnLongClickListener(new View.OnLongClickListener() { // from class: com.chad.library.adapter.base.BaseQuickAdapter$$ExternalSyntheticLambda3
@Override // android.view.View.OnLongClickListener
public final boolean onLongClick(View view3) {
boolean bindViewClickListener$lambda$15$lambda$14$lambda$13;
bindViewClickListener$lambda$15$lambda$14$lambda$13 = BaseQuickAdapter.bindViewClickListener$lambda$15$lambda$14$lambda$13(BaseViewHolder.this, this, view3);
return bindViewClickListener$lambda$15$lambda$14$lambda$13;
}
});
}
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public static final void bindViewClickListener$lambda$7$lambda$6(BaseViewHolder viewHolder, BaseQuickAdapter this$0, View v) {
Intrinsics.checkNotNullParameter(viewHolder, "$viewHolder");
Intrinsics.checkNotNullParameter(this$0, "this$0");
int bindingAdapterPosition = viewHolder.getBindingAdapterPosition();
if (bindingAdapterPosition == -1) {
return;
}
int headerLayoutCount = bindingAdapterPosition - this$0.getHeaderLayoutCount();
Intrinsics.checkNotNullExpressionValue(v, "v");
this$0.setOnItemClick(v, headerLayoutCount);
}
/* JADX INFO: Access modifiers changed from: private */
public static final boolean bindViewClickListener$lambda$9$lambda$8(BaseViewHolder viewHolder, BaseQuickAdapter this$0, View v) {
Intrinsics.checkNotNullParameter(viewHolder, "$viewHolder");
Intrinsics.checkNotNullParameter(this$0, "this$0");
int bindingAdapterPosition = viewHolder.getBindingAdapterPosition();
if (bindingAdapterPosition == -1) {
return false;
}
int headerLayoutCount = bindingAdapterPosition - this$0.getHeaderLayoutCount();
Intrinsics.checkNotNullExpressionValue(v, "v");
return this$0.setOnItemLongClick(v, headerLayoutCount);
}
/* JADX INFO: Access modifiers changed from: private */
public static final void bindViewClickListener$lambda$12$lambda$11$lambda$10(BaseViewHolder viewHolder, BaseQuickAdapter this$0, View v) {
Intrinsics.checkNotNullParameter(viewHolder, "$viewHolder");
Intrinsics.checkNotNullParameter(this$0, "this$0");
int bindingAdapterPosition = viewHolder.getBindingAdapterPosition();
if (bindingAdapterPosition == -1) {
return;
}
int headerLayoutCount = bindingAdapterPosition - this$0.getHeaderLayoutCount();
Intrinsics.checkNotNullExpressionValue(v, "v");
this$0.setOnItemChildClick(v, headerLayoutCount);
}
/* JADX INFO: Access modifiers changed from: private */
public static final boolean bindViewClickListener$lambda$15$lambda$14$lambda$13(BaseViewHolder viewHolder, BaseQuickAdapter this$0, View v) {
Intrinsics.checkNotNullParameter(viewHolder, "$viewHolder");
Intrinsics.checkNotNullParameter(this$0, "this$0");
int bindingAdapterPosition = viewHolder.getBindingAdapterPosition();
if (bindingAdapterPosition == -1) {
return false;
}
int headerLayoutCount = bindingAdapterPosition - this$0.getHeaderLayoutCount();
Intrinsics.checkNotNullExpressionValue(v, "v");
return this$0.setOnItemChildLongClick(v, headerLayoutCount);
}
protected void setOnItemClick(View v, int position) {
Intrinsics.checkNotNullParameter(v, "v");
OnItemClickListener onItemClickListener = this.mOnItemClickListener;
if (onItemClickListener != null) {
onItemClickListener.onItemClick(this, v, position);
}
}
protected boolean setOnItemLongClick(View v, int position) {
Intrinsics.checkNotNullParameter(v, "v");
OnItemLongClickListener onItemLongClickListener = this.mOnItemLongClickListener;
if (onItemLongClickListener != null) {
return onItemLongClickListener.onItemLongClick(this, v, position);
}
return false;
}
protected void setOnItemChildClick(View v, int position) {
Intrinsics.checkNotNullParameter(v, "v");
OnItemChildClickListener onItemChildClickListener = this.mOnItemChildClickListener;
if (onItemChildClickListener != null) {
onItemChildClickListener.onItemChildClick(this, v, position);
}
}
protected boolean setOnItemChildLongClick(View v, int position) {
Intrinsics.checkNotNullParameter(v, "v");
OnItemChildLongClickListener onItemChildLongClickListener = this.mOnItemChildLongClickListener;
if (onItemChildLongClickListener != null) {
return onItemChildLongClickListener.onItemChildLongClick(this, v, position);
}
return false;
}
protected int getDefItemCount() {
return this.data.size();
}
protected int getDefItemViewType(int position) {
return super.getItemViewType(position);
}
protected VH onCreateDefViewHolder(ViewGroup parent, int viewType) {
Intrinsics.checkNotNullParameter(parent, "parent");
return createBaseViewHolder(parent, this.layoutResId);
}
/* JADX INFO: Access modifiers changed from: protected */
public VH createBaseViewHolder(ViewGroup parent, int layoutResId) {
Intrinsics.checkNotNullParameter(parent, "parent");
return createBaseViewHolder(AdapterUtilsKt.getItemView(parent, layoutResId));
}
protected VH createBaseViewHolder(View view) {
VH createBaseGenericKInstance;
Intrinsics.checkNotNullParameter(view, "view");
Class<?> cls = null;
for (Class<?> cls2 = getClass(); cls == null && cls2 != null; cls2 = cls2.getSuperclass()) {
cls = getInstancedGenericKClass(cls2);
}
if (cls == null) {
createBaseGenericKInstance = (VH) new BaseViewHolder(view);
} else {
createBaseGenericKInstance = createBaseGenericKInstance(cls, view);
}
return createBaseGenericKInstance == null ? (VH) new BaseViewHolder(view) : createBaseGenericKInstance;
}
private final Class<?> getInstancedGenericKClass(Class<?> z) {
try {
Type genericSuperclass = z.getGenericSuperclass();
if (!(genericSuperclass instanceof ParameterizedType)) {
return null;
}
Type[] types = ((ParameterizedType) genericSuperclass).getActualTypeArguments();
Intrinsics.checkNotNullExpressionValue(types, "types");
for (Type type : types) {
if (type instanceof Class) {
if (BaseViewHolder.class.isAssignableFrom((Class) type)) {
return (Class) type;
}
} else if (type instanceof ParameterizedType) {
Type rawType = ((ParameterizedType) type).getRawType();
if ((rawType instanceof Class) && BaseViewHolder.class.isAssignableFrom((Class) rawType)) {
return (Class) rawType;
}
} else {
continue;
}
}
return null;
} catch (TypeNotPresentException e) {
e.printStackTrace();
return null;
} catch (GenericSignatureFormatError e2) {
e2.printStackTrace();
return null;
} catch (MalformedParameterizedTypeException e3) {
e3.printStackTrace();
return null;
}
}
private final VH createBaseGenericKInstance(Class<?> z, View view) {
try {
if (z.isMemberClass() && !Modifier.isStatic(z.getModifiers())) {
Constructor<?> declaredConstructor = z.getDeclaredConstructor(getClass(), View.class);
Intrinsics.checkNotNullExpressionValue(declaredConstructor, "z.getDeclaredConstructor…aClass, View::class.java)");
declaredConstructor.setAccessible(true);
Object newInstance = declaredConstructor.newInstance(this, view);
Intrinsics.checkNotNull(newInstance, "null cannot be cast to non-null type VH of com.chad.library.adapter.base.BaseQuickAdapter");
return (VH) newInstance;
}
Constructor<?> declaredConstructor2 = z.getDeclaredConstructor(View.class);
Intrinsics.checkNotNullExpressionValue(declaredConstructor2, "z.getDeclaredConstructor(View::class.java)");
declaredConstructor2.setAccessible(true);
Object newInstance2 = declaredConstructor2.newInstance(view);
Intrinsics.checkNotNull(newInstance2, "null cannot be cast to non-null type VH of com.chad.library.adapter.base.BaseQuickAdapter");
return (VH) newInstance2;
} catch (IllegalAccessException e) {
e.printStackTrace();
return null;
} catch (InstantiationException e2) {
e2.printStackTrace();
return null;
} catch (NoSuchMethodException e3) {
e3.printStackTrace();
return null;
} catch (InvocationTargetException e4) {
e4.printStackTrace();
return null;
}
}
protected void setFullSpan(RecyclerView.ViewHolder holder) {
Intrinsics.checkNotNullParameter(holder, "holder");
ViewGroup.LayoutParams layoutParams = holder.itemView.getLayoutParams();
if (layoutParams instanceof StaggeredGridLayoutManager.LayoutParams) {
((StaggeredGridLayoutManager.LayoutParams) layoutParams).setFullSpan(true);
}
}
public final View getViewByPosition(int position, int viewId) {
BaseViewHolder baseViewHolder;
RecyclerView recyclerView = this.recyclerViewOrNull;
if (recyclerView == null || (baseViewHolder = (BaseViewHolder) recyclerView.findViewHolderForLayoutPosition(position)) == null) {
return null;
}
return baseViewHolder.getViewOrNull(viewId);
}
public static /* synthetic */ int addHeaderView$default(BaseQuickAdapter baseQuickAdapter, View view, int i, int i2, int i3, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: addHeaderView");
}
if ((i3 & 2) != 0) {
i = -1;
}
if ((i3 & 4) != 0) {
i2 = 1;
}
return baseQuickAdapter.addHeaderView(view, i, i2);
}
public final int addHeaderView(View view, int index, int orientation) {
int headerViewPosition;
RecyclerView.LayoutParams layoutParams;
Intrinsics.checkNotNullParameter(view, "view");
LinearLayout linearLayout = null;
if (this.mHeaderLayout == null) {
LinearLayout linearLayout2 = new LinearLayout(view.getContext());
this.mHeaderLayout = linearLayout2;
linearLayout2.setOrientation(orientation);
LinearLayout linearLayout3 = this.mHeaderLayout;
if (linearLayout3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mHeaderLayout");
linearLayout3 = null;
}
if (orientation == 1) {
layoutParams = new RecyclerView.LayoutParams(-1, -2);
} else {
layoutParams = new RecyclerView.LayoutParams(-2, -1);
}
linearLayout3.setLayoutParams(layoutParams);
}
LinearLayout linearLayout4 = this.mHeaderLayout;
if (linearLayout4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mHeaderLayout");
linearLayout4 = null;
}
int childCount = linearLayout4.getChildCount();
if (index < 0 || index > childCount) {
index = childCount;
}
LinearLayout linearLayout5 = this.mHeaderLayout;
if (linearLayout5 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mHeaderLayout");
linearLayout5 = null;
}
linearLayout5.addView(view, index);
LinearLayout linearLayout6 = this.mHeaderLayout;
if (linearLayout6 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mHeaderLayout");
} else {
linearLayout = linearLayout6;
}
if (linearLayout.getChildCount() == 1 && (headerViewPosition = getHeaderViewPosition()) != -1) {
notifyItemInserted(headerViewPosition);
}
return index;
}
public static /* synthetic */ int setHeaderView$default(BaseQuickAdapter baseQuickAdapter, View view, int i, int i2, int i3, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: setHeaderView");
}
if ((i3 & 2) != 0) {
i = 0;
}
if ((i3 & 4) != 0) {
i2 = 1;
}
return baseQuickAdapter.setHeaderView(view, i, i2);
}
public final int setHeaderView(View view, int index, int orientation) {
Intrinsics.checkNotNullParameter(view, "view");
LinearLayout linearLayout = this.mHeaderLayout;
if (linearLayout != null) {
LinearLayout linearLayout2 = null;
if (linearLayout == null) {
Intrinsics.throwUninitializedPropertyAccessException("mHeaderLayout");
linearLayout = null;
}
if (linearLayout.getChildCount() > index) {
LinearLayout linearLayout3 = this.mHeaderLayout;
if (linearLayout3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mHeaderLayout");
linearLayout3 = null;
}
linearLayout3.removeViewAt(index);
LinearLayout linearLayout4 = this.mHeaderLayout;
if (linearLayout4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mHeaderLayout");
} else {
linearLayout2 = linearLayout4;
}
linearLayout2.addView(view, index);
return index;
}
}
return addHeaderView(view, index, orientation);
}
public final boolean hasHeaderLayout() {
LinearLayout linearLayout = this.mHeaderLayout;
if (linearLayout == null) {
return false;
}
if (linearLayout == null) {
Intrinsics.throwUninitializedPropertyAccessException("mHeaderLayout");
linearLayout = null;
}
return linearLayout.getChildCount() > 0;
}
public final void removeHeaderView(View header) {
int headerViewPosition;
Intrinsics.checkNotNullParameter(header, "header");
if (hasHeaderLayout()) {
LinearLayout linearLayout = this.mHeaderLayout;
LinearLayout linearLayout2 = null;
if (linearLayout == null) {
Intrinsics.throwUninitializedPropertyAccessException("mHeaderLayout");
linearLayout = null;
}
linearLayout.removeView(header);
LinearLayout linearLayout3 = this.mHeaderLayout;
if (linearLayout3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mHeaderLayout");
} else {
linearLayout2 = linearLayout3;
}
if (linearLayout2.getChildCount() != 0 || (headerViewPosition = getHeaderViewPosition()) == -1) {
return;
}
notifyItemRemoved(headerViewPosition);
}
}
public final void removeAllHeaderView() {
if (hasHeaderLayout()) {
LinearLayout linearLayout = this.mHeaderLayout;
if (linearLayout == null) {
Intrinsics.throwUninitializedPropertyAccessException("mHeaderLayout");
linearLayout = null;
}
linearLayout.removeAllViews();
int headerViewPosition = getHeaderViewPosition();
if (headerViewPosition != -1) {
notifyItemRemoved(headerViewPosition);
}
}
}
public final int getHeaderViewPosition() {
return (!hasEmptyView() || this.headerWithEmptyEnable) ? 0 : -1;
}
public final int getHeaderLayoutCount() {
return hasHeaderLayout() ? 1 : 0;
}
public final LinearLayout getHeaderLayout() {
LinearLayout linearLayout = this.mHeaderLayout;
if (linearLayout != null) {
if (linearLayout != null) {
return linearLayout;
}
Intrinsics.throwUninitializedPropertyAccessException("mHeaderLayout");
}
return null;
}
public static /* synthetic */ int addFooterView$default(BaseQuickAdapter baseQuickAdapter, View view, int i, int i2, int i3, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: addFooterView");
}
if ((i3 & 2) != 0) {
i = -1;
}
if ((i3 & 4) != 0) {
i2 = 1;
}
return baseQuickAdapter.addFooterView(view, i, i2);
}
public final int addFooterView(View view, int index, int orientation) {
int footerViewPosition;
RecyclerView.LayoutParams layoutParams;
Intrinsics.checkNotNullParameter(view, "view");
LinearLayout linearLayout = null;
if (this.mFooterLayout == null) {
LinearLayout linearLayout2 = new LinearLayout(view.getContext());
this.mFooterLayout = linearLayout2;
linearLayout2.setOrientation(orientation);
LinearLayout linearLayout3 = this.mFooterLayout;
if (linearLayout3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mFooterLayout");
linearLayout3 = null;
}
if (orientation == 1) {
layoutParams = new RecyclerView.LayoutParams(-1, -2);
} else {
layoutParams = new RecyclerView.LayoutParams(-2, -1);
}
linearLayout3.setLayoutParams(layoutParams);
}
LinearLayout linearLayout4 = this.mFooterLayout;
if (linearLayout4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mFooterLayout");
linearLayout4 = null;
}
int childCount = linearLayout4.getChildCount();
if (index < 0 || index > childCount) {
index = childCount;
}
LinearLayout linearLayout5 = this.mFooterLayout;
if (linearLayout5 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mFooterLayout");
linearLayout5 = null;
}
linearLayout5.addView(view, index);
LinearLayout linearLayout6 = this.mFooterLayout;
if (linearLayout6 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mFooterLayout");
} else {
linearLayout = linearLayout6;
}
if (linearLayout.getChildCount() == 1 && (footerViewPosition = getFooterViewPosition()) != -1) {
notifyItemInserted(footerViewPosition);
}
return index;
}
public static /* synthetic */ int setFooterView$default(BaseQuickAdapter baseQuickAdapter, View view, int i, int i2, int i3, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: setFooterView");
}
if ((i3 & 2) != 0) {
i = 0;
}
if ((i3 & 4) != 0) {
i2 = 1;
}
return baseQuickAdapter.setFooterView(view, i, i2);
}
public final int setFooterView(View view, int index, int orientation) {
Intrinsics.checkNotNullParameter(view, "view");
LinearLayout linearLayout = this.mFooterLayout;
if (linearLayout != null) {
LinearLayout linearLayout2 = null;
if (linearLayout == null) {
Intrinsics.throwUninitializedPropertyAccessException("mFooterLayout");
linearLayout = null;
}
if (linearLayout.getChildCount() > index) {
LinearLayout linearLayout3 = this.mFooterLayout;
if (linearLayout3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mFooterLayout");
linearLayout3 = null;
}
linearLayout3.removeViewAt(index);
LinearLayout linearLayout4 = this.mFooterLayout;
if (linearLayout4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mFooterLayout");
} else {
linearLayout2 = linearLayout4;
}
linearLayout2.addView(view, index);
return index;
}
}
return addFooterView(view, index, orientation);
}
public final void removeFooterView(View footer) {
int footerViewPosition;
Intrinsics.checkNotNullParameter(footer, "footer");
if (hasFooterLayout()) {
LinearLayout linearLayout = this.mFooterLayout;
LinearLayout linearLayout2 = null;
if (linearLayout == null) {
Intrinsics.throwUninitializedPropertyAccessException("mFooterLayout");
linearLayout = null;
}
linearLayout.removeView(footer);
LinearLayout linearLayout3 = this.mFooterLayout;
if (linearLayout3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mFooterLayout");
} else {
linearLayout2 = linearLayout3;
}
if (linearLayout2.getChildCount() != 0 || (footerViewPosition = getFooterViewPosition()) == -1) {
return;
}
notifyItemRemoved(footerViewPosition);
}
}
public final void removeAllFooterView() {
if (hasFooterLayout()) {
LinearLayout linearLayout = this.mFooterLayout;
if (linearLayout == null) {
Intrinsics.throwUninitializedPropertyAccessException("mFooterLayout");
linearLayout = null;
}
linearLayout.removeAllViews();
int footerViewPosition = getFooterViewPosition();
if (footerViewPosition != -1) {
notifyItemRemoved(footerViewPosition);
}
}
}
public final boolean hasFooterLayout() {
LinearLayout linearLayout = this.mFooterLayout;
if (linearLayout == null) {
return false;
}
if (linearLayout == null) {
Intrinsics.throwUninitializedPropertyAccessException("mFooterLayout");
linearLayout = null;
}
return linearLayout.getChildCount() > 0;
}
public final int getFooterViewPosition() {
if (hasEmptyView()) {
int i = (this.headerWithEmptyEnable && hasHeaderLayout()) ? 2 : 1;
if (this.footerWithEmptyEnable) {
return i;
}
return -1;
}
return getHeaderLayoutCount() + this.data.size();
}
public final int getFooterLayoutCount() {
return hasFooterLayout() ? 1 : 0;
}
public final LinearLayout getFooterLayout() {
LinearLayout linearLayout = this.mFooterLayout;
if (linearLayout != null) {
if (linearLayout != null) {
return linearLayout;
}
Intrinsics.throwUninitializedPropertyAccessException("mFooterLayout");
}
return null;
}
public final void setEmptyView(View emptyView) {
boolean z;
ViewGroup.LayoutParams layoutParams;
Intrinsics.checkNotNullParameter(emptyView, "emptyView");
int itemCount = getItemCount();
FrameLayout frameLayout = null;
if (this.mEmptyLayout == null) {
FrameLayout frameLayout2 = new FrameLayout(emptyView.getContext());
this.mEmptyLayout = frameLayout2;
ViewGroup.LayoutParams layoutParams2 = emptyView.getLayoutParams();
if (layoutParams2 != null) {
layoutParams = new ViewGroup.LayoutParams(layoutParams2.width, layoutParams2.height);
} else {
layoutParams = new ViewGroup.LayoutParams(-1, -1);
}
frameLayout2.setLayoutParams(layoutParams);
z = true;
} else {
ViewGroup.LayoutParams layoutParams3 = emptyView.getLayoutParams();
if (layoutParams3 != null) {
FrameLayout frameLayout3 = this.mEmptyLayout;
if (frameLayout3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mEmptyLayout");
frameLayout3 = null;
}
ViewGroup.LayoutParams layoutParams4 = frameLayout3.getLayoutParams();
layoutParams4.width = layoutParams3.width;
layoutParams4.height = layoutParams3.height;
FrameLayout frameLayout4 = this.mEmptyLayout;
if (frameLayout4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mEmptyLayout");
frameLayout4 = null;
}
frameLayout4.setLayoutParams(layoutParams4);
}
z = false;
}
FrameLayout frameLayout5 = this.mEmptyLayout;
if (frameLayout5 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mEmptyLayout");
frameLayout5 = null;
}
frameLayout5.removeAllViews();
FrameLayout frameLayout6 = this.mEmptyLayout;
if (frameLayout6 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mEmptyLayout");
} else {
frameLayout = frameLayout6;
}
frameLayout.addView(emptyView);
this.isUseEmpty = true;
if (z && hasEmptyView()) {
int i = (this.headerWithEmptyEnable && hasHeaderLayout()) ? 1 : 0;
if (getItemCount() > itemCount) {
notifyItemInserted(i);
} else {
notifyDataSetChanged();
}
}
}
public final void setEmptyView(int layoutResId) {
RecyclerView recyclerView = this.recyclerViewOrNull;
if (recyclerView != null) {
View view = LayoutInflater.from(recyclerView.getContext()).inflate(layoutResId, (ViewGroup) recyclerView, false);
Intrinsics.checkNotNullExpressionValue(view, "view");
setEmptyView(view);
}
}
public final void removeEmptyView() {
FrameLayout frameLayout = this.mEmptyLayout;
if (frameLayout != null) {
if (frameLayout == null) {
Intrinsics.throwUninitializedPropertyAccessException("mEmptyLayout");
frameLayout = null;
}
frameLayout.removeAllViews();
}
}
public final boolean hasEmptyView() {
FrameLayout frameLayout = this.mEmptyLayout;
if (frameLayout != null) {
if (frameLayout == null) {
Intrinsics.throwUninitializedPropertyAccessException("mEmptyLayout");
frameLayout = null;
}
if (frameLayout.getChildCount() != 0 && this.isUseEmpty) {
return this.data.isEmpty();
}
return false;
}
return false;
}
public final FrameLayout getEmptyLayout() {
FrameLayout frameLayout = this.mEmptyLayout;
if (frameLayout != null) {
if (frameLayout != null) {
return frameLayout;
}
Intrinsics.throwUninitializedPropertyAccessException("mEmptyLayout");
}
return null;
}
private final void addAnimation(RecyclerView.ViewHolder holder) {
if (this.animationEnable) {
if (!this.isAnimationFirstOnly || holder.getLayoutPosition() > this.mLastPosition) {
AlphaInAnimation alphaInAnimation = this.adapterAnimation;
if (alphaInAnimation == null) {
alphaInAnimation = new AlphaInAnimation(0.0f, 1, null);
}
View view = holder.itemView;
Intrinsics.checkNotNullExpressionValue(view, "holder.itemView");
for (Animator animator : alphaInAnimation.animators(view)) {
startAnim(animator, holder.getLayoutPosition());
}
this.mLastPosition = holder.getLayoutPosition();
}
}
}
protected void startAnim(Animator anim, int index) {
Intrinsics.checkNotNullParameter(anim, "anim");
anim.start();
}
public final void setAnimationWithDefault(AnimationType animationType) {
AlphaInAnimation alphaInAnimation;
Intrinsics.checkNotNullParameter(animationType, "animationType");
int i = WhenMappings.$EnumSwitchMapping$0[animationType.ordinal()];
if (i == 1) {
alphaInAnimation = new AlphaInAnimation(0.0f, 1, null);
} else if (i == 2) {
alphaInAnimation = new ScaleInAnimation(0.0f, 1, null);
} else if (i == 3) {
alphaInAnimation = new SlideInBottomAnimation();
} else if (i == 4) {
alphaInAnimation = new SlideInLeftAnimation();
} else {
if (i != 5) {
throw new NoWhenBranchMatchedException();
}
alphaInAnimation = new SlideInRightAnimation();
}
setAdapterAnimation(alphaInAnimation);
}
@Deprecated(message = "Please use setNewInstance(), This method will be removed in the next version", replaceWith = @ReplaceWith(expression = "setNewInstance(data)", imports = {}))
public void setNewData(List<T> data) {
setNewInstance(data);
}
public void setNewInstance(List<T> list) {
if (list == this.data) {
return;
}
if (list == null) {
list = new ArrayList();
}
this.data = list;
BaseLoadMoreModule baseLoadMoreModule = this.mLoadMoreModule;
if (baseLoadMoreModule != null) {
baseLoadMoreModule.reset$com_github_CymChad_brvah();
}
this.mLastPosition = -1;
notifyDataSetChanged();
BaseLoadMoreModule baseLoadMoreModule2 = this.mLoadMoreModule;
if (baseLoadMoreModule2 != null) {
baseLoadMoreModule2.checkDisableLoadMoreIfNotFullPage();
}
}
@Deprecated(message = "Please use setData()", replaceWith = @ReplaceWith(expression = "setList(newData)", imports = {}))
public void replaceData(Collection<? extends T> newData) {
Intrinsics.checkNotNullParameter(newData, "newData");
setList(newData);
}
public void setList(Collection<? extends T> list) {
List<T> list2 = this.data;
if (list != list2) {
list2.clear();
if (list != null && !list.isEmpty()) {
this.data.addAll(list);
}
} else if (list != null && !list.isEmpty()) {
ArrayList arrayList = new ArrayList(list);
this.data.clear();
this.data.addAll(arrayList);
} else {
this.data.clear();
}
BaseLoadMoreModule baseLoadMoreModule = this.mLoadMoreModule;
if (baseLoadMoreModule != null) {
baseLoadMoreModule.reset$com_github_CymChad_brvah();
}
this.mLastPosition = -1;
notifyDataSetChanged();
BaseLoadMoreModule baseLoadMoreModule2 = this.mLoadMoreModule;
if (baseLoadMoreModule2 != null) {
baseLoadMoreModule2.checkDisableLoadMoreIfNotFullPage();
}
}
public void setData(int index, T data) {
if (index >= this.data.size()) {
return;
}
this.data.set(index, data);
notifyItemChanged(index + getHeaderLayoutCount());
}
public void addData(int position, T data) {
this.data.add(position, data);
notifyItemInserted(position + getHeaderLayoutCount());
compatibilityDataSizeChanged(1);
}
public void addData(T data) {
this.data.add(data);
notifyItemInserted(this.data.size() + getHeaderLayoutCount());
compatibilityDataSizeChanged(1);
}
public void addData(int position, Collection<? extends T> newData) {
Intrinsics.checkNotNullParameter(newData, "newData");
this.data.addAll(position, newData);
notifyItemRangeInserted(position + getHeaderLayoutCount(), newData.size());
compatibilityDataSizeChanged(newData.size());
}
public void addData(Collection<? extends T> newData) {
Intrinsics.checkNotNullParameter(newData, "newData");
this.data.addAll(newData);
notifyItemRangeInserted((this.data.size() - newData.size()) + getHeaderLayoutCount(), newData.size());
compatibilityDataSizeChanged(newData.size());
}
@Deprecated(message = "Please use removeAt()", replaceWith = @ReplaceWith(expression = "removeAt(position)", imports = {}))
public void remove(int position) {
removeAt(position);
}
public void removeAt(int position) {
if (position >= this.data.size()) {
return;
}
this.data.remove(position);
int headerLayoutCount = position + getHeaderLayoutCount();
notifyItemRemoved(headerLayoutCount);
compatibilityDataSizeChanged(0);
notifyItemRangeChanged(headerLayoutCount, this.data.size() - headerLayoutCount);
}
public void remove(T data) {
int indexOf = this.data.indexOf(data);
if (indexOf == -1) {
return;
}
removeAt(indexOf);
}
/* JADX INFO: Access modifiers changed from: protected */
public final void compatibilityDataSizeChanged(int size) {
if (this.data.size() == size) {
notifyDataSetChanged();
}
}
public final void setDiffCallback(DiffUtil.ItemCallback<T> diffCallback) {
Intrinsics.checkNotNullParameter(diffCallback, "diffCallback");
setDiffConfig(new BrvahAsyncDifferConfig.Builder(diffCallback).build());
}
public final void setDiffConfig(BrvahAsyncDifferConfig<T> config) {
Intrinsics.checkNotNullParameter(config, "config");
this.mDiffHelper = new BrvahAsyncDiffer<>(this, config);
}
@Deprecated(message = "User getDiffer()", replaceWith = @ReplaceWith(expression = "getDiffer()", imports = {}))
public final BrvahAsyncDiffer<T> getDiffHelper() {
return getDiffer();
}
public final BrvahAsyncDiffer<T> getDiffer() {
BrvahAsyncDiffer<T> brvahAsyncDiffer = this.mDiffHelper;
if (brvahAsyncDiffer == null) {
throw new IllegalStateException("Please use setDiffCallback() or setDiffConfig() first!".toString());
}
Intrinsics.checkNotNull(brvahAsyncDiffer);
return brvahAsyncDiffer;
}
public static /* synthetic */ void setDiffNewData$default(BaseQuickAdapter baseQuickAdapter, List list, Runnable runnable, int i, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: setDiffNewData");
}
if ((i & 2) != 0) {
runnable = null;
}
baseQuickAdapter.setDiffNewData(list, runnable);
}
public void setDiffNewData(List<T> list, Runnable commitCallback) {
if (hasEmptyView()) {
setNewInstance(list);
if (commitCallback != null) {
commitCallback.run();
return;
}
return;
}
BrvahAsyncDiffer<T> brvahAsyncDiffer = this.mDiffHelper;
if (brvahAsyncDiffer != null) {
brvahAsyncDiffer.submitList(list, commitCallback);
}
}
public void setDiffNewData(DiffUtil.DiffResult diffResult, List<T> list) {
Intrinsics.checkNotNullParameter(diffResult, "diffResult");
Intrinsics.checkNotNullParameter(list, "list");
if (hasEmptyView()) {
setNewInstance(list);
} else {
diffResult.dispatchUpdatesTo(new BrvahListUpdateCallback(this));
this.data = list;
}
}
}