package defpackage;

import android.R;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.RippleDrawable;
import android.os.Parcelable;
import android.text.Layout;
import android.text.TextPaint;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.util.Xml;
import android.view.View;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.Button;
import android.widget.Checkable;
import android.widget.CompoundButton;
import android.widget.TextView;
import j$.util.Objects;
import java.io.IOException;
import java.util.Iterator;
import java.util.LinkedHashSet;
import org.xmlpull.v1.XmlPullParserException;

/* JADX INFO: renamed from: ˈʛ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public class C1016 extends C1855 implements Checkable, InterfaceC0411 {

    /* JADX INFO: renamed from: ˋᵯᵩ, reason: contains not printable characters */
    public static final int[] f4405 = {R.attr.state_checkable};

    /* JADX INFO: renamed from: ᵜᵤ, reason: contains not printable characters */
    public static final int[] f4406 = {R.attr.state_checked};

    /* JADX INFO: renamed from: ʽᵡᵢᵾ, reason: contains not printable characters */
    public boolean f4407;

    /* JADX INFO: renamed from: ʿٴˇ, reason: contains not printable characters */
    public ColorStateList f4408;

    /* JADX INFO: renamed from: ʿᵿʽᵞ, reason: contains not printable characters */
    public int f4409;

    /* JADX INFO: renamed from: ˀᵗ, reason: contains not printable characters */
    public int f4410;

    /* JADX INFO: renamed from: ˀᵭ, reason: contains not printable characters */
    public int f4411;

    /* JADX INFO: renamed from: ˁʢᵛ, reason: contains not printable characters */
    public float f4412;

    /* JADX INFO: renamed from: ˁˌᵩ, reason: contains not printable characters */
    public String f4413;

    /* JADX INFO: renamed from: ˁᵺˈ, reason: contains not printable characters */
    public float f4414;

    /* JADX INFO: renamed from: ˈᵲᵢ, reason: contains not printable characters */
    public PorterDuff.Mode f4415;

    /* JADX INFO: renamed from: ˈⁱᵡ, reason: contains not printable characters */
    public boolean f4416;

    /* JADX INFO: renamed from: ˉˆᵗ, reason: contains not printable characters */
    public float f4417;

    /* JADX INFO: renamed from: ˉᵵᵜ, reason: contains not printable characters */
    public boolean f4418;

    /* JADX INFO: renamed from: ˊˌˊ, reason: contains not printable characters */
    public int f4419;

    /* JADX INFO: renamed from: ˊᵡᵗʨ, reason: contains not printable characters */
    public int f4420;

    /* JADX INFO: renamed from: ˊᵾʽʼ, reason: contains not printable characters */
    public int f4421;

    /* JADX INFO: renamed from: ˋʿᐧ, reason: contains not printable characters */
    public EnumC4737 f4422;

    /* JADX INFO: renamed from: ˌᵨʠᵫ, reason: contains not printable characters */
    public ColorStateList f4423;

    /* JADX INFO: renamed from: ˏᵩʨ, reason: contains not printable characters */
    public int f4424;

    /* JADX INFO: renamed from: ˑʢ, reason: contains not printable characters */
    public int f4425;

    /* JADX INFO: renamed from: ˑˊᵲ, reason: contains not printable characters */
    public PorterDuff.Mode f4426;

    /* JADX INFO: renamed from: ᵛˀˊ, reason: contains not printable characters */
    public boolean f4427;

    /* JADX INFO: renamed from: ᵛˑﹳ, reason: contains not printable characters */
    public int f4428;

    /* JADX INFO: renamed from: ᵞᵛᵘ, reason: contains not printable characters */
    public int f4429;

    /* JADX INFO: renamed from: ᵠˏˏ, reason: contains not printable characters */
    public Drawable f4430;

    /* JADX INFO: renamed from: ᵡᵶ, reason: contains not printable characters */
    public int f4431;

    /* JADX INFO: renamed from: ᵡᵶᵬʤ, reason: contains not printable characters */
    public int f4432;

    /* JADX INFO: renamed from: ᵨˈʼﹶ, reason: contains not printable characters */
    public int f4433;

    /* JADX INFO: renamed from: ᵯᵷʽ, reason: contains not printable characters */
    public final C1721 f4434;

    /* JADX INFO: renamed from: ᵵᵬᵽ, reason: contains not printable characters */
    public int f4435;

    /* JADX INFO: renamed from: ᵶˇᵱ, reason: contains not printable characters */
    public final LinkedHashSet f4436;

    /* JADX INFO: renamed from: ᵸˆˁ, reason: contains not printable characters */
    public Drawable f4437;

    /* JADX WARN: Removed duplicated region for block: B:28:0x00fa  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public C1016(Context context, AttributeSet attributeSet) {
        XmlResourceParser xml;
        AttributeSet attributeSetAsAttributeSet;
        int next;
        InterfaceC5120 c1930;
        int resourceId;
        int resourceId2;
        Drawable drawable;
        super(ᵲᵧˇ.ˉᵵᵜ(context, attributeSet, ar.tvplayer.tv.R.attr.h, ar.tvplayer.tv.R.style.h, new int[]{ar.tvplayer.tv.R.attr.h}), attributeSet, ar.tvplayer.tv.R.attr.h);
        this.f4436 = new LinkedHashSet();
        this.f4407 = false;
        this.f4416 = false;
        this.f4419 = Integer.MIN_VALUE;
        this.f4412 = -2.1474836E9f;
        this.f4410 = Integer.MIN_VALUE;
        this.f4424 = Integer.MIN_VALUE;
        this.f4431 = Integer.MIN_VALUE;
        this.f4422 = EnumC4737.f18008;
        Context context2 = getContext();
        ᵸᵺᵜ.ʽˈˋ(context2, attributeSet, ar.tvplayer.tv.R.attr.h, ar.tvplayer.tv.R.style.h);
        int[] iArr = AbstractC2172.f8638;
        ᵸᵺᵜ.ːˏᵟᵯ(context2, attributeSet, iArr, ar.tvplayer.tv.R.attr.h, ar.tvplayer.tv.R.style.h, new int[0]);
        TypedArray typedArrayObtainStyledAttributes = context2.obtainStyledAttributes(attributeSet, iArr, ar.tvplayer.tv.R.attr.h, ar.tvplayer.tv.R.style.h);
        this.f4428 = typedArrayObtainStyledAttributes.getDimensionPixelSize(13, 0);
        int i = typedArrayObtainStyledAttributes.getInt(16, -1);
        PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN;
        this.f4415 = ᵻᵪ.ᵠˏˏ(i);
        this.f4423 = ᵺᵘ.ˉᵲ(getContext(), typedArrayObtainStyledAttributes, 15);
        this.f4437 = (!typedArrayObtainStyledAttributes.hasValue(11) || (resourceId2 = typedArrayObtainStyledAttributes.getResourceId(11, 0)) == 0 || (drawable = ᵥˇᵛˎ.ᵶˇᵱ(getContext(), resourceId2)) == null) ? typedArrayObtainStyledAttributes.getDrawable(11) : drawable;
        this.f4433 = typedArrayObtainStyledAttributes.getInteger(12, 1);
        this.f4411 = typedArrayObtainStyledAttributes.getDimensionPixelSize(14, 0);
        this.f4426 = ᵻᵪ.ᵠˏˏ(typedArrayObtainStyledAttributes.getInt(22, -1));
        this.f4408 = typedArrayObtainStyledAttributes.hasValue(21) ? ᵺᵘ.ˉᵲ(getContext(), typedArrayObtainStyledAttributes, 21) : this.f4423;
        this.f4429 = typedArrayObtainStyledAttributes.getInteger(20, 3);
        Drawable drawable2 = (!typedArrayObtainStyledAttributes.hasValue(19) || (resourceId = typedArrayObtainStyledAttributes.getResourceId(19, 0)) == 0 || (drawable2 = ᵥˇᵛˎ.ᵶˇᵱ(getContext(), resourceId)) == null) ? typedArrayObtainStyledAttributes.getDrawable(19) : drawable2;
        this.f4430 = drawable2;
        this.f4418 = drawable2 == null;
        int resourceId3 = typedArrayObtainStyledAttributes.getResourceId(23, 0);
        if (resourceId3 != 0 && Objects.equals(context2.getResources().getResourceTypeName(resourceId3), "xml")) {
            ˆᴵᵶ r14 = new ˆᴵᵶ(6);
            r14.ːˏᵟᵯ();
            try {
                xml = context2.getResources().getXml(resourceId3);
                try {
                    attributeSetAsAttributeSet = Xml.asAttributeSet(xml);
                    do {
                        next = xml.next();
                        if (next == 2) {
                            break;
                        }
                    } while (next != 1);
                } finally {
                }
            } catch (Resources.NotFoundException | IOException | XmlPullParserException unused) {
                r14.ːˏᵟᵯ();
            }
            if (next != 2) {
                throw new XmlPullParserException("No start tag found");
            }
            if (xml.getName().equals("selector")) {
                C1930.m5169(r14, context2, xml, attributeSetAsAttributeSet, context2.getTheme());
            }
            xml.close();
            c1930 = r14.ᵔᵖᵹᵫ == 0 ? null : new C1930(r14);
        }
        c1930 = c1930 == null ? C2140.m5654(context2, attributeSet, ar.tvplayer.tv.R.attr.h, ar.tvplayer.tv.R.style.h).m7053() : c1930;
        boolean z = typedArrayObtainStyledAttributes.getBoolean(17, false);
        C1721 c1721 = new C1721(this, c1930);
        this.f4434 = c1721;
        c1721.f6877 = typedArrayObtainStyledAttributes.getDimensionPixelOffset(2, 0);
        c1721.f6887 = typedArrayObtainStyledAttributes.getDimensionPixelOffset(3, 0);
        c1721.f6883 = typedArrayObtainStyledAttributes.getDimensionPixelOffset(4, 0);
        c1721.f6870 = typedArrayObtainStyledAttributes.getDimensionPixelOffset(5, 0);
        if (typedArrayObtainStyledAttributes.hasValue(9)) {
            int dimensionPixelSize = typedArrayObtainStyledAttributes.getDimensionPixelSize(9, -1);
            c1721.f6886 = dimensionPixelSize;
            c1721.f6866 = c1721.f6866.mo5172(dimensionPixelSize);
            c1721.m4765();
            c1721.f6868 = true;
        }
        c1721.f6881 = typedArrayObtainStyledAttributes.getDimensionPixelSize(26, 0);
        int i2 = typedArrayObtainStyledAttributes.getInt(8, -1);
        PorterDuff.Mode mode2 = PorterDuff.Mode.SRC_IN;
        c1721.f6884 = ᵻᵪ.ᵠˏˏ(i2);
        c1721.f6879 = ᵺᵘ.ˉᵲ(getContext(), typedArrayObtainStyledAttributes, 7);
        c1721.f6875 = ᵺᵘ.ˉᵲ(getContext(), typedArrayObtainStyledAttributes, 25);
        c1721.f6871 = ᵺᵘ.ˉᵲ(getContext(), typedArrayObtainStyledAttributes, 18);
        c1721.f6867 = typedArrayObtainStyledAttributes.getBoolean(6, false);
        c1721.f6872 = typedArrayObtainStyledAttributes.getDimensionPixelSize(10, 0);
        c1721.f6873 = typedArrayObtainStyledAttributes.getBoolean(27, true);
        int paddingStart = getPaddingStart();
        int paddingTop = getPaddingTop();
        int paddingEnd = getPaddingEnd();
        int paddingBottom = getPaddingBottom();
        if (typedArrayObtainStyledAttributes.hasValue(0)) {
            c1721.f6880 = true;
            setSupportBackgroundTintList(c1721.f6879);
            setSupportBackgroundTintMode(c1721.f6884);
        } else {
            c1721.m4762();
        }
        setPaddingRelative(paddingStart + c1721.f6877, paddingTop + c1721.f6883, paddingEnd + c1721.f6887, paddingBottom + c1721.f6870);
        setCheckedInternal(typedArrayObtainStyledAttributes.getBoolean(1, false));
        if (c1930 instanceof C1930) {
            c1721.f6874 = m3371();
            if (c1721.f6866 instanceof C1930) {
                c1721.m4765();
            }
        }
        setOpticalCenterEnabled(z);
        typedArrayObtainStyledAttributes.recycle();
        setCompoundDrawablePadding(this.f4428);
        m3374(this.f4437 != null);
        m3367(this.f4430 != null);
    }

    private Layout.Alignment getActualTextAlignment() {
        int textAlignment = getTextAlignment();
        return textAlignment != 1 ? (textAlignment == 6 || textAlignment == 3) ? Layout.Alignment.ALIGN_OPPOSITE : textAlignment != 4 ? Layout.Alignment.ALIGN_NORMAL : Layout.Alignment.ALIGN_CENTER : getGravityTextAlignment();
    }

    private float getDisplayedWidthIncrease() {
        return this.f4417;
    }

    private Layout.Alignment getGravityTextAlignment() {
        int gravity = getGravity() & 8388615;
        return gravity != 1 ? (gravity == 5 || gravity == 8388613) ? Layout.Alignment.ALIGN_OPPOSITE : Layout.Alignment.ALIGN_NORMAL : Layout.Alignment.ALIGN_CENTER;
    }

    private int getOpticalCenterShift() {
        return 0;
    }

    private int getTextHeight() {
        if (getLineCount() > 1) {
            return getLayout().getHeight();
        }
        TextPaint paint = getPaint();
        String string = getText().toString();
        if (getTransformationMethod() != null) {
            string = getTransformationMethod().getTransformation(string, this).toString();
        }
        Rect rect = new Rect();
        paint.getTextBounds(string, 0, string.length(), rect);
        return Math.min(rect.height(), getLayout().getHeight());
    }

    private int getTextLayoutWidth() {
        int lineCount = getLineCount();
        float fMax = 0.0f;
        for (int i = 0; i < lineCount; i++) {
            fMax = Math.max(fMax, getLayout().getLineWidth(i));
        }
        return (int) Math.ceil(fMax);
    }

    private void setCheckedInternal(boolean z) {
        C1721 c1721 = this.f4434;
        if (c1721 == null || !c1721.f6867 || this.f4407 == z) {
            return;
        }
        this.f4407 = z;
        refreshDrawableState();
        getParent();
        if (this.f4416) {
            return;
        }
        this.f4416 = true;
        Iterator it = this.f4436.iterator();
        if (!it.hasNext()) {
            this.f4416 = false;
        } else {
            it.next().getClass();
            C1685.m4560();
        }
    }

    private void setDisplayedWidthIncrease(float f) {
        if (this.f4417 != f) {
            this.f4417 = f;
            m3362();
            invalidate();
            getParent();
        }
    }

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public static /* synthetic */ void m3361(C1016 c1016) {
        c1016.f4409 = c1016.getOpticalCenterShift();
        c1016.m3362();
        c1016.invalidate();
    }

    public String getA11yClassName() {
        if (!TextUtils.isEmpty(this.f4413)) {
            return this.f4413;
        }
        C1721 c1721 = this.f4434;
        return ((c1721 == null || !c1721.f6867) ? Button.class : CompoundButton.class).getName();
    }

    public int getAllowedWidthDecrease() {
        return this.f4431;
    }

    @Override // android.view.View
    public ColorStateList getBackgroundTintList() {
        return getSupportBackgroundTintList();
    }

    @Override // android.view.View
    public PorterDuff.Mode getBackgroundTintMode() {
        return getSupportBackgroundTintMode();
    }

    public int getCornerRadius() {
        if (m3370()) {
            return this.f4434.f6886;
        }
        return 0;
    }

    public C5256 getCornerSpringForce() {
        return this.f4434.f6874;
    }

    public Drawable getIcon() {
        return this.f4437;
    }

    public int getIconGravity() {
        return this.f4433;
    }

    public int getIconPadding() {
        return this.f4428;
    }

    public int getIconSize() {
        return this.f4411;
    }

    public ColorStateList getIconTint() {
        return this.f4423;
    }

    public PorterDuff.Mode getIconTintMode() {
        return this.f4415;
    }

    public int getInsetBottom() {
        return this.f4434.f6870;
    }

    public int getInsetLeft() {
        return this.f4434.f6877;
    }

    public int getInsetRight() {
        return this.f4434.f6887;
    }

    public int getInsetTop() {
        return this.f4434.f6883;
    }

    public ColorStateList getRippleColor() {
        if (m3370()) {
            return this.f4434.f6871;
        }
        return null;
    }

    public Drawable getSecondaryIcon() {
        return this.f4430;
    }

    public int getSecondaryIconGravity() {
        return this.f4429;
    }

    public ColorStateList getSecondaryIconTint() {
        return this.f4408;
    }

    public PorterDuff.Mode getSecondaryIconTintMode() {
        return this.f4426;
    }

    public InterfaceC5120 getShapeAppearance() {
        if (m3370()) {
            return this.f4434.f6866;
        }
        ᵕᵩʽᵲ.ᵪᵹᵥᵻ("Attempted to get ShapeAppearance from a MaterialButton which has an overwritten background.");
        return null;
    }

    public C2140 getShapeAppearanceModel() {
        if (m3370()) {
            return this.f4434.f6866.mo5171();
        }
        ᵕᵩʽᵲ.ᵪᵹᵥᵻ("Attempted to get ShapeAppearanceModel from a MaterialButton which has an overwritten background.");
        return null;
    }

    public ColorStateList getStrokeColor() {
        if (m3370()) {
            return this.f4434.f6875;
        }
        return null;
    }

    public int getStrokeWidth() {
        if (m3370()) {
            return this.f4434.f6881;
        }
        return 0;
    }

    @Override // defpackage.C1855
    public ColorStateList getSupportBackgroundTintList() {
        return m3370() ? this.f4434.f6879 : super.getSupportBackgroundTintList();
    }

    @Override // defpackage.C1855
    public PorterDuff.Mode getSupportBackgroundTintMode() {
        return m3370() ? this.f4434.f6884 : super.getSupportBackgroundTintMode();
    }

    @Override // android.widget.Checkable
    public final boolean isChecked() {
        return this.f4407;
    }

    @Override // android.widget.TextView, android.view.View
    public final void onAttachedToWindow() {
        super.onAttachedToWindow();
        if (m3370()) {
            C3347 c3347M4764 = this.f4434.m4764(false);
            C2098 c2098 = c3347M4764.f12842.f16502;
            if (c2098 == null || !c2098.f8322) {
                return;
            }
            float elevation = 0.0f;
            for (ViewParent parent = getParent(); parent instanceof View; parent = parent.getParent()) {
                elevation += ((View) parent).getElevation();
            }
            C4335 c4335 = c3347M4764.f12842;
            if (c4335.f16510 != elevation) {
                c4335.f16510 = elevation;
                c3347M4764.m7683();
            }
        }
    }

    @Override // android.widget.TextView, android.view.View
    public final int[] onCreateDrawableState(int i) {
        int[] iArrOnCreateDrawableState = super.onCreateDrawableState(i + 2);
        C1721 c1721 = this.f4434;
        if (c1721 != null && c1721.f6867) {
            View.mergeDrawableStates(iArrOnCreateDrawableState, f4405);
        }
        if (this.f4407) {
            View.mergeDrawableStates(iArrOnCreateDrawableState, f4406);
        }
        return iArrOnCreateDrawableState;
    }

    @Override // defpackage.C1855, android.view.View
    public final void onInitializeAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
        super.onInitializeAccessibilityEvent(accessibilityEvent);
        accessibilityEvent.setClassName(getA11yClassName());
        accessibilityEvent.setChecked(this.f4407);
    }

    @Override // defpackage.C1855, android.view.View
    public final void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
        super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
        accessibilityNodeInfo.setClassName(getA11yClassName());
        C1721 c1721 = this.f4434;
        accessibilityNodeInfo.setCheckable(c1721 != null && c1721.f6867);
        accessibilityNodeInfo.setChecked(this.f4407);
        accessibilityNodeInfo.setClickable(isClickable());
    }

    @Override // defpackage.C1855, android.widget.TextView, android.view.View
    public final void onLayout(boolean z, int i, int i2, int i3, int i4) {
        int i5;
        super.onLayout(z, i, i2, i3, i4);
        m3363(getMeasuredWidth(), getMeasuredHeight());
        m3364(getMeasuredWidth(), getMeasuredHeight());
        int i6 = getResources().getConfiguration().orientation;
        if (this.f4419 != i6) {
            this.f4419 = i6;
            this.f4412 = -2.1474836E9f;
        }
        if (this.f4412 == -2.1474836E9f) {
            this.f4412 = getMeasuredWidth();
            getParent();
        }
        if (this.f4431 == Integer.MIN_VALUE) {
            if (this.f4437 == null) {
                i5 = 0;
            } else {
                int iconPadding = getIconPadding();
                int intrinsicWidth = this.f4411;
                if (intrinsicWidth == 0) {
                    intrinsicWidth = this.f4437.getIntrinsicWidth();
                }
                i5 = iconPadding + intrinsicWidth;
            }
            this.f4431 = (getMeasuredWidth() - getTextLayoutWidth()) - i5;
        }
        if (this.f4410 == Integer.MIN_VALUE) {
            this.f4410 = getPaddingStart();
        }
        if (this.f4424 == Integer.MIN_VALUE) {
            this.f4424 = getPaddingEnd();
        }
        getParent();
    }

    @Override // android.widget.TextView, android.view.View
    public final void onRestoreInstanceState(Parcelable parcelable) {
        if (!(parcelable instanceof C2679)) {
            super.onRestoreInstanceState(parcelable);
            return;
        }
        C2679 c2679 = (C2679) parcelable;
        super.onRestoreInstanceState(c2679.f10655);
        setChecked(c2679.f10343);
    }

    @Override // android.widget.TextView, android.view.View
    public final Parcelable onSaveInstanceState() {
        C2679 c2679 = new C2679(super.onSaveInstanceState());
        c2679.f10343 = this.f4407;
        return c2679;
    }

    @Override // defpackage.C1855, android.widget.TextView
    public final void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        super.onTextChanged(charSequence, i, i2, i3);
        m3363(getMeasuredWidth(), getMeasuredHeight());
        m3364(getMeasuredWidth(), getMeasuredHeight());
    }

    @Override // android.view.View
    public final boolean performClick() {
        boolean z;
        if (isEnabled() && this.f4434.f6873) {
            toggle();
            z = true;
        } else {
            z = false;
        }
        boolean zPerformClick = super.performClick();
        if (z && !zPerformClick) {
            playSoundEffect(0);
        }
        return zPerformClick;
    }

    @Override // android.view.View
    public final void refreshDrawableState() {
        super.refreshDrawableState();
        if (this.f4437 != null) {
            if (this.f4437.setState(getDrawableState())) {
                invalidate();
            }
        }
    }

    public void setA11yClassName(String str) {
        this.f4413 = str;
    }

    @Override // android.view.View
    public void setBackground(Drawable drawable) {
        setBackgroundDrawable(drawable);
    }

    @Override // android.view.View
    public void setBackgroundColor(int i) {
        if (!m3370()) {
            super.setBackgroundColor(i);
            return;
        }
        C1721 c1721 = this.f4434;
        if (c1721.m4764(false) != null) {
            c1721.m4764(false).setTint(i);
        }
    }

    @Override // defpackage.C1855, android.view.View
    public void setBackgroundDrawable(Drawable drawable) {
        if (!m3370()) {
            super.setBackgroundDrawable(drawable);
            return;
        }
        if (drawable == getBackground()) {
            getBackground().setState(drawable.getState());
            return;
        }
        C1721 c1721 = this.f4434;
        c1721.f6880 = true;
        C1016 c1016 = c1721.f6882;
        c1016.setSupportBackgroundTintList(c1721.f6879);
        c1016.setSupportBackgroundTintMode(c1721.f6884);
        super.setBackgroundDrawable(drawable);
    }

    @Override // defpackage.C1855, android.view.View
    public void setBackgroundResource(int i) {
        setBackgroundDrawable(i != 0 ? ᵥˇᵛˎ.ᵶˇᵱ(getContext(), i) : null);
    }

    @Override // android.view.View
    public void setBackgroundTintList(ColorStateList colorStateList) {
        setSupportBackgroundTintList(colorStateList);
    }

    @Override // android.view.View
    public void setBackgroundTintMode(PorterDuff.Mode mode) {
        setSupportBackgroundTintMode(mode);
    }

    public void setCheckable(boolean z) {
        if (m3370()) {
            this.f4434.f6867 = z;
        }
    }

    @Override // android.widget.Checkable
    public void setChecked(boolean z) {
        setCheckedInternal(z);
    }

    @Override // android.widget.TextView
    public void setCompoundDrawablePadding(int i) {
        if (getCompoundDrawablePadding() != i) {
            this.f4412 = -2.1474836E9f;
        }
        super.setCompoundDrawablePadding(i);
    }

    public void setCornerRadius(int i) {
        if (m3370()) {
            C1721 c1721 = this.f4434;
            if (c1721.f6868 && c1721.f6886 == i) {
                return;
            }
            c1721.f6886 = i;
            c1721.f6868 = true;
            c1721.f6866 = c1721.f6866.mo5172(i);
            c1721.m4765();
        }
    }

    public void setCornerRadiusResource(int i) {
        if (m3370()) {
            setCornerRadius(getResources().getDimensionPixelSize(i));
        }
    }

    public void setCornerSpringForce(C5256 c5256) {
        C1721 c1721 = this.f4434;
        c1721.f6874 = c5256;
        if (c1721.f6866 instanceof C1930) {
            c1721.m4765();
        }
    }

    public void setDisplayedWidthDecrease(int i) {
        this.f4414 = Math.min(i, this.f4431);
        m3362();
        invalidate();
    }

    @Override // android.view.View
    public void setElevation(float f) {
        super.setElevation(f);
        if (m3370()) {
            C3347 c3347M4764 = this.f4434.m4764(false);
            C4335 c4335 = c3347M4764.f12842;
            if (c4335.f16506 != f) {
                c4335.f16506 = f;
                c3347M4764.m7683();
            }
        }
    }

    public void setIcon(Drawable drawable) {
        if (this.f4437 != drawable) {
            this.f4412 = -2.1474836E9f;
            this.f4437 = drawable;
            m3374(true);
            m3363(getMeasuredWidth(), getMeasuredHeight());
        }
    }

    public void setIconGravity(int i) {
        if (this.f4433 != i) {
            if (this.f4437 != null && this.f4430 != null && m3368()) {
                ᵕᵩʽᵲ.ᵮᵣᵗˈ("iconGravity cannot have the same alignment as secondaryIconGravity");
            } else {
                this.f4433 = i;
                m3363(getMeasuredWidth(), getMeasuredHeight());
            }
        }
    }

    public void setIconPadding(int i) {
        if (this.f4428 != i) {
            this.f4428 = i;
            setCompoundDrawablePadding(i);
        }
    }

    public void setIconResource(int i) {
        setIcon(i != 0 ? ᵥˇᵛˎ.ᵶˇᵱ(getContext(), i) : null);
    }

    public void setIconSize(int i) {
        if (i < 0) {
            ᵕᵩʽᵲ.ᵮᵣᵗˈ("iconSize cannot be less than 0");
        } else if (this.f4411 != i) {
            this.f4412 = -2.1474836E9f;
            this.f4411 = i;
            m3374(true);
            m3367(true);
        }
    }

    public void setIconTint(ColorStateList colorStateList) {
        if (this.f4423 != colorStateList) {
            this.f4423 = colorStateList;
            m3374(false);
        }
    }

    public void setIconTintMode(PorterDuff.Mode mode) {
        if (this.f4415 != mode) {
            this.f4415 = mode;
            m3374(false);
        }
    }

    public void setIconTintResource(int i) {
        setIconTint(AbstractC1630.m4515(getContext(), i));
    }

    public void setInsetBottom(int i) {
        C1721 c1721 = this.f4434;
        c1721.m4761(c1721.f6877, c1721.f6883, c1721.f6887, i);
    }

    public void setInsetLeft(int i) {
        C1721 c1721 = this.f4434;
        c1721.m4761(i, c1721.f6883, c1721.f6887, c1721.f6870);
    }

    public void setInsetRight(int i) {
        C1721 c1721 = this.f4434;
        c1721.m4761(c1721.f6877, c1721.f6883, i, c1721.f6870);
    }

    public void setInsetTop(int i) {
        C1721 c1721 = this.f4434;
        c1721.m4761(c1721.f6877, i, c1721.f6887, c1721.f6870);
    }

    public void setInternalBackground(Drawable drawable) {
        super.setBackgroundDrawable(drawable);
    }

    public void setOnPressedChangeListenerInternal(InterfaceC3871 interfaceC3871) {
    }

    public void setOpticalCenterEnabled(boolean z) {
        if (this.f4427 != z) {
            this.f4427 = z;
            int i = 1;
            C1721 c1721 = this.f4434;
            if (z) {
                ˈᵚᵰˎ r4 = new ˈᵚᵰˎ(1, this);
                c1721.f6885 = r4;
                C3347 c3347M4764 = c1721.m4764(false);
                if (c3347M4764 != null) {
                    c3347M4764.f12823 = r4;
                }
            } else {
                c1721.f6885 = null;
                C3347 c3347M47642 = c1721.m4764(false);
                if (c3347M47642 != null) {
                    c3347M47642.f12823 = null;
                }
            }
            post(new RunnableC4972(i, this));
        }
    }

    @Override // android.view.View
    public void setPressed(boolean z) {
        super.setPressed(z);
    }

    public void setRippleColor(ColorStateList colorStateList) {
        if (m3370()) {
            C1721 c1721 = this.f4434;
            C1016 c1016 = c1721.f6882;
            if (c1721.f6871 != colorStateList) {
                c1721.f6871 = colorStateList;
                if (c1016.getBackground() instanceof RippleDrawable) {
                    ((RippleDrawable) c1016.getBackground()).setColor(ᵣˉ.ˀᵭ(colorStateList));
                }
            }
        }
    }

    public void setRippleColorResource(int i) {
        if (m3370()) {
            setRippleColor(AbstractC1630.m4515(getContext(), i));
        }
    }

    public void setSecondaryIcon(Drawable drawable) {
        if (this.f4430 != drawable) {
            this.f4412 = -2.1474836E9f;
            this.f4430 = drawable;
            this.f4418 = false;
            m3367(true);
            m3364(getMeasuredWidth(), getMeasuredHeight());
        }
    }

    public void setSecondaryIconGravity(int i) {
        if (this.f4429 != i) {
            if (this.f4430 != null && this.f4437 != null && m3368()) {
                ᵕᵩʽᵲ.ᵮᵣᵗˈ("secondaryIconGravity cannot have the same alignment as iconGravity");
            } else {
                this.f4429 = i;
                m3364(getMeasuredWidth(), getMeasuredHeight());
            }
        }
    }

    public void setSecondaryIconResource(int i) {
        setSecondaryIcon(i != 0 ? ᵥˇᵛˎ.ᵶˇᵱ(getContext(), i) : null);
    }

    public void setSecondaryIconTint(ColorStateList colorStateList) {
        if (this.f4408 != colorStateList) {
            this.f4408 = colorStateList;
            m3367(false);
        }
    }

    public void setSecondaryIconTintMode(PorterDuff.Mode mode) {
        if (this.f4426 != mode) {
            this.f4426 = mode;
            m3367(false);
        }
    }

    public void setSecondaryIconTintResource(int i) {
        setSecondaryIconTint(AbstractC1630.m4515(getContext(), i));
    }

    public void setShapeAppearance(InterfaceC5120 interfaceC5120) {
        if (!m3370()) {
            ᵕᵩʽᵲ.ᵪᵹᵥᵻ("Attempted to set ShapeAppearance on a MaterialButton which has an overwritten background.");
            return;
        }
        C1721 c1721 = this.f4434;
        if (c1721.f6874 == null && interfaceC5120.mo5173()) {
            c1721.f6874 = m3371();
            if (c1721.f6866 instanceof C1930) {
                c1721.m4765();
            }
        }
        c1721.f6866 = interfaceC5120;
        c1721.m4765();
    }

    @Override // defpackage.InterfaceC0411
    public void setShapeAppearanceModel(C2140 c2140) {
        if (!m3370()) {
            ᵕᵩʽᵲ.ᵪᵹᵥᵻ("Attempted to set ShapeAppearanceModel on a MaterialButton which has an overwritten background.");
            return;
        }
        C1721 c1721 = this.f4434;
        c1721.f6866 = c2140;
        c1721.m4765();
    }

    public void setShouldDrawSurfaceColorStroke(boolean z) {
        if (m3370()) {
            C1721 c1721 = this.f4434;
            c1721.f6876 = z;
            c1721.m4763();
        }
    }

    public void setSizeChange(AbstractC3219 abstractC3219) {
    }

    public void setStrokeColor(ColorStateList colorStateList) {
        if (m3370()) {
            C1721 c1721 = this.f4434;
            if (c1721.f6875 != colorStateList) {
                c1721.f6875 = colorStateList;
                c1721.m4763();
            }
        }
    }

    public void setStrokeColorResource(int i) {
        if (m3370()) {
            setStrokeColor(AbstractC1630.m4515(getContext(), i));
        }
    }

    public void setStrokeWidth(int i) {
        if (m3370()) {
            C1721 c1721 = this.f4434;
            if (c1721.f6881 != i) {
                c1721.f6881 = i;
                c1721.m4763();
            }
        }
    }

    public void setStrokeWidthResource(int i) {
        if (m3370()) {
            setStrokeWidth(getResources().getDimensionPixelSize(i));
        }
    }

    @Override // defpackage.C1855
    public void setSupportBackgroundTintList(ColorStateList colorStateList) {
        if (!m3370()) {
            super.setSupportBackgroundTintList(colorStateList);
            return;
        }
        C1721 c1721 = this.f4434;
        if (c1721.f6879 != colorStateList) {
            c1721.f6879 = colorStateList;
            if (c1721.m4764(false) != null) {
                c1721.m4764(false).setTintList(c1721.f6879);
            }
        }
    }

    @Override // defpackage.C1855
    public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
        if (!m3370()) {
            super.setSupportBackgroundTintMode(mode);
            return;
        }
        C1721 c1721 = this.f4434;
        if (c1721.f6884 != mode) {
            c1721.f6884 = mode;
            if (c1721.m4764(false) == null || c1721.f6884 == null) {
                return;
            }
            c1721.m4764(false).setTintMode(c1721.f6884);
        }
    }

    @Override // android.widget.TextView
    public final void setText(CharSequence charSequence, TextView.BufferType bufferType) {
        this.f4412 = -2.1474836E9f;
        super.setText(charSequence, bufferType);
    }

    @Override // android.view.View
    public void setTextAlignment(int i) {
        super.setTextAlignment(i);
        m3363(getMeasuredWidth(), getMeasuredHeight());
        m3364(getMeasuredWidth(), getMeasuredHeight());
    }

    @Override // defpackage.C1855, android.widget.TextView
    public final void setTextAppearance(Context context, int i) {
        this.f4412 = -2.1474836E9f;
        super.setTextAppearance(context, i);
    }

    @Override // defpackage.C1855, android.widget.TextView
    public final void setTextSize(int i, float f) {
        this.f4412 = -2.1474836E9f;
        super.setTextSize(i, f);
    }

    public void setToggleCheckedStateOnClick(boolean z) {
        this.f4434.f6873 = z;
    }

    @Override // android.widget.TextView
    public void setWidth(int i) {
        this.f4412 = -2.1474836E9f;
        super.setWidth(i);
    }

    public void setWidthChangeDirection(EnumC4737 enumC4737) {
        if (this.f4422 != enumC4737) {
            this.f4422 = enumC4737;
        }
    }

    public void setWidthChangeMax(int i) {
        if (this.f4432 != i) {
            this.f4432 = i;
        }
    }

    @Override // android.widget.Checkable
    public final void toggle() {
        setChecked(!this.f4407);
    }

    /* JADX INFO: renamed from: ˉᵲ, reason: contains not printable characters */
    public final void m3362() {
        int i = (int) (this.f4417 - this.f4414);
        boolean z = getLayoutDirection() == 1;
        int i2 = this.f4409;
        if (z) {
            i2 = -i2;
        }
        int i3 = (i / 2) + i2;
        if (getLayoutParams() != null) {
            getLayoutParams().width = (int) (this.f4412 + i);
        }
        setPaddingRelative(this.f4410 + i3, getPaddingTop(), (this.f4424 + i) - i3, getPaddingBottom());
    }

    /* JADX INFO: renamed from: ˊᵙᵾᵲ, reason: contains not printable characters */
    public final void m3363(int i, int i2) {
        if (this.f4437 == null || getLayout() == null) {
            return;
        }
        if (m3377() || m3375()) {
            this.f4420 = 0;
            if (m3378(this.f4433)) {
                this.f4421 = 0;
                m3374(false);
                return;
            }
            int iM3380 = m3380(i, this.f4433);
            if (this.f4421 != iM3380) {
                this.f4421 = iM3380;
                m3374(false);
                return;
            }
            return;
        }
        if (m3373()) {
            this.f4421 = 0;
            if (this.f4433 == 16) {
                this.f4420 = 0;
                m3374(false);
                return;
            }
            int intrinsicHeight = this.f4411;
            if (intrinsicHeight == 0) {
                intrinsicHeight = this.f4437.getIntrinsicHeight();
            }
            int iM3376 = m3376(i2, intrinsicHeight);
            if (this.f4420 != iM3376) {
                this.f4420 = iM3376;
                m3374(false);
            }
        }
    }

    /* JADX INFO: renamed from: ˊᵨᵧ, reason: contains not printable characters */
    public final void m3364(int i, int i2) {
        if (this.f4430 == null || getLayout() == null) {
            return;
        }
        if (m3366() || m3369()) {
            this.f4425 = 0;
            if (m3378(this.f4429)) {
                this.f4435 = 0;
                m3367(false);
                return;
            }
            int iM3380 = m3380(i, this.f4429);
            if (this.f4435 != iM3380) {
                this.f4435 = iM3380;
                m3367(false);
                return;
            }
            return;
        }
        if (m3372()) {
            this.f4435 = 0;
            if (this.f4429 == 16) {
                this.f4425 = 0;
                m3367(false);
                return;
            }
            int intrinsicHeight = this.f4411;
            if (intrinsicHeight == 0) {
                intrinsicHeight = this.f4430.getIntrinsicHeight();
            }
            int iM3376 = m3376(i2, intrinsicHeight);
            if (this.f4425 != iM3376) {
                this.f4425 = iM3376;
                m3367(false);
            }
        }
    }

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public final Drawable m3365(int i) {
        if (i == 0) {
            if (this.f4430 == null || !m3366()) {
                return null;
            }
            return this.f4430;
        }
        if (i == 1) {
            if (this.f4430 == null || !m3372()) {
                return null;
            }
            return this.f4430;
        }
        if (i == 2 && this.f4430 != null && m3369()) {
            return this.f4430;
        }
        return null;
    }

    /* JADX INFO: renamed from: ˋˈ, reason: contains not printable characters */
    public final boolean m3366() {
        int i = this.f4429;
        return i == 1 || i == 2;
    }

    /* JADX INFO: renamed from: ˏːˆ, reason: contains not printable characters */
    public final void m3367(boolean z) {
        Drawable drawable = this.f4430;
        if (drawable != null) {
            Drawable drawableMutate = drawable.mutate();
            this.f4430 = drawableMutate;
            drawableMutate.setTintList(this.f4408);
            PorterDuff.Mode mode = this.f4426;
            if (mode != null) {
                this.f4430.setTintMode(mode);
            }
            int intrinsicWidth = this.f4411;
            if (intrinsicWidth == 0) {
                intrinsicWidth = this.f4430.getIntrinsicWidth();
            }
            int intrinsicHeight = this.f4411;
            if (intrinsicHeight == 0) {
                intrinsicHeight = this.f4430.getIntrinsicHeight();
            }
            Drawable drawable2 = this.f4430;
            int i = this.f4435;
            int i2 = this.f4425;
            drawable2.setBounds(i, i2, intrinsicWidth + i, intrinsicHeight + i2);
            this.f4430.setVisible(true, z);
        }
        if (this.f4430 != null && this.f4437 != null && m3368()) {
            ᵕᵩʽᵲ.ᵮᵣᵗˈ("secondaryIconGravity cannot have the same alignment as iconGravity");
            return;
        }
        if (this.f4430 == null) {
            if (this.f4418) {
                return;
            }
            if (this.f4437 != null && m3368()) {
                return;
            }
        }
        Drawable[] compoundDrawablesRelative = getCompoundDrawablesRelative();
        boolean z2 = (m3366() && compoundDrawablesRelative[0] != this.f4430) || (m3369() && compoundDrawablesRelative[2] != this.f4430) || (m3372() && compoundDrawablesRelative[1] != this.f4430);
        if (z || z2) {
            if (m3366()) {
                setCompoundDrawablesRelative(this.f4430, m3379(1), m3379(2), null);
            } else if (m3369()) {
                setCompoundDrawablesRelative(m3379(0), m3379(1), this.f4430, null);
            } else if (m3372()) {
                setCompoundDrawablesRelative(m3379(0), this.f4430, m3379(2), null);
            }
        }
    }

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final boolean m3368() {
        if (m3377() && m3366()) {
            return true;
        }
        if (m3375() && m3369()) {
            return true;
        }
        return m3373() && m3372();
    }

    /* JADX INFO: renamed from: ᵝᵶ, reason: contains not printable characters */
    public final boolean m3369() {
        int i = this.f4429;
        return i == 3 || i == 4;
    }

    /* JADX INFO: renamed from: ᵟᵹᵙ, reason: contains not printable characters */
    public final boolean m3370() {
        C1721 c1721 = this.f4434;
        return (c1721 == null || c1721.f6880) ? false : true;
    }

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public final C5256 m3371() {
        Context context = getContext();
        TypedValue typedValue = ᵶᵦ.ᵜᵪʾ(context.getTheme(), ar.tvplayer.tv.R.attr.h);
        int[] iArr = AbstractC2172.f8639;
        TypedArray typedArrayObtainStyledAttributes = typedValue == null ? context.obtainStyledAttributes(null, iArr, 0, ar.tvplayer.tv.R.style.h) : context.obtainStyledAttributes(typedValue.resourceId, iArr);
        C5256 c5256 = new C5256();
        try {
            float f = typedArrayObtainStyledAttributes.getFloat(1, Float.MIN_VALUE);
            if (f == Float.MIN_VALUE) {
                throw new IllegalArgumentException("A MaterialSpring style must have stiffness value.");
            }
            float f2 = typedArrayObtainStyledAttributes.getFloat(0, Float.MIN_VALUE);
            if (f2 == Float.MIN_VALUE) {
                throw new IllegalArgumentException("A MaterialSpring style must have a damping value.");
            }
            c5256.m10826(f);
            c5256.m10828(f2);
            return c5256;
        } finally {
            typedArrayObtainStyledAttributes.recycle();
        }
    }

    /* JADX INFO: renamed from: ᵪᵹᵥᵻ, reason: contains not printable characters */
    public final boolean m3372() {
        int i = this.f4429;
        return i == 16 || i == 32;
    }

    /* JADX INFO: renamed from: ᵮᵣᵗˈ, reason: contains not printable characters */
    public final boolean m3373() {
        int i = this.f4433;
        return i == 16 || i == 32;
    }

    /* JADX INFO: renamed from: ᵱʡˏ, reason: contains not printable characters */
    public final void m3374(boolean z) {
        Drawable drawable = this.f4437;
        if (drawable != null) {
            Drawable drawableMutate = drawable.mutate();
            this.f4437 = drawableMutate;
            drawableMutate.setTintList(this.f4423);
            PorterDuff.Mode mode = this.f4415;
            if (mode != null) {
                this.f4437.setTintMode(mode);
            }
            int intrinsicWidth = this.f4411;
            if (intrinsicWidth == 0) {
                intrinsicWidth = this.f4437.getIntrinsicWidth();
            }
            int intrinsicHeight = this.f4411;
            if (intrinsicHeight == 0) {
                intrinsicHeight = this.f4437.getIntrinsicHeight();
            }
            Drawable drawable2 = this.f4437;
            int i = this.f4421;
            int i2 = this.f4420;
            drawable2.setBounds(i, i2, intrinsicWidth + i, intrinsicHeight + i2);
            this.f4437.setVisible(true, z);
        }
        if (this.f4437 != null && this.f4430 != null && m3368()) {
            ᵕᵩʽᵲ.ᵮᵣᵗˈ("iconGravity cannot have the same alignment as secondaryIconGravity");
            return;
        }
        if (this.f4437 == null && this.f4430 != null && m3368()) {
            return;
        }
        Drawable[] compoundDrawablesRelative = getCompoundDrawablesRelative();
        boolean z2 = (m3377() && compoundDrawablesRelative[0] != this.f4437) || (m3375() && compoundDrawablesRelative[2] != this.f4437) || (m3373() && compoundDrawablesRelative[1] != this.f4437);
        if (z || z2) {
            if (m3377()) {
                setCompoundDrawablesRelative(this.f4437, m3365(1), m3365(2), null);
            } else if (m3375()) {
                setCompoundDrawablesRelative(m3365(0), m3365(1), this.f4437, null);
            } else if (m3373()) {
                setCompoundDrawablesRelative(m3365(0), this.f4437, m3365(2), null);
            }
        }
    }

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public final boolean m3375() {
        int i = this.f4433;
        return i == 3 || i == 4;
    }

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public final int m3376(int i, int i2) {
        return Math.max(0, (((((i - getTextHeight()) - getPaddingTop()) - i2) - this.f4428) - getPaddingBottom()) / 2);
    }

    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    public final boolean m3377() {
        int i = this.f4433;
        return i == 1 || i == 2;
    }

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final boolean m3378(int i) {
        Layout.Alignment actualTextAlignment = getActualTextAlignment();
        return i == 1 || i == 3 || (i == 2 && actualTextAlignment == Layout.Alignment.ALIGN_NORMAL) || (i == 4 && actualTextAlignment == Layout.Alignment.ALIGN_OPPOSITE);
    }

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public final Drawable m3379(int i) {
        if (i == 0) {
            if (this.f4437 == null || !m3377()) {
                return null;
            }
            return this.f4437;
        }
        if (i == 1) {
            if (this.f4437 == null || !m3375()) {
                return null;
            }
            return this.f4437;
        }
        if (i == 2 && this.f4437 != null && m3375()) {
            return this.f4437;
        }
        return null;
    }

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public final int m3380(int i, int i2) {
        int intrinsicWidth;
        int intrinsicWidth2;
        Drawable drawable = this.f4437;
        if (drawable != null) {
            intrinsicWidth = this.f4411;
            if (intrinsicWidth == 0) {
                intrinsicWidth = drawable.getIntrinsicWidth();
            }
        } else {
            intrinsicWidth = 0;
        }
        Drawable drawable2 = this.f4430;
        if (drawable2 != null) {
            intrinsicWidth2 = this.f4411;
            if (intrinsicWidth2 == 0) {
                intrinsicWidth2 = drawable2.getIntrinsicWidth();
            }
        } else {
            intrinsicWidth2 = 0;
        }
        int textLayoutWidth = (((((i - getTextLayoutWidth()) - getPaddingEnd()) - intrinsicWidth) - intrinsicWidth2) - this.f4428) - getPaddingStart();
        if (getActualTextAlignment() == Layout.Alignment.ALIGN_CENTER) {
            textLayoutWidth /= 2;
        }
        return (getLayoutDirection() == 1) != (i2 == 4) ? -textLayoutWidth : textLayoutWidth;
    }
}
