package androidx.appcompat.view.menu;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.TextView;
import ar.tvplayer.tv.R;
import defpackage.AbstractC0542;
import defpackage.C1570;
import defpackage.C2652;
import defpackage.InterfaceC2341;
import defpackage.MenuC2418;

/* loaded from: classes3.dex */
public class ListMenuItemView extends LinearLayout implements InterfaceC2341, AbsListView.SelectionBoundsAdjuster {

    /* renamed from: ˀᵗᵝᵭ, reason: contains not printable characters */
    public ImageView f53;

    /* renamed from: ˁˑᵰ, reason: contains not printable characters */
    public LayoutInflater f54;

    /* renamed from: ˎˑː, reason: contains not printable characters */
    public final Drawable f55;

    /* renamed from: ˑᵥˁ, reason: contains not printable characters */
    public LinearLayout f56;

    /* renamed from: ᐧﾞ, reason: contains not printable characters */
    public final Drawable f57;

    /* renamed from: ᵡˎ, reason: contains not printable characters */
    public ImageView f58;

    /* renamed from: ᵡⁱᵥ, reason: contains not printable characters */
    public TextView f59;

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public ImageView f60;

    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    public CheckBox f61;

    /* renamed from: ᵧـˌᵎ, reason: contains not printable characters */
    public final Context f62;

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public C2652 f63;

    /* renamed from: ᵮᵠـˌ, reason: contains not printable characters */
    public final int f64;

    /* renamed from: ᵶʔᵢˊ, reason: contains not printable characters */
    public final boolean f65;

    /* renamed from: ᵺʙ, reason: contains not printable characters */
    public boolean f66;

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public TextView f67;

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public RadioButton f68;

    /* renamed from: ﾞⁱ, reason: contains not printable characters */
    public boolean f69;

