package u0;

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 V {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public boolean f10131o = false;
    public int p = 0;
    public int q = -1;

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

    public final void a(int i) {
        this.f10126j = i | this.f10126j;
    }

    public final int b() {
        int i = this.f10124g;
        return i == -1 ? this.f10120c : i;
    }

    public final List c() {
        ArrayList arrayList;
        return ((this.f10126j & 1024) != 0 || (arrayList = this.f10127k) == null || arrayList.size() == 0) ? f10117s : this.f10128l;
    }

    public final boolean d() {
        View view = this.f10118a;
        return (view.getParent() == null || view.getParent() == this.f10132r) ? false : true;
    }

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

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

    public final boolean g() {
        if ((this.f10126j & 16) != 0) {
            return false;
        }
        Field field = P.Q.f2392a;
        return !this.f10118a.hasTransientState();
    }

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

    public final boolean i() {
        return this.f10130n != null;
    }

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

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

    public final void l(int i, boolean z5) {
        if (this.f10121d == -1) {
            this.f10121d = this.f10120c;
        }
        if (this.f10124g == -1) {
            this.f10124g = this.f10120c;
        }
        if (z5) {
            this.f10124g += i;
        }
        this.f10120c += i;
        View view = this.f10118a;
        if (view.getLayoutParams() != null) {
            ((C1036H) view.getLayoutParams()).f10075c = true;
        }
    }

    public final void m() {
        this.f10126j = 0;
        this.f10120c = -1;
        this.f10121d = -1;
        this.f10122e = -1L;
        this.f10124g = -1;
        this.f10129m = 0;
        this.f10125h = null;
        this.i = null;
        ArrayList arrayList = this.f10127k;
        if (arrayList != null) {
            arrayList.clear();
        }
        this.f10126j &= -1025;
        this.p = 0;
        this.q = -1;
        RecyclerView.i(this);
    }

    public final void n(boolean z5) {
        int i = this.f10129m;
        int i5 = z5 ? i - 1 : i + 1;
        this.f10129m = i5;
        if (i5 < 0) {
            this.f10129m = 0;
            Log.e("View", "isRecyclable decremented below 0: unmatched pair of setIsRecyable() calls for " + this);
            return;
        }
        if (!z5 && i5 == 1) {
            this.f10126j |= 16;
        } else if (z5 && i5 == 0) {
            this.f10126j &= -17;
        }
    }

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

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

    public final String toString() {
        StringBuilder sb = new StringBuilder((getClass().isAnonymousClass() ? "ViewHolder" : getClass().getSimpleName()) + "{" + Integer.toHexString(hashCode()) + " position=" + this.f10120c + " id=" + this.f10122e + ", oldPos=" + this.f10121d + ", pLpos:" + this.f10124g);
        if (i()) {
            sb.append(" scrap ");
            sb.append(this.f10131o ? "[changeScrap]" : "[attachedScrap]");
        }
        if (f()) {
            sb.append(" invalid");
        }
        if (!e()) {
            sb.append(" unbound");
        }
        if ((this.f10126j & 2) != 0) {
            sb.append(" update");
        }
        if (h()) {
            sb.append(" removed");
        }
        if (o()) {
            sb.append(" ignored");
        }
        if (j()) {
            sb.append(" tmpDetached");
        }
        if (!g()) {
            sb.append(" not recyclable(" + this.f10129m + ")");
        }
        if ((this.f10126j & 512) != 0 || f()) {
            sb.append(" undefined adapter position");
        }
        if (this.f10118a.getParent() == null) {
            sb.append(" no parent");
        }
        sb.append("}");
        return sb.toString();
    }
}
