package com.strmr.ps.ui.actor;

import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.View;
import android.view.Window;
import android.widget.ScrollView;
import android.widget.TextView;
import androidx.media3.container.NalUnitUtil;
import androidx.media3.exoplayer.upstream.CmcdData;
import com.google.android.material.button.MaterialButton;
import com.strmr.ps.R;
import defpackage.cr4;
import defpackage.n89;
import defpackage.r21;
import defpackage.ua;
import defpackage.va;
import defpackage.vx8;
import defpackage.wa;
import defpackage.xa;
import defpackage.ya;
import kotlin.Metadata;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\u0018\u00002\u00020\u0001:\u0001\u0002¨\u0006\u0003"}, d2 = {"Lcom/strmr/ps/ui/actor/a;", "Landroid/app/Dialog;", CmcdData.OBJECT_TYPE_AUDIO_ONLY, "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
@vx8
public final class a extends Dialog {
    public static final /* synthetic */ int d = 0;
    public final String a;
    public final String b;
    public final String c;

    /* JADX INFO: renamed from: com.strmr.ps.ui.actor.a$a, reason: collision with other inner class name */
    @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lcom/strmr/ps/ui/actor/a$a;", "", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class C0108a {
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public a(Context context, String str, String str2, String str3) {
        super(context, R.style.ContextMenuDialogTheme);
        cr4.g(str, "personName");
        cr4.g(str2, "biography");
        this.a = str;
        this.b = str2;
        this.c = str3;
    }

    @Override // android.app.Dialog
    public final void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        requestWindowFeature(1);
        setContentView(R.layout.dialog_actor_biography);
        boolean zHasSystemFeature = getContext().getPackageManager().hasSystemFeature("android.software.leanback");
        TextView textView = (TextView) findViewById(R.id.bio_dialog_name);
        textView.setText(this.a);
        if (!zHasSystemFeature) {
            textView.setTextSize(20.0f);
        }
        TextView textView2 = (TextView) findViewById(R.id.bio_dialog_metadata);
        String str = this.c;
        if (str != null && !n89.ab(str)) {
            textView2.setText(str);
            textView2.setVisibility(0);
            if (!zHasSystemFeature) {
                textView2.setTextSize(12.0f);
            }
        }
        View viewFindViewById = findViewById(R.id.accent_divider);
        if (viewFindViewById != null) {
            TypedValue typedValue = new TypedValue();
            int color = (getContext().getTheme().resolveAttribute(R.attr.colorAccentPrimary, typedValue, true) ? typedValue.data : Color.parseColor("#9D50FF")) & 16777215;
            GradientDrawable gradientDrawable = new GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT, new int[]{color, 1291845632 | color, color});
            gradientDrawable.setSize(-1, (int) getContext().getResources().getDisplayMetrics().density);
            viewFindViewById.setBackground(gradientDrawable);
        }
        ((TextView) findViewById(R.id.bio_dialog_text)).setText(this.b);
        MaterialButton materialButton = (MaterialButton) findViewById(R.id.btn_close);
        materialButton.setOnClickListener(new ua(this, 0));
        materialButton.setOnKeyListener(new va(this, 0));
        materialButton.setOnFocusChangeListener(new wa(0));
        ScrollView scrollView = (ScrollView) findViewById(R.id.bio_scroll_view);
        if (scrollView != null) {
            scrollView.post(new r21(scrollView, 4));
        }
        setOnKeyListener(new ya(this, 0));
    }

    @Override // android.app.Dialog
    public final void onStart() {
        double d2;
        double d3;
        super.onStart();
        Window window = getWindow();
        if (window != null) {
            boolean zHasSystemFeature = getContext().getPackageManager().hasSystemFeature("android.software.leanback");
            DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics();
            if (zHasSystemFeature) {
                d2 = displayMetrics.widthPixels;
                d3 = 0.45d;
            } else {
                d2 = displayMetrics.widthPixels;
                d3 = 0.88d;
            }
            int i = (int) (d2 * d3);
            int i2 = (int) (((double) displayMetrics.heightPixels) * 0.8d);
            window.setLayout(i, -2);
            window.getDecorView().post(new xa(i2, i, 0, window));
        }
    }
}
