package B;

import F1.AbstractC0195y;
import I0.AbstractC0303l;
import android.view.View;
import java.lang.reflect.Field;
import java.util.WeakHashMap;

/* JADX INFO: loaded from: classes.dex */
public final class X0 extends C0074m0 {

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public J4.c f223d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public g1 f224e;

    @Override // B.AbstractC0066i0, i0.AbstractC2254r
    public final void onAttach() {
        View viewV = AbstractC0303l.v(this);
        WeakHashMap weakHashMap = g1.f282w;
        g1 g1VarF = C0055d.f(viewV);
        g1VarF.a(viewV);
        e1 e1Var = (e1) this.f223d.invoke(g1VarF);
        if (!kotlin.jvm.internal.o.c(e1Var, this.f343c)) {
            this.f343c = e1Var;
            u0();
        }
        this.f224e = g1VarF;
        super.onAttach();
    }

    @Override // B.AbstractC0066i0, i0.AbstractC2254r
    public final void onDetach() {
        View viewV = AbstractC0303l.v(this);
        g1 g1Var = this.f224e;
        if (g1Var != null) {
            int i6 = g1Var.f302u - 1;
            g1Var.f302u = i6;
            if (i6 == 0) {
                Field field = F1.F.f1367a;
                AbstractC0195y.c(viewV, null);
                F1.F.e(viewV, null);
                viewV.removeOnAttachStateChangeListener(g1Var.f303v);
            }
        }
        super.onDetach();
    }
}
