package v7;

import android.view.LayoutInflater;
import android.view.ViewGroup;
import androidx.databinding.f;
import androidx.databinding.n;
import androidx.lifecycle.f1;
import androidx.lifecycle.n;
import androidx.lifecycle.r;
import androidx.lifecycle.u;
import androidx.lifecycle.w;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import kotlin.jvm.internal.t;

/* loaded from: classes.dex */
public class a extends RecyclerView.h {

    /* renamed from: d, reason: collision with root package name */
    private final List f39253d = new ArrayList();

    /* renamed from: e, reason: collision with root package name */
    private List f39254e;

    /* renamed from: f, reason: collision with root package name */
    private final b f39255f;

    /* renamed from: v7.a$a, reason: collision with other inner class name */
    /* loaded from: classes.dex */
    public static final class C0929a extends RecyclerView.e0 implements u {
        private final n J;
        private final w K;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C0929a(n binding) {
            super(binding.x());
            t.g(binding, "binding");
            this.J = binding;
            w wVar = new w(this);
            this.K = wVar;
            binding.O(this);
            wVar.n(n.b.CREATED);
        }

        public final void O(Object obj) {
            t.g(obj, "obj");
            this.J.Q(h7.a.f20950g, obj);
            this.J.q();
        }

        public final void P() {
            this.K.n(n.b.DESTROYED);
        }

        public final void Q(boolean z10) {
            this.K.n(z10 ? n.b.STARTED : n.b.CREATED);
        }

        @Override // androidx.lifecycle.u
        public androidx.lifecycle.n getLifecycle() {
            return this.K;
        }
    }

    /* loaded from: classes.dex */
    public static final class b implements r {
        b() {
        }

        @Override // androidx.lifecycle.r
        public void f(u source, n.a event) {
            t.g(source, "source");
            t.g(event, "event");
            if (event == n.a.ON_DESTROY) {
                List list = a.this.f39253d;
                Iterator it = list.iterator();
                while (it.hasNext()) {
                    ((C0929a) it.next()).P();
                }
                list.clear();
                source.getLifecycle().d(this);
            }
        }
    }

    public a() {
        List k10;
        k10 = sm.u.k();
        this.f39254e = k10;
        this.f39255f = new b();
    }

    /* JADX INFO: Access modifiers changed from: protected */
    public final List G() {
        return this.f39254e;
    }

    @Override // androidx.recyclerview.widget.RecyclerView.h
    /* renamed from: H, reason: merged with bridge method [inline-methods] */
    public void u(C0929a holder, int i10) {
        t.g(holder, "holder");
        holder.O(this.f39254e.get(i10));
    }

    @Override // androidx.recyclerview.widget.RecyclerView.h
    /* renamed from: I, reason: merged with bridge method [inline-methods] */
    public C0929a w(ViewGroup parent, int i10) {
        t.g(parent, "parent");
        androidx.databinding.n h10 = f.h(LayoutInflater.from(parent.getContext()), i10, parent, false);
        t.d(h10);
        C0929a c0929a = new C0929a(h10);
        this.f39253d.add(c0929a);
        return c0929a;
    }

    @Override // androidx.recyclerview.widget.RecyclerView.h
    /* renamed from: J, reason: merged with bridge method [inline-methods] */
    public void z(C0929a holder) {
        t.g(holder, "holder");
        holder.Q(true);
        super.z(holder);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.h
    /* renamed from: K, reason: merged with bridge method [inline-methods] */
    public void A(C0929a holder) {
        t.g(holder, "holder");
        holder.Q(false);
        super.A(holder);
    }

    /* JADX INFO: Access modifiers changed from: protected */
    public final void L(List list) {
        t.g(list, "<set-?>");
        this.f39254e = list;
    }

    public void M(List newItems) {
        t.g(newItems, "newItems");
        this.f39254e = newItems;
        l();
    }

    @Override // androidx.recyclerview.widget.RecyclerView.h
    public int g() {
        return this.f39254e.size();
    }

    @Override // androidx.recyclerview.widget.RecyclerView.h
    public int i(int i10) {
        return ((d) this.f39254e.get(i10)).q();
    }

    @Override // androidx.recyclerview.widget.RecyclerView.h
    public void t(RecyclerView recyclerView) {
        androidx.lifecycle.n lifecycle;
        t.g(recyclerView, "recyclerView");
        super.t(recyclerView);
        u a10 = f1.a(recyclerView);
        if (a10 == null || (lifecycle = a10.getLifecycle()) == null) {
            return;
        }
        lifecycle.a(this.f39255f);
    }
}
