package androidx.leanback.widget;

import android.content.Context;
import android.graphics.Paint;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import com.martsnew.tv.R;

/* JADX INFO: loaded from: classes.dex */
public final class H extends n4.u0 {

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public final B0 f8433v;

    public H(B0 b02) {
        this.f8433v = b02;
    }

    @Override // n4.u0
    public final void B(View view, View view2) {
        y0 y0Var = (y0) view;
        if (!y0Var.f8733q || y0Var.f8735s != null) {
            throw new IllegalStateException();
        }
        ViewGroup.LayoutParams layoutParams = view2.getLayoutParams();
        if (layoutParams != null) {
            FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(layoutParams.width, layoutParams.height);
            layoutParams.width = layoutParams.width == -1 ? -1 : -2;
            layoutParams.height = layoutParams.height == -1 ? -1 : -2;
            y0Var.setLayoutParams(layoutParams);
            y0Var.addView(view2, layoutParams2);
        } else {
            y0Var.addView(view2);
        }
        if (y0Var.f8736t && y0Var.f8737u != 3) {
            s7.d.A(y0Var, y0Var.getResources().getDimensionPixelSize(R.dimen.lb_rounded_rect_corner_radius));
        }
        y0Var.f8735s = view2;
    }

    @Override // n4.u0
    public final View k(ViewGroup viewGroup) {
        Context context = viewGroup.getContext();
        B0 b02 = this.f8433v;
        if (!b02.f8345e) {
            throw new IllegalArgumentException();
        }
        int i = b02.f8341a;
        boolean z8 = b02.f8342b;
        float f3 = b02.f8347g;
        float f7 = b02.f8348h;
        int i5 = b02.f8346f;
        y0 y0Var = new y0(context);
        y0Var.f8737u = 1;
        if (y0Var.f8733q) {
            throw new IllegalStateException();
        }
        y0Var.f8733q = true;
        y0Var.f8736t = i5 > 0;
        y0Var.f8737u = i;
        if (i == 2) {
            y0Var.setLayoutMode(1);
            LayoutInflater.from(y0Var.getContext()).inflate(R.layout.lb_shadow, (ViewGroup) y0Var, true);
            H0 h02 = new H0();
            h02.f8434a = y0Var.findViewById(R.id.lb_shadow_normal);
            h02.f8435b = y0Var.findViewById(R.id.lb_shadow_focused);
            y0Var.f8734r = h02;
        } else if (i == 3) {
            y0Var.f8734r = s7.l.a(y0Var, f3, f7, i5);
        }
        if (!z8) {
            y0Var.setWillNotDraw(true);
            y0Var.f8738v = null;
            return y0Var;
        }
        y0Var.setWillNotDraw(false);
        y0Var.f8739w = 0;
        Paint paint = new Paint();
        y0Var.f8738v = paint;
        paint.setColor(y0Var.f8739w);
        y0Var.f8738v.setStyle(Paint.Style.FILL);
        return y0Var;
    }
}
