package J0;

import android.content.Context;
import android.view.View;
import android.view.ViewParent;
import com.debridstream.tv.R;
import java.util.Iterator;
import p0.C2699e;

/* JADX INFO: loaded from: classes.dex */
public final class h1 implements View.OnAttachStateChangeListener {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f3024a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ Object f3025b;

    public /* synthetic */ h1(Object obj, int i6) {
        this.f3024a = i6;
        this.f3025b = obj;
    }

    @Override // android.view.View.OnAttachStateChangeListener
    public final void onViewAttachedToWindow(View view) {
        switch (this.f3024a) {
            case 0:
            case 1:
                break;
            default:
                Context context = view.getContext();
                C2699e c2699e = (C2699e) this.f3025b;
                if (!c2699e.f22915d) {
                    context.getApplicationContext().registerComponentCallbacks(c2699e.f22916e);
                    c2699e.f22915d = true;
                }
                break;
        }
    }

    @Override // android.view.View.OnAttachStateChangeListener
    public final void onViewDetachedFromWindow(View view) {
        boolean z6;
        switch (this.f3024a) {
            case 0:
                AbstractC0342a abstractC0342a = (AbstractC0342a) this.f3025b;
                kotlin.jvm.internal.o.h(abstractC0342a, "<this>");
                Iterator it = R4.n.a0(F1.K.f1377a, abstractC0342a.getParent()).iterator();
                while (true) {
                    if (it.hasNext()) {
                        Object obj = (ViewParent) it.next();
                        if (obj instanceof View) {
                            View view2 = (View) obj;
                            kotlin.jvm.internal.o.h(view2, "<this>");
                            Object tag = view2.getTag(R.id.is_pooling_container_tag);
                            Boolean bool = tag instanceof Boolean ? (Boolean) tag : null;
                            if (bool != null ? bool.booleanValue() : false) {
                                z6 = true;
                            }
                        }
                    }
                }
                if (!z6) {
                    abstractC0342a.disposeComposition();
                }
                break;
            case 1:
                view.removeOnAttachStateChangeListener(this);
                ((V4.B0) this.f3025b).cancel(null);
                break;
            default:
                Context context = view.getContext();
                C2699e c2699e = (C2699e) this.f3025b;
                if (c2699e.f22915d) {
                    context.getApplicationContext().unregisterComponentCallbacks(c2699e.f22916e);
                    c2699e.f22915d = false;
                }
                break;
        }
    }

    private final void a(View view) {
    }

    private final void b(View view) {
    }
}
