package androidx.appcompat.widget;

import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.ActionMode;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.widget.CheckedTextView;
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.l3;
import l.m3;
import l.y;
import l.z;
import u0.p;
import u0.r;
import u0.t;

/* JADX INFO: loaded from: classes.dex */
public class AppCompatCheckedTextView extends CheckedTextView implements r, x0, t {

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

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

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

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

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

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

    @Override // android.widget.CheckedTextView, android.widget.TextView, android.view.View
    public final void drawableStateChanged() {
        super.drawableStateChanged();
        a1 a1Var = this.f658c;
        if (a1Var != null) {
            a1Var.b();
        }
        y yVar = this.f657b;
        if (yVar != null) {
            yVar.a();
        }
        z zVar = this.f656a;
        if (zVar != null) {
            zVar.a();
        }
    }

    @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.f657b;
        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.f657b;
        if (yVar != null) {
            return yVar.c();
        }
        return null;
    }

    @Override // u0.r
    @Nullable
    @RestrictTo({RestrictTo.Scope.f557c})
    public ColorStateList getSupportCheckMarkTintList() {
        z zVar = this.f656a;
        if (zVar != null) {
            return zVar.f29921b;
        }
        return null;
    }

    @Override // u0.r
    @Nullable
    @RestrictTo({RestrictTo.Scope.f557c})
    public PorterDuff.Mode getSupportCheckMarkTintMode() {
        z zVar = this.f656a;
        if (zVar != null) {
            return zVar.f29922c;
        }
        return null;
    }

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

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

    @Override // android.widget.TextView, android.view.View
    @Nullable
    public InputConnection onCreateInputConnection(@NonNull EditorInfo editorInfo) {
        InputConnection inputConnectionOnCreateInputConnection = super.onCreateInputConnection(editorInfo);
        kotlinx.coroutines.y.Q(this, editorInfo, inputConnectionOnCreateInputConnection);
        return inputConnectionOnCreateInputConnection;
    }

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

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

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

    @Override // android.widget.CheckedTextView
    public void setCheckMarkDrawable(@Nullable Drawable drawable) {
        super.setCheckMarkDrawable(drawable);
        z zVar = this.f656a;
        if (zVar != null) {
            if (zVar.f29925f) {
                zVar.f29925f = false;
            } else {
                zVar.f29925f = true;
                zVar.a();
            }
        }
    }

    @Override // android.widget.TextView
    public void setCompoundDrawables(@Nullable Drawable drawable, @Nullable Drawable drawable2, @Nullable Drawable drawable3, @Nullable Drawable drawable4) {
        super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
        a1 a1Var = this.f658c;
        if (a1Var != null) {
            a1Var.b();
        }
    }

    @Override // android.widget.TextView
    public void setCompoundDrawablesRelative(@Nullable Drawable drawable, @Nullable Drawable drawable2, @Nullable Drawable drawable3, @Nullable Drawable drawable4) {
        super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
        a1 a1Var = this.f658c;
        if (a1Var != null) {
            a1Var.b();
        }
    }

    @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 // androidx.core.view.x0
    @RestrictTo({RestrictTo.Scope.f557c})
    public void setSupportBackgroundTintList(@Nullable ColorStateList colorStateList) {
        y yVar = this.f657b;
        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.f657b;
        if (yVar != null) {
            yVar.h(mode);
        }
    }

    @Override // u0.r
    @RestrictTo({RestrictTo.Scope.f557c})
    public void setSupportCheckMarkTintList(@Nullable ColorStateList colorStateList) {
        z zVar = this.f656a;
        if (zVar != null) {
            zVar.f29921b = colorStateList;
            zVar.f29923d = true;
            zVar.a();
        }
    }

    @Override // u0.r
    @RestrictTo({RestrictTo.Scope.f557c})
    public void setSupportCheckMarkTintMode(@Nullable PorterDuff.Mode mode) {
        z zVar = this.f656a;
        if (zVar != null) {
            zVar.setSupportCheckMarkTintMode(mode);
        }
    }

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

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

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

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

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

    @Override // android.widget.CheckedTextView
    public void setCheckMarkDrawable(@DrawableRes int i10) {
        setCheckMarkDrawable(f.a.getDrawable(getContext(), i10));
    }
}
