package defpackage;

import android.content.Context;
import android.content.res.Resources;
import android.text.TextUtils;
import android.transition.TransitionSet;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.leanback.widget.GuidanceStylingRelativeLayout;
import androidx.leanback.widget.GuidedActionItemContainer;
import androidx.leanback.widget.GuidedActionsRelativeLayout;
import androidx.leanback.widget.VerticalGridView;
import ar.tvplayer.tv.R;

/* renamed from: ˈˎᵛᵱ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public class C1041 {

    /* renamed from: ˑᵱ, reason: contains not printable characters */
    public static final ᵿʤˑᵦ f4523;

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public View f4524;

    /* renamed from: ˌʾˀ, reason: contains not printable characters */
    public int f4525;

    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    public float f4526;

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public float f4527;

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public boolean f4528;

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public VerticalGridView f4529;

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public float f4530;

    /* renamed from: ᵞʡ, reason: contains not printable characters */
    public TransitionSet f4531;

    /* renamed from: ᵡʠ, reason: contains not printable characters */
    public int f4532;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public ViewGroup f4533;

    /* renamed from: ᵨᵳʝ, reason: contains not printable characters */
    public float f4534;

    /* renamed from: ᵪʩ, reason: contains not printable characters */
    public int f4535;

    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    public int f4536;

    /* renamed from: ᵳٴᵶ, reason: contains not printable characters */
    public int f4537;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public VerticalGridView f4538;

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public float f4539;

    /* renamed from: ᵸʓᵠ, reason: contains not printable characters */
    public C2718 f4540 = null;

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public float f4541;

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public float f4542;

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public View f4543;

    static {
        ᵿʤˑᵦ r0 = new ᵿʤˑᵦ(2, false);
        r0.ᵢˇᵭ = new C1809[]{new C1809()};
        f4523 = r0;
        C1809 c1809 = new C1809();
        c1809.f7286 = R.id._11_res_0x7f0b01cc;
        c1809.f7284 = true;
        c1809.f7287 = 0;
        c1809.f7288 = true;
        c1809.m5125(0.0f);
        r0.ᵢˇᵭ = new C1809[]{c1809};
    }

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public final void m3406(C2503 c2503, boolean z, boolean z2) {
        View view = c2503.f9764;
        View view2 = c2503.f9071;
        if (z) {
            m3413(c2503, z2);
            view2.setFocusable(false);
            view.requestFocus();
            view.setOnClickListener(new ViewOnClickListenerC3023(this, c2503));
            return;
        }
        view2.setFocusable(true);
        view2.requestFocus();
        m3413(null, z2);
        view.setOnClickListener(null);
        view.setClickable(false);
    }

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final void m3407(C2503 c2503, boolean z, boolean z2) {
        if (z == (c2503.f9765 != 0) || this.f4531 != null) {
            return;
        }
        C2718 c2718 = c2503.f9763;
        View view = c2503.f9764;
        TextView textView = c2503.f9761;
        TextView textView2 = c2503.f9766;
        if (!z) {
            if (textView != null) {
                textView.setText(c2718.f10537);
            }
            if (textView2 != null) {
                textView2.setText(c2718.f10545);
            }
            int i = c2503.f9765;
            if (i == 2) {
                if (textView2 != null) {
                    textView2.setVisibility(TextUtils.isEmpty(c2718.f10545) ? 8 : 0);
                    textView2.setInputType(c2718.f10542);
                }
            } else if (i == 1) {
                if (textView != null) {
                    textView.setInputType(c2718.f10538);
                }
            } else if (i == 3 && view != null) {
                m3406(c2503, z, z2);
            }
            c2503.f9765 = 0;
            return;
        }
        CharSequence charSequence = c2718.f10536;
        if (textView != null && charSequence != null) {
            textView.setText(charSequence);
        }
        CharSequence charSequence2 = c2718.f10535;
        if (textView2 != null && charSequence2 != null) {
            textView2.setText(charSequence2);
        }
        if (c2718.m6721()) {
            if (textView2 != null) {
                textView2.setVisibility(0);
                textView2.setInputType(c2718.f10534);
                textView2.requestFocusFromTouch();
            }
            c2503.f9765 = 2;
            return;
        }
        if (c2718.m6726()) {
            if (textView != null) {
                textView.setInputType(c2718.f10543);
                textView.requestFocusFromTouch();
            }
            c2503.f9765 = 1;
            return;
        }
        if (view != null) {
            m3406(c2503, z, z2);
            c2503.f9765 = 3;
        }
    }

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public int m3408() {
        return R.layout._11_res_0x7f0e00a9;
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final ViewGroup m3409(LayoutInflater layoutInflater, ViewGroup viewGroup) throws Resources.NotFoundException {
        float f = layoutInflater.getContext().getTheme().obtainStyledAttributes(AbstractC4459.f16640).getFloat(46, 40.0f);
        ViewGroup viewGroup2 = (ViewGroup) layoutInflater.inflate(this.f4528 ? R.layout._11_res_0x7f0e00aa : R.layout._11_res_0x7f0e00a7, viewGroup, false);
        this.f4533 = viewGroup2;
        this.f4524 = viewGroup2.findViewById(this.f4528 ? R.id._11_res_0x7f0b01c6 : R.id._11_res_0x7f0b01c5);
        ViewGroup viewGroup3 = this.f4533;
        if (viewGroup3 instanceof VerticalGridView) {
            this.f4538 = (VerticalGridView) viewGroup3;
        } else {
            VerticalGridView verticalGridView = (VerticalGridView) viewGroup3.findViewById(this.f4528 ? R.id._11_res_0x7f0b01ce : R.id._11_res_0x7f0b01cd);
            this.f4538 = verticalGridView;
            if (verticalGridView == null) {
                ᵹˉᵞ.ᵳٴᵶ("No ListView exists.");
                return null;
            }
            verticalGridView.setWindowAlignmentOffsetPercent(f);
            this.f4538.setWindowAlignment(0);
            if (!this.f4528) {
                this.f4529 = (VerticalGridView) this.f4533.findViewById(R.id._11_res_0x7f0b01d3);
                this.f4543 = this.f4533.findViewById(R.id._11_res_0x7f0b01d4);
            }
        }
        this.f4538.setFocusable(false);
        this.f4538.setFocusableInTouchMode(false);
        Context context = this.f4533.getContext();
        TypedValue typedValue = new TypedValue();
        context.getTheme().resolveAttribute(R.attr._11_res_0x7f0402df, typedValue, true);
        this.f4541 = typedValue.getFloat();
        context.getTheme().resolveAttribute(R.attr._11_res_0x7f0402de, typedValue, true);
        this.f4526 = typedValue.getFloat();
        context.getTheme().resolveAttribute(R.attr._11_res_0x7f0402e9, typedValue, true);
        this.f4536 = context.getResources().getInteger(typedValue.resourceId);
        context.getTheme().resolveAttribute(R.attr._11_res_0x7f0402e8, typedValue, true);
        this.f4535 = context.getResources().getInteger(typedValue.resourceId);
        context.getTheme().resolveAttribute(R.attr._11_res_0x7f0402dd, typedValue, true);
        this.f4537 = context.getResources().getInteger(typedValue.resourceId);
        context.getTheme().resolveAttribute(R.attr._11_res_0x7f0402ec, typedValue, true);
        this.f4525 = context.getResources().getDimensionPixelSize(typedValue.resourceId);
        this.f4532 = ((WindowManager) context.getSystemService("window")).getDefaultDisplay().getHeight();
        context.getResources().getValue(R.dimen._11_res_0x7f07014f, typedValue, true);
        this.f4527 = typedValue.getFloat();
        context.getResources().getValue(R.dimen._11_res_0x7f070143, typedValue, true);
        this.f4542 = typedValue.getFloat();
        context.getResources().getValue(R.dimen._11_res_0x7f07014e, typedValue, true);
        this.f4530 = typedValue.getFloat();
        context.getResources().getValue(R.dimen._11_res_0x7f070142, typedValue, true);
        this.f4539 = typedValue.getFloat();
        this.f4534 = GuidanceStylingRelativeLayout.m335(context);
        View view = this.f4524;
        if (view instanceof GuidedActionsRelativeLayout) {
            ((GuidedActionsRelativeLayout) view).f449 = new C3343(this);
        }
        return this.f4533;
    }

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public final void m3410(C2503 c2503) {
        boolean z = c2503.f9768;
        View view = c2503.f9764;
        View view2 = c2503.f9071;
        float f = 0.0f;
        if (!z) {
            C2718 c2718 = this.f4540;
            if (c2718 == null) {
                view2.setVisibility(0);
                view2.setTranslationY(0.0f);
                if (view != null) {
                    view.setActivated(false);
                    if (view2 instanceof GuidedActionItemContainer) {
                        ((GuidedActionItemContainer) view2).f446 = true;
                    }
                }
            } else if (c2503.f9763 == c2718) {
                view2.setVisibility(0);
                c2503.f9763.getClass();
                if (view != null) {
                    view2.setTranslationY(0.0f);
                    view.setActivated(true);
                    if (view2 instanceof GuidedActionItemContainer) {
                        ((GuidedActionItemContainer) view2).f446 = false;
                    }
                }
            } else {
                view2.setVisibility(4);
                view2.setTranslationY(0.0f);
            }
        }
        ImageView imageView = c2503.f9762;
        if (imageView != null) {
            C2718 c27182 = c2503.f9763;
            boolean z2 = (c27182.f10533 & 4) == 4;
            if (!z2) {
                imageView.setVisibility(8);
                return;
            }
            imageView.setVisibility(0);
            imageView.setAlpha(c27182.m6718() ? this.f4541 : this.f4526);
            if (!z2) {
                if (c27182 == this.f4540) {
                    imageView.setRotation(270.0f);
                    return;
                } else {
                    imageView.setRotation(90.0f);
                    return;
                }
            }
            ViewGroup viewGroup = this.f4533;
            if (viewGroup != null && viewGroup.getLayoutDirection() == 1) {
                f = 180.0f;
            }
            imageView.setRotation(f);
        }
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final void m3411(boolean z) {
        if (this.f4531 == null && this.f4540 != null) {
            C5195 c5195 = (C5195) this.f4538.getAdapter();
            int iIndexOf = c5195.f19392.indexOf(this.f4540);
            if (iIndexOf < 0) {
                return;
            }
            if (this.f4540.m6723()) {
                m3407((C2503) this.f4538.m597(iIndexOf, false), false, z);
            } else {
                m3413(null, z);
            }
        }
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public void m3412(C2503 c2503, boolean z) throws Resources.NotFoundException {
        c2503.m6356(z);
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:41:0x0115 A[LOOP:2: B:40:0x0113->B:41:0x0115, LOOP_END] */
    /* JADX WARN: Type inference failed for: r2v3, types: [android.view.ViewGroup, androidx.leanback.widget.VerticalGridView, androidx.recyclerview.widget.RecyclerView] */
    /* JADX WARN: Type inference failed for: r3v1 */
    /* JADX WARN: Type inference failed for: r3v10 */
    /* JADX WARN: Type inference failed for: r3v2, types: [int] */
    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void m3413(defpackage.C2503 r17, boolean r18) {
        /*
            Method dump skipped, instructions count: 296
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C1041.m3413(ᵘˆʞᵶ, boolean):void");
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public C2503 m3414(ViewGroup viewGroup) {
        return new C2503(LayoutInflater.from(viewGroup.getContext()).inflate(m3408(), viewGroup, false), viewGroup == this.f4529);
    }
}
