package N1;

import android.util.Log;
import android.view.View;
import androidx.recyclerview.widget.RecyclerView;
import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/* JADX INFO: loaded from: classes.dex */
public abstract class t0 {

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public static final List f4653t = Collections.EMPTY_LIST;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final View f4654a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public WeakReference f4655b;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public int f4662j;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public RecyclerView f4670r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public T f4671s;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public int f4656c = -1;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public int f4657d = -1;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public long f4658e = -1;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public int f4659f = -1;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public int f4660g = -1;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public t0 f4661h = null;
    public t0 i = null;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public ArrayList f4663k = null;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public List f4664l = null;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public int f4665m = 0;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public i0 f4666n = null;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public boolean f4667o = false;

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public int f4668p = 0;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public int f4669q = -1;

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

    public final void b(int i) {
        this.f4662j = i | this.f4662j;
    }

    public final int c() {
        RecyclerView recyclerView = this.f4670r;
        if (recyclerView == null) {
            return -1;
        }
        return recyclerView.K(this);
    }

    public final int d() {
        int i = this.f4660g;
        return i == -1 ? this.f4656c : i;
    }

    public final List e() {
        ArrayList arrayList;
        return ((this.f4662j & 1024) != 0 || (arrayList = this.f4663k) == null || arrayList.size() == 0) ? f4653t : this.f4664l;
    }

    public final boolean f() {
        View view = this.f4654a;
        return (view.getParent() == null || view.getParent() == this.f4670r) ? false : true;
    }

    public final boolean g() {
        return (this.f4662j & 1) != 0;
    }

    public final boolean h() {
        return (this.f4662j & 4) != 0;
    }

    public final boolean i() {
        if ((this.f4662j & 16) != 0) {
            return false;
        }
        Field field = M.J.f4065a;
        return !this.f4654a.hasTransientState();
    }

    public final boolean j() {
        return (this.f4662j & 8) != 0;
    }

    public final boolean k() {
        return this.f4666n != null;
    }

    public final boolean l() {
        return (this.f4662j & 256) != 0;
    }

    public final boolean m() {
        return (this.f4662j & 2) != 0;
    }

    public final void n(int i, boolean z8) {
        if (this.f4657d == -1) {
            this.f4657d = this.f4656c;
        }
        if (this.f4660g == -1) {
            this.f4660g = this.f4656c;
        }
        if (z8) {
            this.f4660g += i;
        }
        this.f4656c += i;
        View view = this.f4654a;
        if (view.getLayoutParams() != null) {
            ((C0203d0) view.getLayoutParams()).f4522s = true;
        }
    }

    public final void o() {
        if (RecyclerView.f9008U0 && l()) {
            throw new IllegalStateException("Attempting to reset temp-detached ViewHolder: " + this + ". ViewHolders should be fully detached before resetting.");
        }
        this.f4662j = 0;
        this.f4656c = -1;
        this.f4657d = -1;
        this.f4658e = -1L;
        this.f4660g = -1;
        this.f4665m = 0;
        this.f4661h = null;
        this.i = null;
        ArrayList arrayList = this.f4663k;
        if (arrayList != null) {
            arrayList.clear();
        }
        this.f4662j &= -1025;
        this.f4668p = 0;
        this.f4669q = -1;
        RecyclerView.k(this);
    }

    public final void p(boolean z8) {
        int i = this.f4665m;
        int i5 = z8 ? i - 1 : i + 1;
        this.f4665m = i5;
        if (i5 < 0) {
            this.f4665m = 0;
            if (RecyclerView.f9008U0) {
                throw new RuntimeException("isRecyclable decremented below 0: unmatched pair of setIsRecyable() calls for " + this);
            }
            Log.e("View", "isRecyclable decremented below 0: unmatched pair of setIsRecyable() calls for " + this);
        } else if (!z8 && i5 == 1) {
            this.f4662j |= 16;
        } else if (z8 && i5 == 0) {
            this.f4662j &= -17;
        }
        if (RecyclerView.f9009V0) {
            Log.d("RecyclerView", "setIsRecyclable val:" + z8 + ":" + this);
        }
    }

    public final boolean q() {
        return (this.f4662j & 128) != 0;
    }

    public final boolean r() {
        return (this.f4662j & 32) != 0;
    }

    public final String toString() {
        StringBuilder sb = new StringBuilder((getClass().isAnonymousClass() ? "ViewHolder" : getClass().getSimpleName()) + "{" + Integer.toHexString(hashCode()) + " position=" + this.f4656c + " id=" + this.f4658e + ", oldPos=" + this.f4657d + ", pLpos:" + this.f4660g);
        if (k()) {
            sb.append(" scrap ");
            sb.append(this.f4667o ? "[changeScrap]" : "[attachedScrap]");
        }
        if (h()) {
            sb.append(" invalid");
        }
        if (!g()) {
            sb.append(" unbound");
        }
        if ((this.f4662j & 2) != 0) {
            sb.append(" update");
        }
        if (j()) {
            sb.append(" removed");
        }
        if (q()) {
            sb.append(" ignored");
        }
        if (l()) {
            sb.append(" tmpDetached");
        }
        if (!i()) {
            sb.append(" not recyclable(" + this.f4665m + ")");
        }
        if ((this.f4662j & 512) != 0 || h()) {
            sb.append(" undefined adapter position");
        }
        if (this.f4654a.getParent() == null) {
            sb.append(" no parent");
        }
        sb.append("}");
        return sb.toString();
    }
}
