package p028j;

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.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 java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import p013e.C0640a;
import p017f0.C0710w;
import p023h0.InterfaceC0808e1;
import p032k0.C1304j0;
import p032k0.InterfaceC1285b1;
import p073z.C1889k;

/* renamed from: j.o1 */
/* loaded from: classes.dex */
public class C1165o1 extends TextView implements InterfaceC0808e1, InterfaceC1285b1 {

    /* renamed from: d */
    public final C1080d f2838d;

    /* renamed from: e */
    public final C1082d1 f2839e;

    /* renamed from: f */
    public final C1076c1 f2840f;

    /* renamed from: g */
    public C1144m f2841g;

    /* renamed from: h */
    public boolean f2842h;

    /* renamed from: i */
    public InterfaceC1166a f2843i;

    /* renamed from: j */
    public Future<C0710w> f2844j;

    /* renamed from: j.o1$a */
    /* loaded from: classes.dex */
    public interface InterfaceC1166a {
        /* renamed from: a */
        void mo1977a(int[] iArr, int i);

        /* renamed from: b */
        void mo1976b(TextClassifier textClassifier);

        /* renamed from: c */
        int mo1975c();

        /* renamed from: d */
        int[] mo1974d();

        /* renamed from: e */
        void mo1967e(int i);

        /* renamed from: f */
        void mo1966f(int i);

        /* renamed from: g */
        TextClassifier mo1973g();

        /* renamed from: h */
        int mo1972h();

        /* renamed from: i */
        int mo1971i();

        /* renamed from: j */
        void mo1970j(int i);

        /* renamed from: k */
        void mo1969k(int i, int i2, int i3, int i4);

        /* renamed from: l */
        int mo1968l();
    }

    /* renamed from: j.o1$b */
    /* loaded from: classes.dex */
    public class C1167b implements InterfaceC1166a {
        public C1167b() {
        }

        @Override // p028j.C1165o1.InterfaceC1166a
        /* renamed from: a */
        public void mo1977a(int[] iArr, int i) {
            C1165o1.super.setAutoSizeTextTypeUniformWithPresetSizes(iArr, i);
        }

        @Override // p028j.C1165o1.InterfaceC1166a
        /* renamed from: b */
        public void mo1976b(TextClassifier textClassifier) {
            C1165o1.super.setTextClassifier(textClassifier);
        }

        @Override // p028j.C1165o1.InterfaceC1166a
        /* renamed from: c */
        public int mo1975c() {
            return C1165o1.super.getAutoSizeMinTextSize();
        }

        @Override // p028j.C1165o1.InterfaceC1166a
        /* renamed from: d */
        public int[] mo1974d() {
            return C1165o1.super.getAutoSizeTextAvailableSizes();
        }

        @Override // p028j.C1165o1.InterfaceC1166a
        /* renamed from: e */
        public void mo1967e(int i) {
        }

        @Override // p028j.C1165o1.InterfaceC1166a
        /* renamed from: f */
        public void mo1966f(int i) {
        }

        @Override // p028j.C1165o1.InterfaceC1166a
        /* renamed from: g */
        public TextClassifier mo1973g() {
            return C1165o1.super.getTextClassifier();
        }

        @Override // p028j.C1165o1.InterfaceC1166a
        /* renamed from: h */
        public int mo1972h() {
            return C1165o1.super.getAutoSizeStepGranularity();
        }

        @Override // p028j.C1165o1.InterfaceC1166a
        /* renamed from: i */
        public int mo1971i() {
            return C1165o1.super.getAutoSizeMaxTextSize();
        }

        @Override // p028j.C1165o1.InterfaceC1166a
        /* renamed from: j */
        public void mo1970j(int i) {
            C1165o1.super.setAutoSizeTextTypeWithDefaults(i);
        }

        @Override // p028j.C1165o1.InterfaceC1166a
        /* renamed from: k */
        public void mo1969k(int i, int i2, int i3, int i4) {
            C1165o1.super.setAutoSizeTextTypeUniformWithConfiguration(i, i2, i3, i4);
        }

        @Override // p028j.C1165o1.InterfaceC1166a
        /* renamed from: l */
        public int mo1968l() {
            return C1165o1.super.getAutoSizeTextType();
        }
    }

    /* renamed from: j.o1$c */
    /* loaded from: classes.dex */
    public class C1168c extends C1167b {
        public C1168c() {
            super();
        }

