package ඓ.ᨨ.K.ඓ.㸾.ʬ;

import android.database.Cursor;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerView.AbstractC0269;

/* renamed from: ඓ.ᨨ.K.ඓ.㸾.ʬ.㸾  reason: contains not printable characters */
/* compiled from: RecyclerViewCursorAdapter */
public abstract class AbstractC0792<VH extends RecyclerView.AbstractC0269> extends RecyclerView.AbstractC0246<VH> {

    /* renamed from: ῲ  reason: contains not printable characters */
    public int f3985;

    /* renamed from: K  reason: contains not printable characters */
    public Cursor f3986;

    public AbstractC0792(Cursor cursor) {
        setHasStableIds(true);
        m2375(cursor);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0246
    public int getItemCount() {
        if (m2378(this.f3986)) {
            return this.f3986.getCount();
        }
        return 0;
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0246
    public long getItemId(int i) {
        if (!m2378(this.f3986)) {
            throw new IllegalStateException("Cannot lookup item id when cursor is in invalid state.");
        } else if (this.f3986.moveToPosition(i)) {
            return this.f3986.getLong(this.f3985);
        } else {
            throw new IllegalStateException("Could not move cursor to position " + i + " when trying to get an item id");
        }
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0246
    public int getItemViewType(int i) {
        if (this.f3986.moveToPosition(i)) {
            return m2376(i, this.f3986);
        }
        throw new IllegalStateException("Could not move cursor to position " + i + " when trying to get item view type.");
    }

    @Override // androidx.recyclerview.widget.RecyclerView.AbstractC0246
    public void onBindViewHolder(VH vh, int i) {
        if (!m2378(this.f3986)) {
            throw new IllegalStateException("Cannot bind view holder when cursor is in invalid state.");
        } else if (this.f3986.moveToPosition(i)) {
            m2377(vh, this.f3986);
        } else {
            throw new IllegalStateException("Could not move cursor to position " + i + " when trying to bind view holder");
        }
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public void m2375(Cursor cursor) {
        if (cursor != this.f3986) {
            if (cursor != null) {
                this.f3986 = cursor;
                this.f3985 = this.f3986.getColumnIndexOrThrow("_id");
                notifyDataSetChanged();
                return;
            }
            notifyItemRangeRemoved(0, getItemCount());
            this.f3986 = null;
            this.f3985 = -1;
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public abstract int m2376(int i, Cursor cursor);

    /* renamed from: K  reason: contains not printable characters */
    public abstract void m2377(VH vh, Cursor cursor);

    /* renamed from: K  reason: contains not printable characters */
    public final boolean m2378(Cursor cursor) {
        return cursor != null && !cursor.isClosed();
    }
}
