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 androidx.leanback.widget.bi;
import androidx.leanback.widget.k0;
import com.strmr.ps.R;
import defpackage.zo8;

/* JADX INFO: loaded from: classes.dex */
public class bj extends bi.e {
    public final g0 a;

    public bj(g0 g0Var) {
        this.a = g0Var;
    }

    @Override // androidx.leanback.widget.bi.e
    public final View a(ViewGroup viewGroup) {
        Context context = viewGroup.getContext();
        g0 g0Var = this.a;
        if (!g0Var.e) {
            throw new IllegalArgumentException();
        }
        int i = g0Var.a;
        boolean z = g0Var.b;
        float f = g0Var.g;
        float f2 = g0Var.h;
        int i2 = g0Var.f;
        zo8 zo8Var = new zo8(context);
        zo8Var.e = 1;
        if (zo8Var.a) {
            throw new IllegalStateException();
        }
        zo8Var.a = true;
        zo8Var.d = i2 > 0;
        zo8Var.e = i;
        if (i == 2) {
            zo8Var.setLayoutMode(1);
            LayoutInflater.from(zo8Var.getContext()).inflate(R.layout.lb_shadow, (ViewGroup) zo8Var, true);
            k0.a aVar = new k0.a();
            aVar.a = zo8Var.findViewById(R.id.lb_shadow_normal);
            aVar.b = zo8Var.findViewById(R.id.lb_shadow_focused);
            zo8Var.b = aVar;
        } else if (i == 3) {
            zo8Var.b = e0.a(zo8Var, f, f2, i2);
        }
        if (!z) {
            zo8Var.setWillNotDraw(true);
            zo8Var.f = null;
            return zo8Var;
        }
        zo8Var.setWillNotDraw(false);
        zo8Var.i = 0;
        Paint paint = new Paint();
        zo8Var.f = paint;
        paint.setColor(zo8Var.i);
        zo8Var.f.setStyle(Paint.Style.FILL);
        return zo8Var;
    }

    @Override // androidx.leanback.widget.bi.e
    public final void b(View view, View view2) {
        zo8 zo8Var = (zo8) view;
        if (!zo8Var.a || zo8Var.c != 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;
            zo8Var.setLayoutParams(layoutParams);
            zo8Var.addView(view2, layoutParams2);
        } else {
            zo8Var.addView(view2);
        }
        if (zo8Var.d && zo8Var.e != 3) {
            cl.a(zo8Var, true);
        }
        zo8Var.c = view2;
    }
}
