package androidx.appcompat.widget;

import android.R;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.Region;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.text.InputFilter;
import android.text.Layout;
import android.text.StaticLayout;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.method.TransformationMethod;
import android.util.AttributeSet;
import android.view.ActionMode;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.CompoundButton;
import defpackage.AbstractC0494;
import defpackage.AbstractC0542;
import defpackage.AbstractC1991;
import defpackage.AbstractC2335;
import defpackage.AbstractC2873;
import defpackage.AbstractC3247;
import defpackage.AbstractC5363;
import defpackage.C1104;
import defpackage.C1471;
import defpackage.C1570;
import defpackage.C1806;
import defpackage.C2536;
import defpackage.C2956;
import defpackage.C3392;
import defpackage.C3640;
import java.lang.reflect.InvocationTargetException;
import java.util.WeakHashMap;

/* loaded from: classes3.dex */
public class SwitchCompat extends CompoundButton {

    /* renamed from: ʾᵻᵭٴ, reason: contains not printable characters */
    public StaticLayout f170;

    /* renamed from: ˀˁᵨ, reason: contains not printable characters */
    public int f171;

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

    /* renamed from: ˀᵗᵩ, reason: contains not printable characters */
    public float f173;

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

    /* renamed from: ˆᵴᵜˏ, reason: contains not printable characters */
    public ObjectAnimator f175;

    /* renamed from: ˆᵼᵷˊ, reason: contains not printable characters */
    public float f176;

    /* renamed from: ˊʽˎ, reason: contains not printable characters */
    public int f177;

    /* renamed from: ˊʾˊ, reason: contains not printable characters */
    public int f178;

    /* renamed from: ˊᵸˊ, reason: contains not printable characters */
    public final int f179;

    /* renamed from: ˌᵪ, reason: contains not printable characters */
    public final int f180;

    /* renamed from: ˌᵹᵨˑ, reason: contains not printable characters */
    public final TextPaint f181;

    /* renamed from: ˎˑː, reason: contains not printable characters */
    public boolean f182;

    /* renamed from: ˎᵬˀ, reason: contains not printable characters */
    public int f183;

    /* renamed from: ˑᵝﹳᵜ, reason: contains not printable characters */
    public int f184;

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

    /* renamed from: ᐧﾞ, reason: contains not printable characters */
    public boolean f186;

    /* renamed from: ᵙᵢᵨᵳ, reason: contains not printable characters */
    public CharSequence f187;

    /* renamed from: ᵛˈᵤ, reason: contains not printable characters */
    public final VelocityTracker f188;

    /* renamed from: ᵠᵿː, reason: contains not printable characters */
    public final ColorStateList f189;

    /* renamed from: ᵡˎ, reason: contains not printable characters */
    public PorterDuff.Mode f190;

    /* renamed from: ᵡᵘˎʽ, reason: contains not printable characters */
    public boolean f191;

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

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

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

    /* renamed from: ᵣᵟᵔ, reason: contains not printable characters */
    public C3392 f195;

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

    /* renamed from: ᵤᵼˑʠ, reason: contains not printable characters */
    public final C3640 f197;

    /* renamed from: ᵥʩᵩˑ, reason: contains not printable characters */
    public final Rect f198;

    /* renamed from: ᵧـˌᵎ, reason: contains not printable characters */
    public int f199;

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

    /* renamed from: ᵫᵮʾ, reason: contains not printable characters */
    public int f201;

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

    /* renamed from: ᵳᵹᵺˋ, reason: contains not printable characters */
    public float f203;

    /* renamed from: ᵶʔᵢˊ, reason: contains not printable characters */
    public CharSequence f204;

    /* renamed from: ᵷᵱ, reason: contains not printable characters */
    public boolean f205;

    /* renamed from: ᵺʙ, reason: contains not printable characters */
    public int f206;

    /* renamed from: ᵺᵠ, reason: contains not printable characters */
    public StaticLayout f207;

    /* renamed from: ᵽʛ, reason: contains not printable characters */
    public int f208;

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public boolean f209;

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public PorterDuff.Mode f210;

    /* renamed from: ﹶـ, reason: contains not printable characters */
    public C1471 f211;

    /* renamed from: ﾞⁱ, reason: contains not printable characters */
    public CharSequence f212;

