package androidx.appcompat.widget;

import X.4Qr;
import X.8jA;
import X.AnonymousClass04M;
import X.AnonymousClass04S;
import X.AnonymousClass07K;
import X.AnonymousClass07N;
import X.C022108l;
import X.C022808s;
import X.Jt2;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.view.ActionMode;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.widget.TextView;
import com.bytedance.covode.number.Covode;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

public class AppCompatTextView extends TextView implements C022108l {
    public final AnonymousClass04M LIZ;
    public final v LIZIZ;
    public Future<AnonymousClass07N> LIZJ;

    static {
        Covode.recordClassIndex(421);
    }

    public CharSequence getText() {
        LIZ();
        return super.getText();
    }

    public AnonymousClass07K getTextMetricsParamsCompat() {
        return C022808s.LIZIZ(this);
    }

    public int getFirstBaselineToTopHeight() {
        return getPaddingTop() - getPaint().getFontMetricsInt().top;
    }

    public int getLastBaselineToBottomHeight() {
        return getPaddingBottom() + getPaint().getFontMetricsInt().bottom;
    }

    public ColorStateList getSupportBackgroundTintList() {
        AnonymousClass04M r0 = this.LIZ;
        if (r0 != null) {
            return r0.LIZIZ();
        }
        return null;
    }

    public PorterDuff.Mode getSupportBackgroundTintMode() {
        AnonymousClass04M r0 = this.LIZ;
        if (r0 != null) {
            return r0.LIZJ();
        }
        return null;
    }

    private void LIZ() {
        Future<AnonymousClass07N> future = this.LIZJ;
        if (future != null) {
            try {
                this.LIZJ = null;
                C022808s.LIZ((TextView) this, future.get());
            } catch (InterruptedException | ExecutionException unused) {
            }
        }
    }

    public void drawableStateChanged() {
        super.drawableStateChanged();
        AnonymousClass04M r0 = this.LIZ;
        if (r0 != null) {
            r0.LIZLLL();
        }
        v vVar = this.LIZIZ;
        if (vVar != null) {
            vVar.LIZ();
        }
    }

    public int getAutoSizeMaxTextSize() {
        if (C022108l.LIZLLL) {
            return super.getAutoSizeMaxTextSize();
        }
        v vVar = this.LIZIZ;
        if (vVar != null) {
            return Math.round(vVar.LIZ.LIZLLL);
        }
        return -1;
    }

    public int getAutoSizeMinTextSize() {
        if (C022108l.LIZLLL) {
            return super.getAutoSizeMinTextSize();
        }
        v vVar = this.LIZIZ;
        if (vVar != null) {
            return Math.round(vVar.LIZ.LIZJ);
        }
        return -1;
    }

    public int getAutoSizeStepGranularity() {
        if (C022108l.LIZLLL) {
            return super.getAutoSizeStepGranularity();
        }
        v vVar = this.LIZIZ;
        if (vVar != null) {
            return Math.round(vVar.LIZ.LIZIZ);
        }
        return -1;
    }

    public int[] getAutoSizeTextAvailableSizes() {
        if (C022108l.LIZLLL) {
            return super.getAutoSizeTextAvailableSizes();
        }
        v vVar = this.LIZIZ;
        if (vVar != null) {
            return vVar.LIZ.LJ;
        }
        return new int[0];
    }

    public int getAutoSizeTextType() {
        if (!C022108l.LIZLLL) {
            v vVar = this.LIZIZ;
            if (vVar != null) {
                return vVar.LIZ.LIZ;
            }
            return 0;
        } else if (super.getAutoSizeTextType() == 1) {
            return 1;
        } else {
            return 0;
        }
    }

    public void setLineHeight(int i) {
        C022808s.LIZLLL(this, i);
    }

    public void setPrecomputedText(AnonymousClass07N r1) {
        C022808s.LIZ((TextView) this, r1);
    }

    public AppCompatTextView(Context context) {
        this(context, (AttributeSet) null);
    }

