package androidx.appcompat.widget;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.text.InputFilter;
import android.util.AttributeSet;
import android.view.ActionMode;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.Button;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.core.view.x0;
import l.a1;
import l.f0;
import l.f4;
import l.j1;
import l.l3;
import l.m3;
import l.y;
import u0.p;
import u0.t;

/* JADX INFO: loaded from: classes.dex */
public class AppCompatButton extends Button implements x0, t {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final y f649a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final a1 f650b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public f0 f651c;

    public AppCompatButton(@NonNull Context context) {
        this(context, null);
    }

    @NonNull
    private f0 getEmojiTextViewHelper() {
        if (this.f651c == null) {
            this.f651c = new f0(this);
        }
        return this.f651c;
    }

    @Override // android.widget.TextView, android.view.View
    public final void drawableStateChanged() {
        super.drawableStateChanged();
        y yVar = this.f649a;
        if (yVar != null) {
            yVar.a();
        }
        a1 a1Var = this.f650b;
        if (a1Var != null) {
            a1Var.b();
        }
    }

    @Override // android.widget.TextView
    @RestrictTo({RestrictTo.Scope.f557c})
    public int getAutoSizeMaxTextSize() {
        if (f4.f29684c) {
            return super.getAutoSizeMaxTextSize();
        }
        a1 a1Var = this.f650b;
        if (a1Var != null) {
            return Math.round(a1Var.f29612i.f29739e);
        }
        return -1;
    }

    @Override // android.widget.TextView
    @RestrictTo({RestrictTo.Scope.f557c})
    public int getAutoSizeMinTextSize() {
        if (f4.f29684c) {
            return super.getAutoSizeMinTextSize();
        }
        a1 a1Var = this.f650b;
        if (a1Var != null) {
            return Math.round(a1Var.f29612i.f29738d);
        }
        return -1;
    }

    @Override // android.widget.TextView
    @RestrictTo({RestrictTo.Scope.f557c})
    public int getAutoSizeStepGranularity() {
        if (f4.f29684c) {
            return super.getAutoSizeStepGranularity();
        }
        a1 a1Var = this.f650b;
        if (a1Var != null) {
            return Math.round(a1Var.f29612i.f29737c);
        }
        return -1;
    }

    @Override // android.widget.TextView
    @RestrictTo({RestrictTo.Scope.f557c})
    public int[] getAutoSizeTextAvailableSizes() {
        if (f4.f29684c) {
            return super.getAutoSizeTextAvailableSizes();
        }
        a1 a1Var = this.f650b;
        return a1Var != null ? a1Var.f29612i.f29740f : new int[0];
    }

    @Override // android.widget.TextView
    @SuppressLint({"WrongConstant"})
    @RestrictTo({RestrictTo.Scope.f557c})
    public int getAutoSizeTextType() {
        if (f4.f29684c) {
            return super.getAutoSizeTextType() == 1 ? 1 : 0;
        }
        a1 a1Var = this.f650b;
        if (a1Var != null) {
            return a1Var.f29612i.f29735a;
        }
        return 0;
    }

    @Override // android.widget.TextView
    @Nullable
    public ActionMode.Callback getCustomSelectionActionModeCallback() {
        return p.unwrapCustomSelectionActionModeCallback(super.getCustomSelectionActionModeCallback());
    }

    @Override // androidx.core.view.x0
    @Nullable
    @RestrictTo({RestrictTo.Scope.f557c})
    public ColorStateList getSupportBackgroundTintList() {
        y yVar = this.f649a;
        if (yVar != null) {
            return yVar.b();
        }
        return null;
    }

    @Override // androidx.core.view.x0
    @Nullable
    @RestrictTo({RestrictTo.Scope.f557c})
    public PorterDuff.Mode getSupportBackgroundTintMode() {
        y yVar = this.f649a;
        if (yVar != null) {
            return yVar.c();
        }
        return null;
    }

    @Override // u0.t
    @Nullable
    @RestrictTo({RestrictTo.Scope.f557c})
    public ColorStateList getSupportCompoundDrawablesTintList() {
        return this.f650b.getCompoundDrawableTintList();
    }

