package android.support.v7.widget;

import a.b.c.e.a;
import android.R;
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 java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

/* JADX INFO: compiled from: AppCompatTextView.java */
/* JADX INFO: loaded from: classes.dex */
public class y extends TextView implements a.b.c.g.o, android.support.v4.widget.b {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private final e f1177b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private final x f1178c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private Future<a.b.c.e.a> f1179d;

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

    private void e() {
        Future<a.b.c.e.a> future = this.f1179d;
        if (future != null) {
            try {
                this.f1179d = null;
                android.support.v4.widget.l.i(this, future.get());
            } catch (InterruptedException | ExecutionException unused) {
            }
        }
    }

    @Override // android.widget.TextView, android.view.View
    protected void drawableStateChanged() {
        super.drawableStateChanged();
        e eVar = this.f1177b;
        if (eVar != null) {
            eVar.b();
        }
        x xVar = this.f1178c;
        if (xVar != null) {
            xVar.b();
        }
    }

    @Override // android.widget.TextView
    public int getAutoSizeMaxTextSize() {
        if (android.support.v4.widget.b.f694a) {
            return super.getAutoSizeMaxTextSize();
        }
        x xVar = this.f1178c;
        if (xVar != null) {
            return xVar.e();
        }
        return -1;
    }

    @Override // android.widget.TextView
    public int getAutoSizeMinTextSize() {
        if (android.support.v4.widget.b.f694a) {
            return super.getAutoSizeMinTextSize();
        }
        x xVar = this.f1178c;
        if (xVar != null) {
            return xVar.f();
        }
        return -1;
    }

    @Override // android.widget.TextView
    public int getAutoSizeStepGranularity() {
        if (android.support.v4.widget.b.f694a) {
            return super.getAutoSizeStepGranularity();
        }
        x xVar = this.f1178c;
        if (xVar != null) {
            return xVar.g();
        }
        return -1;
    }

    @Override // android.widget.TextView
    public int[] getAutoSizeTextAvailableSizes() {
        if (android.support.v4.widget.b.f694a) {
            return super.getAutoSizeTextAvailableSizes();
        }
        x xVar = this.f1178c;
        return xVar != null ? xVar.h() : new int[0];
    }

    @Override // android.widget.TextView
    public int getAutoSizeTextType() {
        if (android.support.v4.widget.b.f694a) {
            return super.getAutoSizeTextType() == 1 ? 1 : 0;
        }
        x xVar = this.f1178c;
        if (xVar != null) {
            return xVar.i();
        }
        return 0;
    }

    @Override // android.widget.TextView
    public int getFirstBaselineToTopHeight() {
        return android.support.v4.widget.l.a(this);
    }

    @Override // android.widget.TextView
    public int getLastBaselineToBottomHeight() {
        return android.support.v4.widget.l.b(this);
    }

    @Override // a.b.c.g.o
    public ColorStateList getSupportBackgroundTintList() {
        e eVar = this.f1177b;
        if (eVar != null) {
            return eVar.c();
        }
        return null;
    }

    @Override // a.b.c.g.o
    public PorterDuff.Mode getSupportBackgroundTintMode() {
        e eVar = this.f1177b;
        if (eVar != null) {
            return eVar.d();
        }
        return null;
    }

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

    public a.C0009a getTextMetricsParamsCompat() {
        return android.support.v4.widget.l.e(this);
    }