    public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
        InputConnection onCreateInputConnection = super.onCreateInputConnection(editorInfo);
        AnonymousClass04S.LIZ(onCreateInputConnection, editorInfo, this);
        return onCreateInputConnection;
    }

    public void setCustomSelectionActionModeCallback(ActionMode.Callback callback) {
        super.setCustomSelectionActionModeCallback(C022808s.LIZ((TextView) this, callback));
    }

    public void setSupportBackgroundTintList(ColorStateList colorStateList) {
        AnonymousClass04M r0 = this.LIZ;
        if (r0 != null) {
            r0.LIZ(colorStateList);
        }
    }

    public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
        AnonymousClass04M r0 = this.LIZ;
        if (r0 != null) {
            r0.LIZ(mode);
        }
    }

    public void setTextFuture(Future<AnonymousClass07N> future) {
        this.LIZJ = future;
        requestLayout();
    }

    public void setAutoSizeTextTypeWithDefaults(int i) {
        if (C022108l.LIZLLL) {
            super.setAutoSizeTextTypeWithDefaults(i);
            return;
        }
        v vVar = this.LIZIZ;
        if (vVar != null) {
            vVar.LIZ(i);
        }
    }

    public void setBackgroundDrawable(Drawable drawable) {
        super.setBackgroundDrawable(drawable);
        AnonymousClass04M r0 = this.LIZ;
        if (r0 != null) {
            r0.LIZ();
        }
    }

    public void setBackgroundResource(int i) {
        super.setBackgroundResource(i);
        AnonymousClass04M r0 = this.LIZ;
        if (r0 != null) {
            r0.LIZ(i);
        }
    }

    public void setFirstBaselineToTopHeight(int i) {
        if (Build.VERSION.SDK_INT >= 28) {
            super.setFirstBaselineToTopHeight(i);
        } else {
            C022808s.LIZIZ(this, i);
        }
    }

    public void setLastBaselineToBottomHeight(int i) {
        if (Build.VERSION.SDK_INT >= 28) {
            super.setLastBaselineToBottomHeight(i);
        } else {
            C022808s.LIZJ(this, i);
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:30:0x005d  */
    /* JADX WARNING: Removed duplicated region for block: B:9:0x0018  */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public void setTextMetricsParamsCompat(X.AnonymousClass07K r4) {
        /*
            r3 = this;
            android.text.TextDirectionHeuristic r1 = r4.LIZIZ
            android.text.TextDirectionHeuristic r0 = android.text.TextDirectionHeuristics.FIRSTSTRONG_RTL
            if (r1 == r0) goto L_0x005b
            android.text.TextDirectionHeuristic r0 = android.text.TextDirectionHeuristics.FIRSTSTRONG_LTR
            if (r1 == r0) goto L_0x005b
            android.text.TextDirectionHeuristic r0 = android.text.TextDirectionHeuristics.ANYRTL_LTR
            if (r1 != r0) goto L_0x003d
            r0 = 2
        L_0x000f:
            r3.setTextDirection(r0)
            int r1 = android.os.Build.VERSION.SDK_INT
            r0 = 23
            if (r1 >= r0) goto L_0x005d
            android.text.TextPaint r0 = r4.LIZ
            float r2 = r0.getTextScaleX()
            android.text.TextPaint r1 = r3.getPaint()
            android.text.TextPaint r0 = r4.LIZ
            r1.set(r0)
            float r0 = r3.getTextScaleX()
            int r0 = (r2 > r0 ? 1 : (r2 == r0 ? 0 : -1))
            if (r0 != 0) goto L_0x0039
            r0 = 1073741824(0x40000000, float:2.0)
            float r1 = r2 / r0
            r0 = 1065353216(0x3f800000, float:1.0)
            float r1 = r1 + r0
            r3.setTextScaleX(r1)
        L_0x0039:
            r3.setTextScaleX(r2)
            return
        L_0x003d:
            android.text.TextDirectionHeuristic r0 = android.text.TextDirectionHeuristics.LTR
            if (r1 != r0) goto L_0x0043
            r0 = 3
            goto L_0x000f
        L_0x0043:
            android.text.TextDirectionHeuristic r0 = android.text.TextDirectionHeuristics.RTL
            if (r1 != r0) goto L_0x0049
            r0 = 4
            goto L_0x000f
        L_0x0049:
            android.text.TextDirectionHeuristic r0 = android.text.TextDirectionHeuristics.LOCALE
            if (r1 != r0) goto L_0x004f
            r0 = 5
            goto L_0x000f
        L_0x004f:
            android.text.TextDirectionHeuristic r0 = android.text.TextDirectionHeuristics.FIRSTSTRONG_LTR
            if (r1 != r0) goto L_0x0055
            r0 = 6
            goto L_0x000f
        L_0x0055:
            android.text.TextDirectionHeuristic r0 = android.text.TextDirectionHeuristics.FIRSTSTRONG_RTL
            if (r1 != r0) goto L_0x005b
            r0 = 7
            goto L_0x000f
        L_0x005b:
            r0 = 1
            goto L_0x000f
        L_0x005d:
            android.text.TextPaint r1 = r3.getPaint()
            android.text.TextPaint r0 = r4.LIZ
            r1.set(r0)
            int r0 = r4.LIZJ
            r3.setBreakStrategy(r0)
            int r0 = r4.LIZLLL
            r3.setHyphenationFrequency(r0)
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.AppCompatTextView.setTextMetricsParamsCompat(X.07K):void");
    }

    private void LIZ(int i, int i2) {
        LIZ();
        super.onMeasure(i, i2);
    }

    public AppCompatTextView(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, 16842884);
    }

    public void setAutoSizeTextTypeUniformWithPresetSizes(int[] iArr, int i) {
        if (C022108l.LIZLLL) {
            super.setAutoSizeTextTypeUniformWithPresetSizes(iArr, i);
            return;
        }
        v vVar = this.LIZIZ;
        if (vVar != null) {
            vVar.LIZ(iArr, i);
        }
    }

    public void setTextAppearance(Context context, int i) {
        super.setTextAppearance(context, i);
        v vVar = this.LIZIZ;
        if (vVar != null) {
            vVar.LIZ(context, i);
        }
    }

    public void setTextSize(int i, float f) {
        if (C022108l.LIZLLL) {
            super.setTextSize(i, f);
            return;
        }
        v vVar = this.LIZIZ;
        if (vVar != null) {
            vVar.LIZ(i, f);
        }
    }

    public void onMeasure(int i, int i2) {
        int LIZ2 = Jt2.LIZIZ.LIZ();
        if (LIZ2 < 0) {
            LIZ(i, i2);
            return;
        }
        long currentTimeMillis = System.currentTimeMillis();
        LIZ(i, i2);
        long currentTimeMillis2 = System.currentTimeMillis() - currentTimeMillis;
        if (currentTimeMillis2 > ((long) LIZ2)) {
            String str = "TextView.onMeasure;timeout, textView=" + 4Qr.LIZ(this) + ", duration=" + ((currentTimeMillis2 / 1000) * 1000);
            System.err.println(str);
            8jA.LIZ("core_java_custom_exception_monitor", new Throwable(), str);
        }
    }

    public void setText(CharSequence charSequence, TextView.BufferType bufferType) {
        int LIZ2 = Jt2.LIZIZ.LIZ();
        if (LIZ2 < 0) {
            super.setText(charSequence, bufferType);
            return;
        }
        long currentTimeMillis = System.currentTimeMillis();
        super.setText(charSequence, bufferType);
        long currentTimeMillis2 = System.currentTimeMillis() - currentTimeMillis;
        if (currentTimeMillis2 > ((long) LIZ2)) {
            String str = "TextView.setText;timeout, textView=" + 4Qr.LIZ(this) + ", duration=" + ((currentTimeMillis2 / 1000) * 1000);
            System.err.println(str);
            8jA.LIZ("core_java_custom_exception_monitor", new Throwable(), str);
        }
    }

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public AppCompatTextView(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        am.LIZ(context);
        AnonymousClass04M r0 = new AnonymousClass04M(this);
        this.LIZ = r0;
        r0.LIZ(attributeSet, i);
        v vVar = new v(this);
        this.LIZIZ = vVar;
        vVar.LIZ(attributeSet, i);
        vVar.LIZ();
    }

    public void setAutoSizeTextTypeUniformWithConfiguration(int i, int i2, int i3, int i4) {
        if (C022108l.LIZLLL) {
            super.setAutoSizeTextTypeUniformWithConfiguration(i, i2, i3, i4);
            return;
        }
        v vVar = this.LIZIZ;
        if (vVar != null) {
            vVar.LIZ(i, i2, i3, i4);
        }
    }

    public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        super.onTextChanged(charSequence, i, i2, i3);
        if (this.LIZIZ != null && !C022108l.LIZLLL && this.LIZIZ.LIZ.LIZIZ()) {
            this.LIZIZ.LIZ.LIZ();
        }
    }

    public void onLayout(boolean z, int i, int i2, int i3, int i4) {
        super.onLayout(z, i, i2, i3, i4);
        v vVar = this.LIZIZ;
        if (vVar != null) {
            vVar.LIZIZ();
        }
    }
}