    /* renamed from: ᵲᵟ, reason: contains not printable characters */
    public static final C1806 f169 = new C1806(Float.class, "thumbPos", 11);

    /* renamed from: ᵨٴ, reason: contains not printable characters */
    public static final int[] f168 = {R.attr.state_checked};

    public SwitchCompat(Context context) {
        this(context, null);
    }

    public SwitchCompat(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, ar.tvplayer.tv.R.attr._11_res_0x7f0405fe);
    }

    public SwitchCompat(Context context, AttributeSet attributeSet, int i) throws Resources.NotFoundException {
        int resourceId;
        super(context, attributeSet, i);
        this.f194 = null;
        this.f210 = null;
        this.f209 = false;
        this.f196 = false;
        this.f172 = null;
        this.f190 = null;
        this.f185 = false;
        this.f182 = false;
        this.f188 = VelocityTracker.obtain();
        this.f205 = true;
        this.f198 = new Rect();
        AbstractC3247.m7608(getContext(), this);
        TextPaint textPaint = new TextPaint(1);
        this.f181 = textPaint;
        textPaint.density = getResources().getDisplayMetrics().density;
        int[] iArr = AbstractC0542.f2817;
        C1570 c1570M4541 = C1570.m4541(context, attributeSet, iArr, i);
        TypedArray typedArray = (TypedArray) c1570M4541.f6230;
        AbstractC2873.m7025(this, context, iArr, attributeSet, typedArray, i);
        Drawable drawableM4550 = c1570M4541.m4550(2);
        this.f200 = drawableM4550;
        if (drawableM4550 != null) {
            drawableM4550.setCallback(this);
        }
        Drawable drawableM45502 = c1570M4541.m4550(11);
        this.f193 = drawableM45502;
        if (drawableM45502 != null) {
            drawableM45502.setCallback(this);
        }
        setTextOnInternal(typedArray.getText(0));
        setTextOffInternal(typedArray.getText(1));
        this.f191 = typedArray.getBoolean(3, true);
        this.f202 = typedArray.getDimensionPixelSize(8, 0);
        this.f199 = typedArray.getDimensionPixelSize(5, 0);
        this.f206 = typedArray.getDimensionPixelSize(6, 0);
        this.f186 = typedArray.getBoolean(4, false);
        ColorStateList colorStateListM4549 = c1570M4541.m4549(9);
        if (colorStateListM4549 != null) {
            this.f194 = colorStateListM4549;
            this.f209 = true;
        }
        PorterDuff.Mode modeM5512 = AbstractC1991.m5512(typedArray.getInt(10, -1), null);
        if (this.f210 != modeM5512) {
            this.f210 = modeM5512;
            this.f196 = true;
        }
        if (this.f209 || this.f196) {
            m39();
        }
        ColorStateList colorStateListM45492 = c1570M4541.m4549(12);
        if (colorStateListM45492 != null) {
            this.f172 = colorStateListM45492;
            this.f185 = true;
        }
        PorterDuff.Mode modeM55122 = AbstractC1991.m5512(typedArray.getInt(13, -1), null);
        if (this.f190 != modeM55122) {
            this.f190 = modeM55122;
            this.f182 = true;
        }
        if (this.f185 || this.f182) {
            m40();
        }
        int resourceId2 = typedArray.getResourceId(7, 0);
        if (resourceId2 != 0) {
            TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(resourceId2, AbstractC0542.f2814);
            ColorStateList colorStateList = (!typedArrayObtainStyledAttributes.hasValue(3) || (resourceId = typedArrayObtainStyledAttributes.getResourceId(3, 0)) == 0 || (colorStateList = AbstractC5363.m10989(context, resourceId)) == null) ? typedArrayObtainStyledAttributes.getColorStateList(3) : colorStateList;
            if (colorStateList != null) {
                this.f189 = colorStateList;
            } else {
                this.f189 = getTextColors();
            }
            int dimensionPixelSize = typedArrayObtainStyledAttributes.getDimensionPixelSize(0, 0);
            if (dimensionPixelSize != 0) {
                float f = dimensionPixelSize;
                if (f != textPaint.getTextSize()) {
                    textPaint.setTextSize(f);
                    requestLayout();
                }
            }
            int i2 = typedArrayObtainStyledAttributes.getInt(1, -1);
            int i3 = typedArrayObtainStyledAttributes.getInt(2, -1);
            Typeface typeface = i2 != 1 ? i2 != 2 ? i2 != 3 ? null : Typeface.MONOSPACE : Typeface.SERIF : Typeface.SANS_SERIF;
            if (i3 > 0) {
                Typeface typefaceDefaultFromStyle = typeface == null ? Typeface.defaultFromStyle(i3) : Typeface.create(typeface, i3);
                setSwitchTypeface(typefaceDefaultFromStyle);
                int i4 = (~(typefaceDefaultFromStyle != null ? typefaceDefaultFromStyle.getStyle() : 0)) & i3;
                textPaint.setFakeBoldText((i4 & 1) != 0);
                textPaint.setTextSkewX((2 & i4) != 0 ? -0.25f : 0.0f);
            } else {
                textPaint.setFakeBoldText(false);
                textPaint.setTextSkewX(0.0f);
                setSwitchTypeface(typeface);
            }
            if (typedArrayObtainStyledAttributes.getBoolean(14, false)) {
                Context context2 = getContext();
                C3640 c3640 = new C3640();
                c3640.f13539 = context2.getResources().getConfiguration().locale;
                this.f197 = c3640;
            } else {
                this.f197 = null;
            }
            setTextOnInternal(this.f204);
            setTextOffInternal(this.f212);
            typedArrayObtainStyledAttributes.recycle();
        }
        new C2956(this).m7246(attributeSet, i);
        c1570M4541.m4542();
        ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
        this.f179 = viewConfiguration.getScaledTouchSlop();
        this.f180 = viewConfiguration.getScaledMinimumFlingVelocity();
        getEmojiTextViewHelper().m4380(attributeSet, i);
        refreshDrawableState();
        setChecked(isChecked());
    }

    private C1471 getEmojiTextViewHelper() {
        if (this.f211 == null) {
            this.f211 = new C1471(this);
        }
        return this.f211;
    }

    private boolean getTargetCheckedState() {
        return this.f203 > 0.5f;
    }

    private int getThumbOffset() {
        boolean z = AbstractC2335.f9156;
        int layoutDirection = getLayoutDirection();
        float f = this.f203;
        if (layoutDirection == 1) {
            f = 1.0f - f;
        }
        return (int) ((f * getThumbScrollRange()) + 0.5f);
    }

    private int getThumbScrollRange() {
        Drawable drawable = this.f193;
        if (drawable == null) {
            return 0;
        }
        Rect rect = this.f198;
        drawable.getPadding(rect);
        Drawable drawable2 = this.f200;
        Rect rectM5514 = drawable2 != null ? AbstractC1991.m5514(drawable2) : AbstractC1991.f8002;
        return ((((this.f192 - this.f183) - rect.left) - rect.right) - rectM5514.left) - rectM5514.right;
    }

    private void setTextOffInternal(CharSequence charSequence) {
        this.f212 = charSequence;
        TransformationMethod transformationMethod = ((ᵮʛˀ) getEmojiTextViewHelper().f5930.f13883).ᵺʙ(this.f197);
        if (transformationMethod != null) {
            charSequence = transformationMethod.getTransformation(charSequence, this);
        }
        this.f187 = charSequence;
        this.f207 = null;
        if (this.f191) {
            m41();
        }
    }

    private void setTextOnInternal(CharSequence charSequence) {
        this.f204 = charSequence;
        TransformationMethod transformationMethod = ((ᵮʛˀ) getEmojiTextViewHelper().f5930.f13883).ᵺʙ(this.f197);
        if (transformationMethod != null) {
            charSequence = transformationMethod.getTransformation(charSequence, this);
        }
        this.f174 = charSequence;
        this.f170 = null;
        if (this.f191) {
            m41();
        }
    }

    @Override // android.view.View
    public final void draw(Canvas canvas) {
        int i;
        int i2;
        int i3 = this.f201;
        int i4 = this.f208;
        int i5 = this.f171;
        int i6 = this.f178;
        int thumbOffset = getThumbOffset() + i3;
        Drawable drawable = this.f200;
        Rect rectM5514 = drawable != null ? AbstractC1991.m5514(drawable) : AbstractC1991.f8002;
        Drawable drawable2 = this.f193;
        Rect rect = this.f198;
        if (drawable2 != null) {
            drawable2.getPadding(rect);
            int i7 = rect.left;
            thumbOffset += i7;
            if (rectM5514 != null) {
                int i8 = rectM5514.left;
                if (i8 > i7) {
                    i3 += i8 - i7;
                }
                int i9 = rectM5514.top;
                int i10 = rect.top;
                i = i9 > i10 ? (i9 - i10) + i4 : i4;
                int i11 = rectM5514.right;
                int i12 = rect.right;
                if (i11 > i12) {
                    i5 -= i11 - i12;
                }
                int i13 = rectM5514.bottom;
                int i14 = rect.bottom;
                if (i13 > i14) {
                    i2 = i6 - (i13 - i14);
                }
                this.f193.setBounds(i3, i, i5, i2);
            } else {
                i = i4;
            }
            i2 = i6;
            this.f193.setBounds(i3, i, i5, i2);
        }
        Drawable drawable3 = this.f200;
        if (drawable3 != null) {
            drawable3.getPadding(rect);
            int i15 = thumbOffset - rect.left;
            int i16 = thumbOffset + this.f183 + rect.right;
            this.f200.setBounds(i15, i4, i16, i6);
            Drawable background = getBackground();
            if (background != null) {
                background.setHotspotBounds(i15, i4, i16, i6);
            }
        }
        super.draw(canvas);
    }

    @Override // android.widget.CompoundButton, android.widget.TextView, android.view.View
    public final void drawableHotspotChanged(float f, float f2) {
        super.drawableHotspotChanged(f, f2);
        Drawable drawable = this.f200;
        if (drawable != null) {
            drawable.setHotspot(f, f2);
        }
        Drawable drawable2 = this.f193;
        if (drawable2 != null) {
            drawable2.setHotspot(f, f2);
        }
    }

    @Override // android.widget.CompoundButton, android.widget.TextView, android.view.View
    public final void drawableStateChanged() {
        super.drawableStateChanged();
        int[] drawableState = getDrawableState();
        Drawable drawable = this.f200;
        boolean state = (drawable == null || !drawable.isStateful()) ? false : drawable.setState(drawableState);
        Drawable drawable2 = this.f193;
        if (drawable2 != null && drawable2.isStateful()) {
            state |= drawable2.setState(drawableState);
        }
        if (state) {
            invalidate();
        }
    }

    @Override // android.widget.CompoundButton, android.widget.TextView
    public int getCompoundPaddingLeft() {
        boolean z = AbstractC2335.f9156;
        if (getLayoutDirection() != 1) {
            return super.getCompoundPaddingLeft();
        }
        int compoundPaddingLeft = super.getCompoundPaddingLeft() + this.f192;
        return !TextUtils.isEmpty(getText()) ? compoundPaddingLeft + this.f206 : compoundPaddingLeft;
    }

    @Override // android.widget.CompoundButton, android.widget.TextView
    public int getCompoundPaddingRight() {
        boolean z = AbstractC2335.f9156;
        if (getLayoutDirection() == 1) {
            return super.getCompoundPaddingRight();
        }
        int compoundPaddingRight = super.getCompoundPaddingRight() + this.f192;
        return !TextUtils.isEmpty(getText()) ? compoundPaddingRight + this.f206 : compoundPaddingRight;
    }

    @Override // android.widget.TextView
    public ActionMode.Callback getCustomSelectionActionModeCallback() {
        return AbstractC0494.m2142(super.getCustomSelectionActionModeCallback());
    }

    public boolean getShowText() {
        return this.f191;
    }

    public boolean getSplitTrack() {
        return this.f186;
    }

    public int getSwitchMinWidth() {
        return this.f199;
    }

    public int getSwitchPadding() {
        return this.f206;
    }

    public CharSequence getTextOff() {
        return this.f212;
    }

    public CharSequence getTextOn() {
        return this.f204;
    }

    public Drawable getThumbDrawable() {
        return this.f200;
    }

    public final float getThumbPosition() {
        return this.f203;
    }

    public int getThumbTextPadding() {
        return this.f202;
    }

    public ColorStateList getThumbTintList() {
        return this.f194;
    }

    public PorterDuff.Mode getThumbTintMode() {
        return this.f210;
    }

    public Drawable getTrackDrawable() {
        return this.f193;
    }

    public ColorStateList getTrackTintList() {
        return this.f172;
    }

    public PorterDuff.Mode getTrackTintMode() {
        return this.f190;
    }

    @Override // android.widget.CompoundButton, android.widget.TextView, android.view.View
    public final void jumpDrawablesToCurrentState() {
        super.jumpDrawablesToCurrentState();
        Drawable drawable = this.f200;
        if (drawable != null) {
            drawable.jumpToCurrentState();
        }
        Drawable drawable2 = this.f193;
        if (drawable2 != null) {
            drawable2.jumpToCurrentState();
        }
        ObjectAnimator objectAnimator = this.f175;
        if (objectAnimator == null || !objectAnimator.isStarted()) {
            return;
        }
        this.f175.end();
        this.f175 = null;
    }

    @Override // android.widget.CompoundButton, android.widget.TextView, android.view.View
    public final int[] onCreateDrawableState(int i) {
        int[] iArrOnCreateDrawableState = super.onCreateDrawableState(i + 1);
        if (isChecked()) {
            View.mergeDrawableStates(iArrOnCreateDrawableState, f168);
        }
        return iArrOnCreateDrawableState;
    }

    @Override // android.widget.CompoundButton, android.widget.TextView, android.view.View
    public final void onDraw(Canvas canvas) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        int width;
        super.onDraw(canvas);
        Drawable drawable = this.f193;
        Rect rect = this.f198;
        if (drawable != null) {
            drawable.getPadding(rect);
        } else {
            rect.setEmpty();
        }
        int i = this.f208;
        int i2 = this.f178;
        int i3 = i + rect.top;
        int i4 = i2 - rect.bottom;
        Drawable drawable2 = this.f200;
        if (drawable != null) {
            if (!this.f186 || drawable2 == null) {
                drawable.draw(canvas);
            } else {
                Rect rectM5514 = AbstractC1991.m5514(drawable2);
                drawable2.copyBounds(rect);
                rect.left += rectM5514.left;
                rect.right -= rectM5514.right;
                int iSave = canvas.save();
                canvas.clipRect(rect, Region.Op.DIFFERENCE);
                drawable.draw(canvas);
                canvas.restoreToCount(iSave);
            }
        }
        int iSave2 = canvas.save();
        if (drawable2 != null) {
            drawable2.draw(canvas);
        }
        StaticLayout staticLayout = getTargetCheckedState() ? this.f170 : this.f207;
        if (staticLayout != null) {
            int[] drawableState = getDrawableState();
            TextPaint textPaint = this.f181;
            ColorStateList colorStateList = this.f189;
            if (colorStateList != null) {
                textPaint.setColor(colorStateList.getColorForState(drawableState, 0));
            }
            textPaint.drawableState = drawableState;
            if (drawable2 != null) {
                Rect bounds = drawable2.getBounds();
                width = bounds.left + bounds.right;
            } else {
                width = getWidth();
            }
            canvas.translate((width / 2) - (staticLayout.getWidth() / 2), ((i3 + i4) / 2) - (staticLayout.getHeight() / 2));
            staticLayout.draw(canvas);
        }
        canvas.restoreToCount(iSave2);
    }

    @Override // android.view.View
    public final void onInitializeAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
        super.onInitializeAccessibilityEvent(accessibilityEvent);
        accessibilityEvent.setClassName("android.widget.Switch");
    }

    @Override // android.view.View
    public final void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
        super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
        accessibilityNodeInfo.setClassName("android.widget.Switch");
        if (Build.VERSION.SDK_INT < 30) {
            CharSequence charSequence = isChecked() ? this.f204 : this.f212;
            if (TextUtils.isEmpty(charSequence)) {
                return;
            }
            CharSequence text = accessibilityNodeInfo.getText();
            if (TextUtils.isEmpty(text)) {
                accessibilityNodeInfo.setText(charSequence);
                return;
            }
            StringBuilder sb = new StringBuilder();
            sb.append(text);
            sb.append(' ');
            sb.append(charSequence);
            accessibilityNodeInfo.setText(sb);
        }
    }

    @Override // android.widget.TextView, android.view.View
    public final void onLayout(boolean z, int i, int i2, int i3, int i4) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        int iMax;
        int width;
        int paddingLeft;
        int height;
        int paddingTop;
        super.onLayout(z, i, i2, i3, i4);
        int iMax2 = 0;
        if (this.f200 != null) {
            Drawable drawable = this.f193;
            Rect rect = this.f198;
            if (drawable != null) {
                drawable.getPadding(rect);
            } else {
                rect.setEmpty();
            }
            Rect rectM5514 = AbstractC1991.m5514(this.f200);
            iMax = Math.max(0, rectM5514.left - rect.left);
            iMax2 = Math.max(0, rectM5514.right - rect.right);
        } else {
            iMax = 0;
        }
        boolean z2 = AbstractC2335.f9156;
        if (getLayoutDirection() == 1) {
            paddingLeft = getPaddingLeft() + iMax;
            width = ((this.f192 + paddingLeft) - iMax) - iMax2;
        } else {
            width = (getWidth() - getPaddingRight()) - iMax2;
            paddingLeft = (width - this.f192) + iMax + iMax2;
        }
        int gravity = getGravity() & 112;
        if (gravity == 16) {
            int height2 = ((getHeight() + getPaddingTop()) - getPaddingBottom()) / 2;
            int i5 = this.f177;
            int i6 = height2 - (i5 / 2);
            height = i5 + i6;
            paddingTop = i6;
        } else if (gravity != 80) {
            paddingTop = getPaddingTop();
            height = this.f177 + paddingTop;
        } else {
            height = getHeight() - getPaddingBottom();
            paddingTop = height - this.f177;
        }
        this.f201 = paddingLeft;
        this.f208 = paddingTop;
        this.f178 = height;
        this.f171 = width;
    }

    @Override // android.widget.TextView, android.view.View
    public final void onMeasure(int i, int i2) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        int intrinsicWidth;
        int intrinsicHeight;
        int intrinsicHeight2 = 0;
        if (this.f191) {
            StaticLayout staticLayout = this.f170;
            TextPaint textPaint = this.f181;
            if (staticLayout == null) {
                CharSequence charSequence = this.f174;
                this.f170 = new StaticLayout(charSequence, textPaint, charSequence != null ? (int) Math.ceil(Layout.getDesiredWidth(charSequence, textPaint)) : 0, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, true);
            }
            if (this.f207 == null) {
                CharSequence charSequence2 = this.f187;
                this.f207 = new StaticLayout(charSequence2, textPaint, charSequence2 != null ? (int) Math.ceil(Layout.getDesiredWidth(charSequence2, textPaint)) : 0, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, true);
            }
        }
        Drawable drawable = this.f200;
        Rect rect = this.f198;
        if (drawable != null) {
            drawable.getPadding(rect);
            intrinsicWidth = (this.f200.getIntrinsicWidth() - rect.left) - rect.right;
            intrinsicHeight = this.f200.getIntrinsicHeight();
        } else {
            intrinsicWidth = 0;
            intrinsicHeight = 0;
        }
        this.f183 = Math.max(this.f191 ? (this.f202 * 2) + Math.max(this.f170.getWidth(), this.f207.getWidth()) : 0, intrinsicWidth);
        Drawable drawable2 = this.f193;
        if (drawable2 != null) {
            drawable2.getPadding(rect);
            intrinsicHeight2 = this.f193.getIntrinsicHeight();
        } else {
            rect.setEmpty();
        }
        int iMax = rect.left;
        int iMax2 = rect.right;
        Drawable drawable3 = this.f200;
        if (drawable3 != null) {
            Rect rectM5514 = AbstractC1991.m5514(drawable3);
            iMax = Math.max(iMax, rectM5514.left);
            iMax2 = Math.max(iMax2, rectM5514.right);
        }
        boolean z = this.f205;
        int iMax3 = this.f199;
        if (z) {
            iMax3 = Math.max(iMax3, (this.f183 * 2) + iMax + iMax2);
        }
        int iMax4 = Math.max(intrinsicHeight2, intrinsicHeight);
        this.f192 = iMax3;
        this.f177 = iMax4;
        super.onMeasure(i, i2);
        if (getMeasuredHeight() < iMax4) {
            setMeasuredDimension(getMeasuredWidthAndState(), iMax4);
        }
    }

    @Override // android.view.View
    public final void onPopulateAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
        super.onPopulateAccessibilityEvent(accessibilityEvent);
        CharSequence charSequence = isChecked() ? this.f204 : this.f212;
        if (charSequence != null) {
            accessibilityEvent.getText().add(charSequence);
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:40:0x008e  */
    @Override // android.widget.TextView, android.view.View
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final boolean onTouchEvent(android.view.MotionEvent r10) throws android.content.res.Resources.NotFoundException {
        /*
            Method dump skipped, instructions count: 329
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.SwitchCompat.onTouchEvent(android.view.MotionEvent):boolean");
    }

    @Override // android.widget.TextView
    public void setAllCaps(boolean z) {
        super.setAllCaps(z);
        getEmojiTextViewHelper().m4378(z);
    }

    @Override // android.widget.CompoundButton, android.widget.Checkable
    public void setChecked(boolean z) throws Resources.NotFoundException {
        super.setChecked(z);
        boolean zIsChecked = isChecked();
        if (zIsChecked) {
            if (Build.VERSION.SDK_INT >= 30) {
                Object string = this.f204;
                if (string == null) {
                    string = getResources().getString(ar.tvplayer.tv.R.string._11_res_0x7f130007);
                }
                Object obj = string;
                WeakHashMap weakHashMap = AbstractC2873.f11133;
                new C2536(ar.tvplayer.tv.R.id._11_res_0x7f0b039e, CharSequence.class, 64, 30, 2).m9852(this, obj);
            }
        } else if (Build.VERSION.SDK_INT >= 30) {
            Object string2 = this.f212;
            if (string2 == null) {
                string2 = getResources().getString(ar.tvplayer.tv.R.string._11_res_0x7f130006);
            }
            Object obj2 = string2;
            WeakHashMap weakHashMap2 = AbstractC2873.f11133;
            new C2536(ar.tvplayer.tv.R.id._11_res_0x7f0b039e, CharSequence.class, 64, 30, 2).m9852(this, obj2);
        }
        if (getWindowToken() == null || !isLaidOut()) {
            ObjectAnimator objectAnimator = this.f175;
            if (objectAnimator != null) {
                objectAnimator.cancel();
            }
            setThumbPosition(zIsChecked ? 1.0f : 0.0f);
            return;
        }
        ObjectAnimator objectAnimatorOfFloat = ObjectAnimator.ofFloat(this, f169, zIsChecked ? 1.0f : 0.0f);
        this.f175 = objectAnimatorOfFloat;
        objectAnimatorOfFloat.setDuration(250L);
        this.f175.setAutoCancel(true);
        this.f175.start();
    }

    @Override // android.widget.TextView
    public void setCustomSelectionActionModeCallback(ActionMode.Callback callback) {
        super.setCustomSelectionActionModeCallback(AbstractC0494.m2149(callback, this));
    }

    public void setEmojiCompatEnabled(boolean z) {
        getEmojiTextViewHelper().m4381(z);
        setTextOnInternal(this.f204);
        setTextOffInternal(this.f212);
        requestLayout();
    }

    public final void setEnforceSwitchWidth(boolean z) {
        this.f205 = z;
        invalidate();
    }

    @Override // android.widget.TextView
    public void setFilters(InputFilter[] inputFilterArr) {
        super.setFilters(getEmojiTextViewHelper().m4379(inputFilterArr));
    }

    public void setShowText(boolean z) {
        if (this.f191 != z) {
            this.f191 = z;
            requestLayout();
            if (z) {
                m41();
            }
        }
    }

    public void setSplitTrack(boolean z) {
        this.f186 = z;
        invalidate();
    }

    public void setSwitchMinWidth(int i) {
        this.f199 = i;
        requestLayout();
    }

    public void setSwitchPadding(int i) {
        this.f206 = i;
        requestLayout();
    }

    public void setSwitchTypeface(Typeface typeface) {
        TextPaint textPaint = this.f181;
        if ((textPaint.getTypeface() == null || textPaint.getTypeface().equals(typeface)) && (textPaint.getTypeface() != null || typeface == null)) {
            return;
        }
        textPaint.setTypeface(typeface);
        requestLayout();
        invalidate();
    }

    public void setTextOff(CharSequence charSequence) throws Resources.NotFoundException {
        setTextOffInternal(charSequence);
        requestLayout();
        if (isChecked() || Build.VERSION.SDK_INT < 30) {
            return;
        }
        Object string = this.f212;
        if (string == null) {
            string = getResources().getString(ar.tvplayer.tv.R.string._11_res_0x7f130006);
        }
        WeakHashMap weakHashMap = AbstractC2873.f11133;
        new C2536(ar.tvplayer.tv.R.id._11_res_0x7f0b039e, CharSequence.class, 64, 30, 2).m9852(this, string);
    }

    public void setTextOn(CharSequence charSequence) throws Resources.NotFoundException {
        setTextOnInternal(charSequence);
        requestLayout();
        if (!isChecked() || Build.VERSION.SDK_INT < 30) {
            return;
        }
        Object string = this.f204;
        if (string == null) {
            string = getResources().getString(ar.tvplayer.tv.R.string._11_res_0x7f130007);
        }
        WeakHashMap weakHashMap = AbstractC2873.f11133;
        new C2536(ar.tvplayer.tv.R.id._11_res_0x7f0b039e, CharSequence.class, 64, 30, 2).m9852(this, string);
    }

    public void setThumbDrawable(Drawable drawable) {
        Drawable drawable2 = this.f200;
        if (drawable2 != null) {
            drawable2.setCallback(null);
        }
        this.f200 = drawable;
        if (drawable != null) {
            drawable.setCallback(this);
        }
        requestLayout();
    }

    public void setThumbPosition(float f) {
        this.f203 = f;
        invalidate();
    }

    public void setThumbResource(int i) {
        setThumbDrawable(ᵕˏᵛ.ˑᵥˁ(getContext(), i));
    }

    public void setThumbTextPadding(int i) {
        this.f202 = i;
        requestLayout();
    }

    public void setThumbTintList(ColorStateList colorStateList) {
        this.f194 = colorStateList;
        this.f209 = true;
        m39();
    }

    public void setThumbTintMode(PorterDuff.Mode mode) {
        this.f210 = mode;
        this.f196 = true;
        m39();
    }

    public void setTrackDrawable(Drawable drawable) {
        Drawable drawable2 = this.f193;
        if (drawable2 != null) {
            drawable2.setCallback(null);
        }
        this.f193 = drawable;
        if (drawable != null) {
            drawable.setCallback(this);
        }
        requestLayout();
    }

    public void setTrackResource(int i) {
        setTrackDrawable(ᵕˏᵛ.ˑᵥˁ(getContext(), i));
    }

    public void setTrackTintList(ColorStateList colorStateList) {
        this.f172 = colorStateList;
        this.f185 = true;
        m40();
    }

    public void setTrackTintMode(PorterDuff.Mode mode) {
        this.f190 = mode;
        this.f182 = true;
        m40();
    }

    @Override // android.widget.CompoundButton, android.widget.Checkable
    public final void toggle() throws Resources.NotFoundException {
        setChecked(!isChecked());
    }

    @Override // android.widget.CompoundButton, android.widget.TextView, android.view.View
    public final boolean verifyDrawable(Drawable drawable) {
        return super.verifyDrawable(drawable) || drawable == this.f200 || drawable == this.f193;
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final void m38() {
        setTextOnInternal(this.f204);
        setTextOffInternal(this.f212);
        requestLayout();
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final void m39() {
        Drawable drawable = this.f200;
        if (drawable != null) {
            if (this.f209 || this.f196) {
                Drawable drawableMutate = drawable.mutate();
                this.f200 = drawableMutate;
                if (this.f209) {
                    drawableMutate.setTintList(this.f194);
                }
                if (this.f196) {
                    this.f200.setTintMode(this.f210);
                }
                if (this.f200.isStateful()) {
                    this.f200.setState(getDrawableState());
                }
            }
        }
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final void m40() {
        Drawable drawable = this.f193;
        if (drawable != null) {
            if (this.f185 || this.f182) {
                Drawable drawableMutate = drawable.mutate();
                this.f193 = drawableMutate;
                if (this.f185) {
                    drawableMutate.setTintList(this.f172);
                }
                if (this.f182) {
                    this.f193.setTintMode(this.f190);
                }
                if (this.f193.isStateful()) {
                    this.f193.setState(getDrawableState());
                }
            }
        }
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final void m41() {
        if (this.f195 == null && ((ᵮʛˀ) this.f211.f5930.f13883).ˌʾˀ() && C1104.f4741 != null) {
            C1104 c1104M3504 = C1104.m3504();
            int iM3508 = c1104M3504.m3508();
            if (iM3508 == 3 || iM3508 == 0) {
                C3392 c3392 = new C3392(this);
                this.f195 = c3392;
                c1104M3504.m3506(c3392);
            }
        }
    }
}