    @Override // android.widget.TextView, android.view.View
    public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
        InputConnection inputConnectionOnCreateInputConnection = super.onCreateInputConnection(editorInfo);
        l.a(inputConnectionOnCreateInputConnection, editorInfo, this);
        return inputConnectionOnCreateInputConnection;
    }

    @Override // android.widget.TextView, android.view.View
    protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
        super.onLayout(z, i, i2, i3, i4);
        x xVar = this.f1178c;
        if (xVar != null) {
            xVar.m(z, i, i2, i3, i4);
        }
    }

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

    @Override // android.widget.TextView
    protected void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        super.onTextChanged(charSequence, i, i2, i3);
        x xVar = this.f1178c;
        if (xVar == null || android.support.v4.widget.b.f694a || !xVar.j()) {
            return;
        }
        this.f1178c.c();
    }

    @Override // android.widget.TextView
    public void setAutoSizeTextTypeUniformWithConfiguration(int i, int i2, int i3, int i4) throws IllegalArgumentException {
        if (android.support.v4.widget.b.f694a) {
            super.setAutoSizeTextTypeUniformWithConfiguration(i, i2, i3, i4);
            return;
        }
        x xVar = this.f1178c;
        if (xVar != null) {
            xVar.p(i, i2, i3, i4);
        }
    }

    @Override // android.widget.TextView
    public void setAutoSizeTextTypeUniformWithPresetSizes(int[] iArr, int i) throws IllegalArgumentException {
        if (android.support.v4.widget.b.f694a) {
            super.setAutoSizeTextTypeUniformWithPresetSizes(iArr, i);
            return;
        }
        x xVar = this.f1178c;
        if (xVar != null) {
            xVar.q(iArr, i);
        }
    }

    @Override // android.widget.TextView
    public void setAutoSizeTextTypeWithDefaults(int i) {
        if (android.support.v4.widget.b.f694a) {
            super.setAutoSizeTextTypeWithDefaults(i);
            return;
        }
        x xVar = this.f1178c;
        if (xVar != null) {
            xVar.r(i);
        }
    }

    @Override // android.view.View
    public void setBackgroundDrawable(Drawable drawable) {
        super.setBackgroundDrawable(drawable);
        e eVar = this.f1177b;
        if (eVar != null) {
            eVar.f(drawable);
        }
    }

    @Override // android.view.View
    public void setBackgroundResource(int i) {
        super.setBackgroundResource(i);
        e eVar = this.f1177b;
        if (eVar != null) {
            eVar.g(i);
        }
    }

    @Override // android.widget.TextView
    public void setCustomSelectionActionModeCallback(ActionMode.Callback callback) {
        super.setCustomSelectionActionModeCallback(android.support.v4.widget.l.k(this, callback));
    }

    @Override // android.widget.TextView
    public void setFirstBaselineToTopHeight(int i) {
        if (Build.VERSION.SDK_INT >= 28) {
            super.setFirstBaselineToTopHeight(i);
        } else {
            android.support.v4.widget.l.f(this, i);
        }
    }

    @Override // android.widget.TextView
    public void setLastBaselineToBottomHeight(int i) {
        if (Build.VERSION.SDK_INT >= 28) {
            super.setLastBaselineToBottomHeight(i);
        } else {
            android.support.v4.widget.l.g(this, i);
        }
    }

    @Override // android.widget.TextView
    public void setLineHeight(int i) {
        android.support.v4.widget.l.h(this, i);
    }

    public void setPrecomputedText(a.b.c.e.a aVar) {
        android.support.v4.widget.l.i(this, aVar);
    }

    @Override // a.b.c.g.o
    public void setSupportBackgroundTintList(ColorStateList colorStateList) {
        e eVar = this.f1177b;
        if (eVar != null) {
            eVar.i(colorStateList);
        }
    }

    @Override // a.b.c.g.o
    public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
        e eVar = this.f1177b;
        if (eVar != null) {
            eVar.j(mode);
        }
    }

    @Override // android.widget.TextView
    public void setTextAppearance(Context context, int i) {
        super.setTextAppearance(context, i);
        x xVar = this.f1178c;
        if (xVar != null) {
            xVar.n(context, i);
        }
    }

    public void setTextFuture(Future<a.b.c.e.a> future) {
        this.f1179d = future;
        requestLayout();
    }

    public void setTextMetricsParamsCompat(a.C0009a c0009a) {
        android.support.v4.widget.l.j(this, c0009a);
    }

    @Override // android.widget.TextView
    public void setTextSize(int i, float f2) {
        if (android.support.v4.widget.b.f694a) {
            super.setTextSize(i, f2);
            return;
        }
        x xVar = this.f1178c;
        if (xVar != null) {
            xVar.s(i, f2);
        }
    }

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

    public y(Context context, AttributeSet attributeSet, int i) {
        super(q0.b(context), attributeSet, i);
        e eVar = new e(this);
        this.f1177b = eVar;
        eVar.e(attributeSet, i);
        x xVar = new x(this);
        this.f1178c = xVar;
        xVar.k(attributeSet, i);
        this.f1178c.b();
    }
}
