package androidx.leanback.widget;

import O1.C0225a;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import com.martsnew.tv.R;
import l0.C1119a;

/* JADX INFO: renamed from: androidx.leanback.widget.i0, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public abstract class AbstractC0470i0 extends Y {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public C0464f0 f8663a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public boolean f8664b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final int f8665c;

    public AbstractC0470i0() {
        C0464f0 c0464f0 = new C0464f0(R.layout.lb_row_header, true);
        this.f8663a = c0464f0;
        this.f8664b = true;
        this.f8665c = 1;
        c0464f0.f8642c = true;
    }

    public static C0468h0 k(X x8) {
        return x8 instanceof C0466g0 ? ((C0466g0) x8).f8644b : (C0468h0) x8;
    }

    @Override // androidx.leanback.widget.Y
    public final void c(X x8, Object obj) {
        m(k(x8), obj);
    }

    @Override // androidx.leanback.widget.Y
    public final X d(ViewGroup viewGroup) {
        X c0466g0;
        C0468h0 c0468h0H = h(viewGroup);
        c0468h0H.i = false;
        if (this.f8663a != null || (!(this instanceof y5.l) && this.f8664b)) {
            Context context = viewGroup.getContext();
            C0460d0 c0460d0 = new C0460d0(context, null, 0);
            c0460d0.f8636s = true;
            c0460d0.setOrientation(1);
            LayoutInflater.from(context).inflate(R.layout.lb_row_container, c0460d0);
            c0460d0.f8634q = (ViewGroup) c0460d0.findViewById(R.id.lb_row_container_header_dock);
            c0460d0.setLayoutParams(new LinearLayout.LayoutParams(-2, -2));
            C0464f0 c0464f0 = this.f8663a;
            if (c0464f0 != null) {
                c0468h0H.f8646c = (C0462e0) c0464f0.d((ViewGroup) c0468h0H.f8620a);
            }
            c0466g0 = new C0466g0(c0460d0, c0468h0H);
        } else {
            c0466g0 = c0468h0H;
        }
        l(c0468h0H);
        if (c0468h0H.i) {
            return c0466g0;
        }
        throw new RuntimeException("super.initializeRowViewHolder() must be called");
    }

    @Override // androidx.leanback.widget.Y
    public final void e(X x8) {
        r(k(x8));
    }

    @Override // androidx.leanback.widget.Y
    public final void f(X x8) {
        n(k(x8));
    }

    @Override // androidx.leanback.widget.Y
    public final void g(X x8) {
        C0468h0 c0468h0K = k(x8);
        C0462e0 c0462e0 = c0468h0K.f8646c;
        if (c0462e0 != null) {
            this.f8663a.getClass();
            Y.b(c0462e0.f8620a);
        }
        Y.b(c0468h0K.f8620a);
    }

    public abstract C0468h0 h(ViewGroup viewGroup);

    public void i(C0468h0 c0468h0, boolean z8) {
        C0225a c0225a;
        if (!z8 || (c0225a = c0468h0.f8654l) == null) {
            return;
        }
        c0225a.e(null, null, c0468h0, c0468h0.f8648e);
    }

    public void j(C0468h0 c0468h0, boolean z8) {
    }

    public void l(C0468h0 c0468h0) {
        c0468h0.i = true;
        View view = c0468h0.f8620a;
        if (view instanceof ViewGroup) {
            ((ViewGroup) view).setClipChildren(false);
        }
        C0466g0 c0466g0 = c0468h0.f8645b;
        if (c0466g0 != null) {
            ((ViewGroup) c0466g0.f8620a).setClipChildren(false);
        }
    }

    public void m(C0468h0 c0468h0, Object obj) {
        c0468h0.f8648e = obj;
        AbstractC0458c0 abstractC0458c0 = obj instanceof AbstractC0458c0 ? (AbstractC0458c0) obj : null;
        c0468h0.f8647d = abstractC0458c0;
        C0462e0 c0462e0 = c0468h0.f8646c;
        if (c0462e0 == null || abstractC0458c0 == null) {
            return;
        }
        this.f8663a.c(c0462e0, obj);
    }

    public void n(C0468h0 c0468h0) {
        if (c0468h0.f8646c != null) {
            this.f8663a.getClass();
        }
    }

    public void o(C0468h0 c0468h0, boolean z8) {
        u(c0468h0);
        t(c0468h0, c0468h0.f8620a);
    }

    public void p(C0468h0 c0468h0, boolean z8) {
        i(c0468h0, z8);
        u(c0468h0);
        t(c0468h0, c0468h0.f8620a);
    }

    public void q(C0468h0 c0468h0) {
        if (this.f8664b) {
            float f3 = c0468h0.f8652j;
            C1119a c1119a = c0468h0.f8653k;
            c1119a.a(f3);
            C0462e0 c0462e0 = c0468h0.f8646c;
            if (c0462e0 != null) {
                this.f8663a.h(c0462e0, c0468h0.f8652j);
            }
            if (this instanceof y5.l) {
                return;
            }
            C0460d0 c0460d0 = (C0460d0) c0468h0.f8645b.f8620a;
            int color = c1119a.f14254c.getColor();
            Drawable drawable = c0460d0.f8635r;
            if (!(drawable instanceof ColorDrawable)) {
                c0460d0.setForeground(new ColorDrawable(color));
            } else {
                ((ColorDrawable) drawable.mutate()).setColor(color);
                c0460d0.invalidate();
            }
        }
    }

    public void r(C0468h0 c0468h0) {
        C0462e0 c0462e0 = c0468h0.f8646c;
        if (c0462e0 != null) {
            this.f8663a.e(c0462e0);
        }
        c0468h0.f8647d = null;
        c0468h0.f8648e = null;
    }

    public void s(C0468h0 c0468h0, boolean z8) {
        C0462e0 c0462e0 = c0468h0.f8646c;
        if (c0462e0 == null || c0462e0.f8620a.getVisibility() == 8) {
            return;
        }
        c0468h0.f8646c.f8620a.setVisibility(z8 ? 0 : 4);
    }

    public final void t(C0468h0 c0468h0, View view) {
        int i = this.f8665c;
        if (i == 1) {
            c0468h0.f8649f = c0468h0.f8651h ? 1 : 2;
        } else if (i == 2) {
            c0468h0.f8649f = c0468h0.f8650g ? 1 : 2;
        } else if (i == 3) {
            c0468h0.f8649f = (c0468h0.f8651h && c0468h0.f8650g) ? 1 : 2;
        }
        int i5 = c0468h0.f8649f;
        if (i5 == 1) {
            view.setActivated(true);
        } else if (i5 == 2) {
            view.setActivated(false);
        }
    }

    public final void u(C0468h0 c0468h0) {
        if (this.f8663a == null || c0468h0.f8646c == null) {
            return;
        }
        C0460d0 c0460d0 = (C0460d0) c0468h0.f8645b.f8620a;
        boolean z8 = c0468h0.f8651h;
        c0460d0.getClass();
        c0460d0.f8634q.setVisibility(z8 ? 0 : 8);
    }
}
