package androidx.leanback.widget;

import android.graphics.drawable.Drawable;
import defpackage.ch7;
import defpackage.h68;
import defpackage.xs;
import java.lang.ref.WeakReference;
import java.util.ArrayList;

/* JADX INFO: loaded from: classes.dex */
public class v extends h68 {
    public final Object b;
    public Drawable c;
    public ArrayList d;
    public final ch7 e;
    public xs f;

    public static class a {
        public void a(v vVar) {
        }

        public void b() {
        }
    }

    public v(Object obj) {
        super(null);
        k kVar = new k();
        this.e = kVar;
        this.f = new xs(kVar);
        this.b = obj;
        if (obj == null) {
            throw new IllegalArgumentException("Object cannot be null");
        }
    }

    public final void b(a aVar) {
        if (this.d != null) {
            int i = 0;
            while (i < this.d.size()) {
                a aVar2 = (a) ((WeakReference) this.d.get(i)).get();
                if (aVar2 == null) {
                    this.d.remove(i);
                } else {
                    if (aVar2 == aVar) {
                        this.d.remove(i);
                        return;
                    }
                    i++;
                }
            }
        }
    }

    public final void c(Drawable drawable) {
        if (this.c != drawable) {
            this.c = drawable;
            if (this.d != null) {
                int i = 0;
                while (i < this.d.size()) {
                    a aVar = (a) ((WeakReference) this.d.get(i)).get();
                    if (aVar == null) {
                        this.d.remove(i);
                    } else {
                        aVar.b();
                        i++;
                    }
                }
            }
        }
    }
}
