package n;

import N1.C0198b;
import a.AbstractC0386a;
import android.R;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.text.InputFilter;
import android.text.TextDirectionHeuristic;
import android.text.TextDirectionHeuristics;
import android.util.AttributeSet;
import android.view.ActionMode;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.view.textclassifier.TextClassifier;
import android.widget.TextView;
import com.google.android.gms.internal.measurement.X1;
import e0.C0853a;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import l6.C1139a;

/* JADX INFO: renamed from: n.H, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public class C1190H extends TextView implements P.l {

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public final C0198b f14731q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public final C1187E f14732r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final C0853a f14733s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public C1233s f14734t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public boolean f14735u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public C1139a f14736v;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public Future f14737w;

    public C1190H(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, R.attr.textViewStyle);
    }

    private C1233s getEmojiTextViewHelper() {
        if (this.f14734t == null) {
            this.f14734t = new C1233s(this);
        }
        return this.f14734t;
    }

    @Override // android.widget.TextView, android.view.View
    public final void drawableStateChanged() {
        super.drawableStateChanged();
        C0198b c0198b = this.f14731q;
        if (c0198b != null) {
            c0198b.b();
        }
        C1187E c1187e = this.f14732r;
        if (c1187e != null) {
            c1187e.b();
        }
    }

    public final void f() {
        Future future = this.f14737w;
        if (future == null) {
            return;
        }
        try {
            this.f14737w = null;
            if (future.get() != null) {
                throw new ClassCastException();
            }
            if (Build.VERSION.SDK_INT >= 29) {
                throw null;
            }
            W3.b.n(this);
            throw null;
        } catch (InterruptedException | ExecutionException unused) {
        }
    }

    @Override // android.widget.TextView
    public int getAutoSizeMaxTextSize() {
        if (X0.f14804a) {
            return super.getAutoSizeMaxTextSize();
        }
        C1187E c1187e = this.f14732r;
        if (c1187e != null) {
            return Math.round(c1187e.i.f14753e);
        }
        return -1;
    }

    @Override // android.widget.TextView
    public int getAutoSizeMinTextSize() {
        if (X0.f14804a) {
            return super.getAutoSizeMinTextSize();
        }
        C1187E c1187e = this.f14732r;
        if (c1187e != null) {
            return Math.round(c1187e.i.f14752d);
        }
        return -1;
    }

    @Override // android.widget.TextView
    public int getAutoSizeStepGranularity() {
        if (X0.f14804a) {
            return super.getAutoSizeStepGranularity();
        }
        C1187E c1187e = this.f14732r;
        if (c1187e != null) {
            return Math.round(c1187e.i.f14751c);
        }
        return -1;
    }

    @Override // android.widget.TextView
    public int[] getAutoSizeTextAvailableSizes() {
        if (X0.f14804a) {
            return super.getAutoSizeTextAvailableSizes();
        }
        C1187E c1187e = this.f14732r;
        return c1187e != null ? c1187e.i.f14754f : new int[0];
    }

    @Override // android.widget.TextView
    @SuppressLint({"WrongConstant"})
    public int getAutoSizeTextType() {
        if (X0.f14804a) {
            return super.getAutoSizeTextType() == 1 ? 1 : 0;
        }
        C1187E c1187e = this.f14732r;
        if (c1187e != null) {
            return c1187e.i.f14749a;
        }
        return 0;
    }

    @Override // android.widget.TextView
    public ActionMode.Callback getCustomSelectionActionModeCallback() {
        return W3.b.z(super.getCustomSelectionActionModeCallback());
    }

    @Override // android.widget.TextView
    public int getFirstBaselineToTopHeight() {
        return getPaddingTop() - getPaint().getFontMetricsInt().top;
    }

    @Override // android.widget.TextView
    public int getLastBaselineToBottomHeight() {
        return getPaddingBottom() + getPaint().getFontMetricsInt().bottom;
    }

    public InterfaceC1188F getSuperCaller() {
        if (this.f14736v == null) {
            int i = Build.VERSION.SDK_INT;
            if (i >= 28) {
                this.f14736v = new C1189G(this);
            } else if (i >= 26) {
                this.f14736v = new C1139a(this);
            }
        }
        return this.f14736v;
    }

    public ColorStateList getSupportBackgroundTintList() {
        C0198b c0198b = this.f14731q;
        if (c0198b != null) {
            return c0198b.k();
        }
        return null;
    }

    public PorterDuff.Mode getSupportBackgroundTintMode() {
        C0198b c0198b = this.f14731q;
        if (c0198b != null) {
            return c0198b.l();
        }
        return null;
    }

    public ColorStateList getSupportCompoundDrawablesTintList() {
        k7.i iVar = this.f14732r.f14698h;
        if (iVar != null) {
            return (ColorStateList) iVar.f14082c;
        }
        return null;
    }

    public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
        k7.i iVar = this.f14732r.f14698h;
        if (iVar != null) {
            return (PorterDuff.Mode) iVar.f14083d;
        }
        return null;
    }

    @Override // android.widget.TextView
    public CharSequence getText() {
        f();
        return super.getText();
    }

    @Override // android.widget.TextView
    public TextClassifier getTextClassifier() {
        C0853a c0853a;
        if (Build.VERSION.SDK_INT >= 28 || (c0853a = this.f14733s) == null) {
            return super.getTextClassifier();
        }
        TextClassifier textClassifier = (TextClassifier) c0853a.f12398s;
        return textClassifier == null ? AbstractC1243x.a((TextView) c0853a.f12397r) : textClassifier;
    }

    public K.d getTextMetricsParamsCompat() {
        return W3.b.n(this);
    }

    @Override // android.widget.TextView, android.view.View
    public final InputConnection onCreateInputConnection(EditorInfo editorInfo) {
        InputConnection inputConnectionOnCreateInputConnection = super.onCreateInputConnection(editorInfo);
        this.f14732r.getClass();
        C1187E.f(editorInfo, inputConnectionOnCreateInputConnection, this);
        X1.x(editorInfo, inputConnectionOnCreateInputConnection, this);
        return inputConnectionOnCreateInputConnection;
    }

    @Override // android.widget.TextView, android.view.View
    public final void onLayout(boolean z8, int i, int i5, int i8, int i9) {
        super.onLayout(z8, i, i5, i8, i9);
        C1187E c1187e = this.f14732r;
        if (c1187e == null || X0.f14804a) {
            return;
        }
        c1187e.i.a();
    }

    @Override // android.widget.TextView, android.view.View
    public void onMeasure(int i, int i5) {
        f();
        super.onMeasure(i, i5);
    }

    @Override // android.widget.TextView
    public final void onTextChanged(CharSequence charSequence, int i, int i5, int i8) {
        super.onTextChanged(charSequence, i, i5, i8);
        C1187E c1187e = this.f14732r;
        if (c1187e == null || X0.f14804a) {
            return;
        }
        C1197O c1197o = c1187e.i;
        if (c1197o.f()) {
            c1197o.a();
        }
    }

    @Override // android.widget.TextView
    public void setAllCaps(boolean z8) {
        super.setAllCaps(z8);
        ((X1) getEmojiTextViewHelper().f14929b.f11784r).I(z8);
    }

    @Override // android.widget.TextView
    public final void setAutoSizeTextTypeUniformWithConfiguration(int i, int i5, int i8, int i9) {
        if (X0.f14804a) {
            super.setAutoSizeTextTypeUniformWithConfiguration(i, i5, i8, i9);
            return;
        }
        C1187E c1187e = this.f14732r;
        if (c1187e != null) {
            c1187e.g(i, i5, i8, i9);
        }
    }

    @Override // android.widget.TextView
    public final void setAutoSizeTextTypeUniformWithPresetSizes(int[] iArr, int i) {
        if (X0.f14804a) {
            super.setAutoSizeTextTypeUniformWithPresetSizes(iArr, i);
            return;
        }
        C1187E c1187e = this.f14732r;
        if (c1187e != null) {
            c1187e.h(iArr, i);
        }
    }

    @Override // android.widget.TextView
    public void setAutoSizeTextTypeWithDefaults(int i) {
        if (X0.f14804a) {
            super.setAutoSizeTextTypeWithDefaults(i);
            return;
        }
        C1187E c1187e = this.f14732r;
        if (c1187e != null) {
            c1187e.i(i);
        }
    }

    @Override // android.view.View
    public void setBackgroundDrawable(Drawable drawable) {
        super.setBackgroundDrawable(drawable);
        C0198b c0198b = this.f14731q;
        if (c0198b != null) {
            c0198b.p();
        }
    }

    @Override // android.view.View
    public void setBackgroundResource(int i) {
        super.setBackgroundResource(i);
        C0198b c0198b = this.f14731q;
        if (c0198b != null) {
            c0198b.q(i);
        }
    }

    @Override // android.widget.TextView
    public final void setCompoundDrawables(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
        super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
        C1187E c1187e = this.f14732r;
        if (c1187e != null) {
            c1187e.b();
        }
    }

    @Override // android.widget.TextView
    public final void setCompoundDrawablesRelative(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
        super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
        C1187E c1187e = this.f14732r;
        if (c1187e != null) {
            c1187e.b();
        }
    }

    @Override // android.widget.TextView
    public final void setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
        super.setCompoundDrawablesRelativeWithIntrinsicBounds(drawable, drawable2, drawable3, drawable4);
        C1187E c1187e = this.f14732r;
        if (c1187e != null) {
            c1187e.b();
        }
    }

    @Override // android.widget.TextView
    public final void setCompoundDrawablesWithIntrinsicBounds(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
        super.setCompoundDrawablesWithIntrinsicBounds(drawable, drawable2, drawable3, drawable4);
        C1187E c1187e = this.f14732r;
        if (c1187e != null) {
            c1187e.b();
        }
    }

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

    public void setEmojiCompatEnabled(boolean z8) {
        ((X1) getEmojiTextViewHelper().f14929b.f11784r).J(z8);
    }

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

    @Override // android.widget.TextView
    public void setFirstBaselineToTopHeight(int i) {
        if (Build.VERSION.SDK_INT >= 28) {
            getSuperCaller().i(i);
        } else {
            W3.b.t(this, i);
        }
    }

    @Override // android.widget.TextView
    public void setLastBaselineToBottomHeight(int i) {
        if (Build.VERSION.SDK_INT >= 28) {
            getSuperCaller().c(i);
        } else {
            W3.b.u(this, i);
        }
    }

    @Override // android.widget.TextView
    public void setLineHeight(int i) {
        AbstractC0386a.i(i);
        if (i != getPaint().getFontMetricsInt(null)) {
            setLineSpacing(i - r0, 1.0f);
        }
    }

    public void setPrecomputedText(K.e eVar) {
        if (Build.VERSION.SDK_INT >= 29) {
            throw null;
        }
        W3.b.n(this);
        throw null;
    }

    public void setSupportBackgroundTintList(ColorStateList colorStateList) {
        C0198b c0198b = this.f14731q;
        if (c0198b != null) {
            c0198b.v(colorStateList);
        }
    }

    public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
        C0198b c0198b = this.f14731q;
        if (c0198b != null) {
            c0198b.w(mode);
        }
    }

    @Override // P.l
    public void setSupportCompoundDrawablesTintList(ColorStateList colorStateList) {
        C1187E c1187e = this.f14732r;
        c1187e.j(colorStateList);
        c1187e.b();
    }

    @Override // P.l
    public void setSupportCompoundDrawablesTintMode(PorterDuff.Mode mode) {
        C1187E c1187e = this.f14732r;
        c1187e.k(mode);
        c1187e.b();
    }

    @Override // android.widget.TextView
    public void setTextAppearance(Context context, int i) {
        super.setTextAppearance(context, i);
        C1187E c1187e = this.f14732r;
        if (c1187e != null) {
            c1187e.e(context, i);
        }
    }

    @Override // android.widget.TextView
    public void setTextClassifier(TextClassifier textClassifier) {
        C0853a c0853a;
        if (Build.VERSION.SDK_INT >= 28 || (c0853a = this.f14733s) == null) {
            super.setTextClassifier(textClassifier);
        } else {
            c0853a.f12398s = textClassifier;
        }
    }

    public void setTextFuture(Future<K.e> future) {
        this.f14737w = future;
        if (future != null) {
            requestLayout();
        }
    }

    public void setTextMetricsParamsCompat(K.d dVar) {
        TextDirectionHeuristic textDirectionHeuristic;
        TextDirectionHeuristic textDirectionHeuristic2 = dVar.f3519b;
        TextDirectionHeuristic textDirectionHeuristic3 = TextDirectionHeuristics.FIRSTSTRONG_RTL;
        int i = 1;
        if (textDirectionHeuristic2 != textDirectionHeuristic3 && textDirectionHeuristic2 != (textDirectionHeuristic = TextDirectionHeuristics.FIRSTSTRONG_LTR)) {
            if (textDirectionHeuristic2 == TextDirectionHeuristics.ANYRTL_LTR) {
                i = 2;
            } else if (textDirectionHeuristic2 == TextDirectionHeuristics.LTR) {
                i = 3;
            } else if (textDirectionHeuristic2 == TextDirectionHeuristics.RTL) {
                i = 4;
            } else if (textDirectionHeuristic2 == TextDirectionHeuristics.LOCALE) {
                i = 5;
            } else if (textDirectionHeuristic2 == textDirectionHeuristic) {
                i = 6;
            } else if (textDirectionHeuristic2 == textDirectionHeuristic3) {
                i = 7;
            }
        }
        setTextDirection(i);
        getPaint().set(dVar.f3518a);
        setBreakStrategy(dVar.f3520c);
        setHyphenationFrequency(dVar.f3521d);
    }

    @Override // android.widget.TextView
    public final void setTextSize(int i, float f3) {
        boolean z8 = X0.f14804a;
        if (z8) {
            super.setTextSize(i, f3);
            return;
        }
        C1187E c1187e = this.f14732r;
        if (c1187e == null || z8) {
            return;
        }
        C1197O c1197o = c1187e.i;
        if (c1197o.f()) {
            return;
        }
        c1197o.g(i, f3);
    }

    @Override // android.widget.TextView
    public final void setTypeface(Typeface typeface, int i) {
        Typeface typefaceCreate;
        if (this.f14735u) {
            return;
        }
        if (typeface == null || i <= 0) {
            typefaceCreate = null;
        } else {
            Context context = getContext();
            U2.a aVar = F.e.f2236a;
            if (context == null) {
                throw new IllegalArgumentException("Context cannot be null");
            }
            typefaceCreate = Typeface.create(typeface, i);
        }
        this.f14735u = true;
        if (typefaceCreate != null) {
            typeface = typefaceCreate;
        }
        try {
            super.setTypeface(typeface, i);
        } finally {
            this.f14735u = false;
        }
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C1190H(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        H0.a(context);
        this.f14735u = false;
        this.f14736v = null;
        G0.a(this, getContext());
        C0198b c0198b = new C0198b(this);
        this.f14731q = c0198b;
        c0198b.n(attributeSet, i);
        C1187E c1187e = new C1187E(this);
        this.f14732r = c1187e;
        c1187e.d(attributeSet, i);
        c1187e.b();
        C0853a c0853a = new C0853a(15, false);
        c0853a.f12397r = this;
        this.f14733s = c0853a;
        getEmojiTextViewHelper().a(attributeSet, i);
    }

    @Override // android.widget.TextView
    public final void setCompoundDrawablesRelativeWithIntrinsicBounds(int i, int i5, int i8, int i9) {
        Context context = getContext();
        setCompoundDrawablesRelativeWithIntrinsicBounds(i != 0 ? android.support.v4.media.session.a.l(context, i) : null, i5 != 0 ? android.support.v4.media.session.a.l(context, i5) : null, i8 != 0 ? android.support.v4.media.session.a.l(context, i8) : null, i9 != 0 ? android.support.v4.media.session.a.l(context, i9) : null);
        C1187E c1187e = this.f14732r;
        if (c1187e != null) {
            c1187e.b();
        }
    }

    @Override // android.widget.TextView
    public final void setCompoundDrawablesWithIntrinsicBounds(int i, int i5, int i8, int i9) {
        Context context = getContext();
        setCompoundDrawablesWithIntrinsicBounds(i != 0 ? android.support.v4.media.session.a.l(context, i) : null, i5 != 0 ? android.support.v4.media.session.a.l(context, i5) : null, i8 != 0 ? android.support.v4.media.session.a.l(context, i8) : null, i9 != 0 ? android.support.v4.media.session.a.l(context, i9) : null);
        C1187E c1187e = this.f14732r;
        if (c1187e != null) {
            c1187e.b();
        }
    }
}