        @Override // p028j.C1165o1.C1167b, p028j.C1165o1.InterfaceC1166a
        /* renamed from: e */
        public void mo1967e(int i) {
            C1165o1.super.setLastBaselineToBottomHeight(i);
        }

        @Override // p028j.C1165o1.C1167b, p028j.C1165o1.InterfaceC1166a
        /* renamed from: f */
        public void mo1966f(int i) {
            C1165o1.super.setFirstBaselineToTopHeight(i);
        }
    }

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

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

    public C1165o1(Context context, AttributeSet attributeSet, int i) {
        super(C1091d3.m2198b(context), attributeSet, i);
        this.f2842h = false;
        this.f2843i = null;
        C1073b3.m2264a(this, getContext());
        C1080d c1080d = new C1080d(this);
        this.f2838d = c1080d;
        c1080d.m2248e(attributeSet, i);
        C1082d1 c1082d1 = new C1082d1(this);
        this.f2839e = c1082d1;
        c1082d1.m2225m(attributeSet, i);
        c1082d1.m2236b();
        this.f2840f = new C1076c1(this);
        getEmojiTextViewHelper().m2042b(attributeSet, i);
    }

    private C1144m getEmojiTextViewHelper() {
        if (this.f2841g == null) {
            this.f2841g = new C1144m(this);
        }
        return this.f2841g;
    }

    @Override // android.widget.TextView, android.view.View
    public void drawableStateChanged() {
        super.drawableStateChanged();
        C1080d c1080d = this.f2838d;
        if (c1080d != null) {
            c1080d.m2251b();
        }
        C1082d1 c1082d1 = this.f2839e;
        if (c1082d1 != null) {
            c1082d1.m2236b();
        }
    }

    @Override // android.widget.TextView
    public int getAutoSizeMaxTextSize() {
        if (C1187q3.f2880b) {
            return getSuperCaller().mo1971i();
        }
        C1082d1 c1082d1 = this.f2839e;
        if (c1082d1 != null) {
            return c1082d1.m2233e();
        }
        return -1;
    }

    @Override // android.widget.TextView
    public int getAutoSizeMinTextSize() {
        if (C1187q3.f2880b) {
            return getSuperCaller().mo1975c();
        }
        C1082d1 c1082d1 = this.f2839e;
        if (c1082d1 != null) {
            return c1082d1.m2232f();
        }
        return -1;
    }

    @Override // android.widget.TextView
    public int getAutoSizeStepGranularity() {
        if (C1187q3.f2880b) {
            return getSuperCaller().mo1972h();
        }
        C1082d1 c1082d1 = this.f2839e;
        if (c1082d1 != null) {
            return c1082d1.m2231g();
        }
        return -1;
    }

    @Override // android.widget.TextView
    public int[] getAutoSizeTextAvailableSizes() {
        if (C1187q3.f2880b) {
            return getSuperCaller().mo1974d();
        }
        C1082d1 c1082d1 = this.f2839e;
        return c1082d1 != null ? c1082d1.m2230h() : new int[0];
    }

    @Override // android.widget.TextView
    public int getAutoSizeTextType() {
        if (C1187q3.f2880b) {
            return getSuperCaller().mo1968l() == 1 ? 1 : 0;
        }
        C1082d1 c1082d1 = this.f2839e;
        if (c1082d1 != null) {
            return c1082d1.m2229i();
        }
        return 0;
    }

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

    @Override // android.widget.TextView
    public int getFirstBaselineToTopHeight() {
        return C1304j0.m1680a(this);
    }

    @Override // android.widget.TextView
    public int getLastBaselineToBottomHeight() {
        return C1304j0.m1679b(this);
    }

    public InterfaceC1166a getSuperCaller() {
        InterfaceC1166a c1167b;
        if (this.f2843i == null) {
            int i = Build.VERSION.SDK_INT;
            if (i >= 28) {
                c1167b = new C1168c();
            } else if (i >= 26) {
                c1167b = new C1167b();
            }
            this.f2843i = c1167b;
        }
        return this.f2843i;
    }

    @Override // p023h0.InterfaceC0808e1
    public ColorStateList getSupportBackgroundTintList() {
        C1080d c1080d = this.f2838d;
        if (c1080d != null) {
            return c1080d.m2250c();
        }
        return null;
    }

    @Override // p023h0.InterfaceC0808e1
    public PorterDuff.Mode getSupportBackgroundTintMode() {
        C1080d c1080d = this.f2838d;
        if (c1080d != null) {
            return c1080d.m2249d();
        }
        return null;
    }