    public ListMenuItemView(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, R.attr._11_res_0x7f0403f2);
    }

    public ListMenuItemView(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet);
        C1570 c1570M4541 = C1570.m4541(getContext(), attributeSet, AbstractC0542.f2824, i);
        this.f55 = c1570M4541.m4550(5);
        TypedArray typedArray = (TypedArray) c1570M4541.f6230;
        this.f64 = typedArray.getResourceId(1, -1);
        this.f66 = typedArray.getBoolean(7, false);
        this.f62 = context;
        this.f57 = c1570M4541.m4550(8);
        TypedArray typedArrayObtainStyledAttributes = context.getTheme().obtainStyledAttributes(null, new int[]{android.R.attr.divider}, R.attr._11_res_0x7f04021c, 0);
        this.f65 = typedArrayObtainStyledAttributes.hasValue(0);
        c1570M4541.m4542();
        typedArrayObtainStyledAttributes.recycle();
    }

    private LayoutInflater getInflater() {
        if (this.f54 == null) {
            this.f54 = LayoutInflater.from(getContext());
        }
        return this.f54;
    }

    private void setSubMenuArrowVisible(boolean z) {
        ImageView imageView = this.f53;
        if (imageView != null) {
            imageView.setVisibility(z ? 0 : 8);
        }
    }

    @Override // android.widget.AbsListView.SelectionBoundsAdjuster
    public final void adjustListItemSelectionBounds(Rect rect) {
        ImageView imageView = this.f58;
        if (imageView == null || imageView.getVisibility() != 0) {
            return;
        }
        LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) this.f58.getLayoutParams();
        rect.top = this.f58.getHeight() + layoutParams.topMargin + layoutParams.bottomMargin + rect.top;
    }

    @Override // defpackage.InterfaceC2341
    public C2652 getItemData() {
        return this.f63;
    }

    @Override // android.view.View
    public final void onFinishInflate() {
        super.onFinishInflate();
        setBackground(this.f55);
        TextView textView = (TextView) findViewById(R.id.title);
        this.f67 = textView;
        int i = this.f64;
        if (i != -1) {
            textView.setTextAppearance(this.f62, i);
        }
        this.f59 = (TextView) findViewById(R.id._11_res_0x7f0b0361);
        ImageView imageView = (ImageView) findViewById(R.id._11_res_0x7f0b038e);
        this.f53 = imageView;
        if (imageView != null) {
            imageView.setImageDrawable(this.f57);
        }
        this.f58 = (ImageView) findViewById(R.id._11_res_0x7f0b01bc);
        this.f56 = (LinearLayout) findViewById(R.id._11_res_0x7f0b00f8);
    }

    @Override // android.widget.LinearLayout, android.view.View
    public final void onMeasure(int i, int i2) {
        if (this.f60 != null && this.f66) {
            ViewGroup.LayoutParams layoutParams = getLayoutParams();
            LinearLayout.LayoutParams layoutParams2 = (LinearLayout.LayoutParams) this.f60.getLayoutParams();
            int i3 = layoutParams.height;
            if (i3 > 0 && layoutParams2.width <= 0) {
                layoutParams2.width = i3;
            }
        }
        super.onMeasure(i, i2);
    }

    public void setCheckable(boolean z) {
        CompoundButton compoundButton;
        View view;
        if (!z && this.f68 == null && this.f61 == null) {
            return;
        }
        if ((this.f63.f10291 & 4) != 0) {
            if (this.f68 == null) {
                RadioButton radioButton = (RadioButton) getInflater().inflate(R.layout._11_res_0x7f0e0011, (ViewGroup) this, false);
                this.f68 = radioButton;
                LinearLayout linearLayout = this.f56;
                if (linearLayout != null) {
                    linearLayout.addView(radioButton, -1);
                } else {
                    addView(radioButton, -1);
                }
            }
            compoundButton = this.f68;
            view = this.f61;
        } else {
            if (this.f61 == null) {
                CheckBox checkBox = (CheckBox) getInflater().inflate(R.layout._11_res_0x7f0e000e, (ViewGroup) this, false);
                this.f61 = checkBox;
                LinearLayout linearLayout2 = this.f56;
                if (linearLayout2 != null) {
                    linearLayout2.addView(checkBox, -1);
                } else {
                    addView(checkBox, -1);
                }
            }
            compoundButton = this.f61;
            view = this.f68;
        }
        if (z) {
            compoundButton.setChecked(this.f63.isChecked());
            if (compoundButton.getVisibility() != 0) {
                compoundButton.setVisibility(0);
            }
            if (view == null || view.getVisibility() == 8) {
                return;
            }
            view.setVisibility(8);
            return;
        }
        CheckBox checkBox2 = this.f61;
        if (checkBox2 != null) {
            checkBox2.setVisibility(8);
        }
        RadioButton radioButton2 = this.f68;
        if (radioButton2 != null) {
            radioButton2.setVisibility(8);
        }
    }

    public void setChecked(boolean z) {
        CompoundButton compoundButton;
        if ((this.f63.f10291 & 4) != 0) {
            if (this.f68 == null) {
                RadioButton radioButton = (RadioButton) getInflater().inflate(R.layout._11_res_0x7f0e0011, (ViewGroup) this, false);
                this.f68 = radioButton;
                LinearLayout linearLayout = this.f56;
                if (linearLayout != null) {
                    linearLayout.addView(radioButton, -1);
                } else {
                    addView(radioButton, -1);
                }
            }
            compoundButton = this.f68;
        } else {
            if (this.f61 == null) {
                CheckBox checkBox = (CheckBox) getInflater().inflate(R.layout._11_res_0x7f0e000e, (ViewGroup) this, false);
                this.f61 = checkBox;
                LinearLayout linearLayout2 = this.f56;
                if (linearLayout2 != null) {
                    linearLayout2.addView(checkBox, -1);
                } else {
                    addView(checkBox, -1);
                }
            }
            compoundButton = this.f61;
        }
        compoundButton.setChecked(z);
    }

    public void setForceShowIcon(boolean z) {
        this.f69 = z;
        this.f66 = z;
    }

    public void setGroupDividerEnabled(boolean z) {
        ImageView imageView = this.f58;
        if (imageView != null) {
            imageView.setVisibility((this.f65 || !z) ? 8 : 0);
        }
    }

    public void setIcon(Drawable drawable) {
        MenuC2418 menuC2418 = this.f63.f10281;
        boolean z = this.f69;
        if (z || this.f66) {
            ImageView imageView = this.f60;
            if (imageView == null && drawable == null && !this.f66) {
                return;
            }
            if (imageView == null) {
                ImageView imageView2 = (ImageView) getInflater().inflate(R.layout._11_res_0x7f0e000f, (ViewGroup) this, false);
                this.f60 = imageView2;
                LinearLayout linearLayout = this.f56;
                if (linearLayout != null) {
                    linearLayout.addView(imageView2, 0);
                } else {
                    addView(imageView2, 0);
                }
            }
            if (drawable == null && !this.f66) {
                this.f60.setVisibility(8);
                return;
            }
            ImageView imageView3 = this.f60;
            if (!z) {
                drawable = null;
            }
            imageView3.setImageDrawable(drawable);
            if (this.f60.getVisibility() != 0) {
                this.f60.setVisibility(0);
            }
        }
    }

    public void setTitle(CharSequence charSequence) {
        TextView textView = this.f67;
        if (charSequence == null) {
            if (textView.getVisibility() != 8) {
                this.f67.setVisibility(8);
            }
        } else {
            textView.setText(charSequence);
            if (this.f67.getVisibility() != 0) {
                this.f67.setVisibility(0);
            }
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:14:0x0035  */
    /* JADX WARN: Removed duplicated region for block: B:25:0x0053  */
    @Override // defpackage.InterfaceC2341
    /* renamed from: ᵥᵯˎ */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void mo3(defpackage.C2652 r11) {
        /*
            Method dump skipped, instructions count: 310
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.view.menu.ListMenuItemView.mo3(ᵚˉ):void");
    }
}
