package v8;

import android.os.AsyncTask;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import androidx.databinding.n;
import androidx.recyclerview.widget.f;
import androidx.recyclerview.widget.l;
import java.util.List;

/* loaded from: classes.dex */
public abstract class c extends BaseAdapter {

    /* renamed from: p, reason: collision with root package name */
    protected List f39272p;

    /* renamed from: q, reason: collision with root package name */
    private int f39273q = 0;

    /* loaded from: classes.dex */
    class a extends AsyncTask {

        /* renamed from: a, reason: collision with root package name */
        final /* synthetic */ List f39274a;

        /* renamed from: b, reason: collision with root package name */
        final /* synthetic */ List f39275b;

        /* renamed from: c, reason: collision with root package name */
        final /* synthetic */ int f39276c;

        /* JADX INFO: Access modifiers changed from: package-private */
        /* renamed from: v8.c$a$a, reason: collision with other inner class name */
        /* loaded from: classes.dex */
        public class C0932a extends f.b {
            C0932a() {
            }

            @Override // androidx.recyclerview.widget.f.b
            public boolean a(int i10, int i11) {
                return c.this.b(a.this.f39274a.get(i10), a.this.f39275b.get(i11));
            }

            @Override // androidx.recyclerview.widget.f.b
            public boolean b(int i10, int i11) {
                return c.this.c(a.this.f39274a.get(i10), a.this.f39275b.get(i11));
            }

            @Override // androidx.recyclerview.widget.f.b
            public int d() {
                return a.this.f39275b.size();
            }

            @Override // androidx.recyclerview.widget.f.b
            public int e() {
                return a.this.f39274a.size();
            }
        }

        /* JADX INFO: Access modifiers changed from: package-private */
        /* loaded from: classes.dex */
        public class b implements l {
            b() {
            }

            @Override // androidx.recyclerview.widget.l
            public void a(int i10, int i11) {
                c.this.notifyDataSetChanged();
            }

            @Override // androidx.recyclerview.widget.l
            public void b(int i10, int i11) {
                c.this.notifyDataSetChanged();
            }

            @Override // androidx.recyclerview.widget.l
            public void c(int i10, int i11) {
                c.this.notifyDataSetChanged();
            }

            @Override // androidx.recyclerview.widget.l
            public void d(int i10, int i11, Object obj) {
                c.this.notifyDataSetChanged();
            }
        }

        a(List list, List list2, int i10) {
            this.f39274a = list;
            this.f39275b = list2;
            this.f39276c = i10;
        }

        /* JADX INFO: Access modifiers changed from: protected */
        @Override // android.os.AsyncTask
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public f.e doInBackground(Void... voidArr) {
            return f.b(new C0932a());
        }

        /* JADX INFO: Access modifiers changed from: protected */
        @Override // android.os.AsyncTask
        /* renamed from: b, reason: merged with bridge method [inline-methods] */
        public void onPostExecute(f.e eVar) {
            if (this.f39276c != c.this.f39273q) {
                return;
            }
            c.this.f39272p = this.f39275b;
            eVar.b(new b());
        }
    }

    protected abstract boolean b(Object obj, Object obj2);

    protected abstract boolean c(Object obj, Object obj2);

    protected abstract void d(int i10, n nVar, Object obj);

    protected abstract n e(int i10, View view, ViewGroup viewGroup);

    public void f(List list) {
        int i10 = this.f39273q + 1;
        this.f39273q = i10;
        List list2 = this.f39272p;
        if (list2 == null) {
            if (list == null) {
                return;
            }
            this.f39272p = list;
            notifyDataSetChanged();
            return;
        }
        if (list != null) {
            new a(list2, list, i10).execute(new Void[0]);
            return;
        }
        list2.size();
        this.f39272p = null;
        notifyDataSetChanged();
    }

    @Override // android.widget.Adapter
    public int getCount() {
        List list = this.f39272p;
        if (list == null) {
            return 0;
        }
        return list.size();
    }

    @Override // android.widget.Adapter
    public Object getItem(int i10) {
        try {
            return this.f39272p.get(i10);
        } catch (Exception unused) {
            return null;
        }
    }

    @Override // android.widget.Adapter
    public long getItemId(int i10) {
        return i10;
    }

    @Override // android.widget.Adapter
    public View getView(int i10, View view, ViewGroup viewGroup) {
        n e10 = e(i10, view, viewGroup);
        d(i10, e10, getItem(i10));
        e10.q();
        return e10.x();
    }
}