    public ColorStateList getSupportCompoundDrawablesTintList() {
        return this.f2839e.m2228j();
    }

    public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
        return this.f2839e.m2227k();
    }

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

    @Override // android.widget.TextView
    public TextClassifier getTextClassifier() {
        C1076c1 c1076c1;
        return (Build.VERSION.SDK_INT >= 28 || (c1076c1 = this.f2840f) == null) ? getSuperCaller().mo1973g() : c1076c1.m2256a();
    }

    public C0710w.C0711a getTextMetricsParamsCompat() {
        return C1304j0.m1676e(this);
    }

    @Override // android.widget.TextView, android.view.View
    public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
        InputConnection onCreateInputConnection = super.onCreateInputConnection(editorInfo);
        this.f2839e.m2220r(this, onCreateInputConnection, editorInfo);
        return C1158n.m2004a(onCreateInputConnection, editorInfo, this);
    }

    @Override // android.widget.TextView, android.view.View
    public void onLayout(boolean z, int i, int i2, int i3, int i4) {
        super.onLayout(z, i, i2, i3, i4);
        C1082d1 c1082d1 = this.f2839e;
        if (c1082d1 != null) {
            c1082d1.m2223o(z, i, i2, i3, i4);
        }
    }

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

    @Override // android.widget.TextView
    public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        super.onTextChanged(charSequence, i, i2, i3);
        C1082d1 c1082d1 = this.f2839e;
        if ((c1082d1 == null || C1187q3.f2880b || !c1082d1.m2226l()) ? false : true) {
            this.f2839e.m2235c();
        }
    }

    /* renamed from: q */
    public final void m1978q() {
        Future<C0710w> future = this.f2844j;
        if (future != null) {
            try {
                this.f2844j = null;
                C1304j0.m1670k(this, future.get());
            } catch (InterruptedException | ExecutionException unused) {
            }
        }
    }

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

    @Override // android.widget.TextView
    public void setAutoSizeTextTypeUniformWithConfiguration(int i, int i2, int i3, int i4) {
        if (C1187q3.f2880b) {
            getSuperCaller().mo1969k(i, i2, i3, i4);
            return;
        }
        C1082d1 c1082d1 = this.f2839e;
        if (c1082d1 != null) {
            c1082d1.m2218t(i, i2, i3, i4);
        }
    }

    @Override // android.widget.TextView
    public void setAutoSizeTextTypeUniformWithPresetSizes(int[] iArr, int i) {
        if (C1187q3.f2880b) {
            getSuperCaller().mo1977a(iArr, i);
            return;
        }
        C1082d1 c1082d1 = this.f2839e;
        if (c1082d1 != null) {
            c1082d1.m2217u(iArr, i);
        }
    }

    @Override // android.widget.TextView
    public void setAutoSizeTextTypeWithDefaults(int i) {
        if (C1187q3.f2880b) {
            getSuperCaller().mo1970j(i);
            return;
        }
        C1082d1 c1082d1 = this.f2839e;
        if (c1082d1 != null) {
            c1082d1.m2216v(i);
        }
    }

    @Override // android.view.View
    public void setBackgroundDrawable(Drawable drawable) {
        super.setBackgroundDrawable(drawable);
        C1080d c1080d = this.f2838d;
        if (c1080d != null) {
            c1080d.m2247f(drawable);
        }
    }

    @Override // android.view.View
    public void setBackgroundResource(int i) {
        super.setBackgroundResource(i);
        C1080d c1080d = this.f2838d;
        if (c1080d != null) {
            c1080d.m2246g(i);
        }
    }

    @Override // android.widget.TextView
    public void setCompoundDrawables(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
        super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
        C1082d1 c1082d1 = this.f2839e;
        if (c1082d1 != null) {
            c1082d1.m2222p();
        }
    }

    @Override // android.widget.TextView
    public void setCompoundDrawablesRelative(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
        super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
        C1082d1 c1082d1 = this.f2839e;
        if (c1082d1 != null) {
            c1082d1.m2222p();
        }
    }

    @Override // android.widget.TextView
    public void setCompoundDrawablesRelativeWithIntrinsicBounds(int i, int i2, int i3, int i4) {
        Context context = getContext();
        setCompoundDrawablesRelativeWithIntrinsicBounds(i != 0 ? C0640a.m3229b(context, i) : null, i2 != 0 ? C0640a.m3229b(context, i2) : null, i3 != 0 ? C0640a.m3229b(context, i3) : null, i4 != 0 ? C0640a.m3229b(context, i4) : null);
        C1082d1 c1082d1 = this.f2839e;
        if (c1082d1 != null) {
            c1082d1.m2222p();
        }
    }

    @Override // android.widget.TextView
    public void setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
        super.setCompoundDrawablesRelativeWithIntrinsicBounds(drawable, drawable2, drawable3, drawable4);
        C1082d1 c1082d1 = this.f2839e;
        if (c1082d1 != null) {
            c1082d1.m2222p();
        }
    }

    @Override // android.widget.TextView
    public void setCompoundDrawablesWithIntrinsicBounds(int i, int i2, int i3, int i4) {
        Context context = getContext();
        setCompoundDrawablesWithIntrinsicBounds(i != 0 ? C0640a.m3229b(context, i) : null, i2 != 0 ? C0640a.m3229b(context, i2) : null, i3 != 0 ? C0640a.m3229b(context, i3) : null, i4 != 0 ? C0640a.m3229b(context, i4) : null);
        C1082d1 c1082d1 = this.f2839e;
        if (c1082d1 != null) {
            c1082d1.m2222p();
        }
    }

    @Override // android.widget.TextView
    public void setCompoundDrawablesWithIntrinsicBounds(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
        super.setCompoundDrawablesWithIntrinsicBounds(drawable, drawable2, drawable3, drawable4);
        C1082d1 c1082d1 = this.f2839e;
        if (c1082d1 != null) {
            c1082d1.m2222p();
        }
    }

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

    public void setEmojiCompatEnabled(boolean z) {
        getEmojiTextViewHelper().m2040d(z);
    }

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

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

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

    @Override // android.widget.TextView
    public void setLineHeight(int i) {
        C1304j0.m1671j(this, i);
    }

    public void setPrecomputedText(C0710w c0710w) {
        C1304j0.m1670k(this, c0710w);
    }

    @Override // p023h0.InterfaceC0808e1
    public void setSupportBackgroundTintList(ColorStateList colorStateList) {
        C1080d c1080d = this.f2838d;
        if (c1080d != null) {
            c1080d.m2244i(colorStateList);
        }
    }

    @Override // p023h0.InterfaceC0808e1
    public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
        C1080d c1080d = this.f2838d;
        if (c1080d != null) {
            c1080d.m2243j(mode);
        }
    }

    @Override // p032k0.InterfaceC1285b1
    public void setSupportCompoundDrawablesTintList(ColorStateList colorStateList) {
        this.f2839e.m2215w(colorStateList);
        this.f2839e.m2236b();
    }

    @Override // p032k0.InterfaceC1285b1
    public void setSupportCompoundDrawablesTintMode(PorterDuff.Mode mode) {
        this.f2839e.m2214x(mode);
        this.f2839e.m2236b();
    }

    @Override // android.widget.TextView
    public void setTextAppearance(Context context, int i) {
        super.setTextAppearance(context, i);
        C1082d1 c1082d1 = this.f2839e;
        if (c1082d1 != null) {
            c1082d1.m2221q(context, i);
        }
    }

    @Override // android.widget.TextView
    public void setTextClassifier(TextClassifier textClassifier) {
        C1076c1 c1076c1;
        if (Build.VERSION.SDK_INT >= 28 || (c1076c1 = this.f2840f) == null) {
            getSuperCaller().mo1976b(textClassifier);
        } else {
            c1076c1.m2255b(textClassifier);
        }
    }

    public void setTextFuture(Future<C0710w> future) {
        this.f2844j = future;
        if (future != null) {
            requestLayout();
        }
    }

    public void setTextMetricsParamsCompat(C0710w.C0711a c0711a) {
        C1304j0.m1669l(this, c0711a);
    }

    @Override // android.widget.TextView
    public void setTextSize(int i, float f) {
        if (C1187q3.f2880b) {
            super.setTextSize(i, f);
            return;
        }
        C1082d1 c1082d1 = this.f2839e;
        if (c1082d1 != null) {
            c1082d1.m2240A(i, f);
        }
    }

    @Override // android.widget.TextView
    public void setTypeface(Typeface typeface, int i) {
        if (this.f2842h) {
            return;
        }
        Typeface m114a = (typeface == null || i <= 0) ? null : C1889k.m114a(getContext(), typeface, i);
        this.f2842h = true;
        if (m114a != null) {
            typeface = m114a;
        }
        try {
            super.setTypeface(typeface, i);
        } finally {
            this.f2842h = false;
        }
    }
}