    @Override // u0.t
    @Nullable
    @RestrictTo({RestrictTo.Scope.f557c})
    public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
        return this.f650b.getCompoundDrawableTintMode();
    }

    @Override // android.view.View
    public void onInitializeAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
        super.onInitializeAccessibilityEvent(accessibilityEvent);
        accessibilityEvent.setClassName(Button.class.getName());
    }

    @Override // android.view.View
    public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
        super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
        accessibilityNodeInfo.setClassName(Button.class.getName());
    }

    @Override // android.widget.TextView, android.view.View
    public void onLayout(boolean z10, int i10, int i11, int i12, int i13) {
        super.onLayout(z10, i10, i11, i12, i13);
        a1 a1Var = this.f650b;
        if (a1Var == null || f4.f29684c) {
            return;
        }
        a1Var.f29612i.a();
    }

    @Override // android.widget.TextView
    public void onTextChanged(CharSequence charSequence, int i10, int i11, int i12) {
        super.onTextChanged(charSequence, i10, i11, i12);
        a1 a1Var = this.f650b;
        if (a1Var == null || f4.f29684c) {
            return;
        }
        j1 j1Var = a1Var.f29612i;
        if (j1Var.e()) {
            j1Var.a();
        }
    }

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

    @Override // android.widget.TextView
    @RestrictTo({RestrictTo.Scope.f557c})
    public void setAutoSizeTextTypeUniformWithConfiguration(int i10, int i11, int i12, int i13) throws IllegalArgumentException {
        if (f4.f29684c) {
            super.setAutoSizeTextTypeUniformWithConfiguration(i10, i11, i12, i13);
            return;
        }
        a1 a1Var = this.f650b;
        if (a1Var != null) {
            a1Var.e(i10, i11, i12, i13);
        }
    }

    @Override // android.widget.TextView
    @RestrictTo({RestrictTo.Scope.f557c})
    public void setAutoSizeTextTypeUniformWithPresetSizes(@NonNull int[] iArr, int i10) throws IllegalArgumentException {
        if (f4.f29684c) {
            super.setAutoSizeTextTypeUniformWithPresetSizes(iArr, i10);
            return;
        }
        a1 a1Var = this.f650b;
        if (a1Var != null) {
            a1Var.f(iArr, i10);
        }
    }

    @Override // android.widget.TextView
    @RestrictTo({RestrictTo.Scope.f557c})
    public void setAutoSizeTextTypeWithDefaults(int i10) {
        if (f4.f29684c) {
            super.setAutoSizeTextTypeWithDefaults(i10);
            return;
        }
        a1 a1Var = this.f650b;
        if (a1Var != null) {
            a1Var.g(i10);
        }
    }

    @Override // android.view.View
    public void setBackgroundDrawable(@Nullable Drawable drawable) {
        super.setBackgroundDrawable(drawable);
        y yVar = this.f649a;
        if (yVar != null) {
            yVar.d();
        }
    }

    @Override // android.view.View
    public void setBackgroundResource(@DrawableRes int i10) {
        super.setBackgroundResource(i10);
        y yVar = this.f649a;
        if (yVar != null) {
            yVar.e(i10);
        }
    }

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

    public void setEmojiCompatEnabled(boolean z10) {
        getEmojiTextViewHelper().c(z10);
    }

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

    public void setSupportAllCaps(boolean z10) {
        a1 a1Var = this.f650b;
        if (a1Var != null) {
            a1Var.f29604a.setAllCaps(z10);
        }
    }

    @Override // androidx.core.view.x0
    @RestrictTo({RestrictTo.Scope.f557c})
    public void setSupportBackgroundTintList(@Nullable ColorStateList colorStateList) {
        y yVar = this.f649a;
        if (yVar != null) {
            yVar.g(colorStateList);
        }
    }

    @Override // androidx.core.view.x0
    @RestrictTo({RestrictTo.Scope.f557c})
    public void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode mode) {
        y yVar = this.f649a;
        if (yVar != null) {
            yVar.h(mode);
        }
    }

    @Override // u0.t
    @RestrictTo({RestrictTo.Scope.f557c})
    public void setSupportCompoundDrawablesTintList(@Nullable ColorStateList colorStateList) {
        a1 a1Var = this.f650b;
        a1Var.setCompoundDrawableTintList(colorStateList);
        a1Var.b();
    }

    @Override // u0.t
    @RestrictTo({RestrictTo.Scope.f557c})
    public void setSupportCompoundDrawablesTintMode(@Nullable PorterDuff.Mode mode) {
        a1 a1Var = this.f650b;
        a1Var.setCompoundDrawableTintMode(mode);
        a1Var.b();
    }

    @Override // android.widget.TextView
    public void setTextAppearance(Context context, int i10) {
        super.setTextAppearance(context, i10);
        a1 a1Var = this.f650b;
        if (a1Var != null) {
            a1Var.d(context, i10);
        }
    }

    @Override // android.widget.TextView
    public void setTextSize(int i10, float f10) {
        boolean z10 = f4.f29684c;
        if (z10) {
            super.setTextSize(i10, f10);
            return;
        }
        a1 a1Var = this.f650b;
        if (a1Var == null || z10) {
            return;
        }
        j1 j1Var = a1Var.f29612i;
        if (j1Var.e()) {
            return;
        }
        j1Var.f(f10, i10);
    }

    public AppCompatButton(@NonNull Context context, @Nullable AttributeSet attributeSet) {
        this(context, attributeSet, d.a.buttonStyle);
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public AppCompatButton(@NonNull Context context, @Nullable AttributeSet attributeSet, int i10) {
        super(context, attributeSet, i10);
        m3.a(context);
        l3.a(getContext(), this);
        y yVar = new y(this);
        this.f649a = yVar;
        yVar.loadFromAttributes(attributeSet, i10);
        a1 a1Var = new a1(this);
        this.f650b = a1Var;
        a1Var.loadFromAttributes(attributeSet, i10);
        a1Var.b();
        getEmojiTextViewHelper().loadFromAttributes(attributeSet, i10);
    }
}
