package c.b.f;

import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
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 com.ifpdos.debugmenu.R;

/* JADX INFO: compiled from: AppCompatCheckedTextView.java */
/* JADX INFO: loaded from: classes.dex */
public class j extends CheckedTextView {

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

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final g f866e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final d0 f867f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public p f868g;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public j(Context context, AttributeSet attributeSet) {
        int iJ;
        int iJ2;
        super(context, attributeSet, R.attr.checkedTextViewStyle);
        a1.a(context);
        y0.a(this, getContext());
        d0 d0Var = new d0(this);
        this.f867f = d0Var;
        d0Var.g(attributeSet, R.attr.checkedTextViewStyle);
        d0Var.b();
        g gVar = new g(this);
        this.f866e = gVar;
        gVar.d(attributeSet, R.attr.checkedTextViewStyle);
        k kVar = new k(this);
        this.f865b = kVar;
        Context context2 = getContext();
        int[] iArr = c.b.b.f543l;
        d1 d1VarO = d1.o(context2, attributeSet, iArr, R.attr.checkedTextViewStyle, 0);
        c.f.j.a0.k(this, getContext(), iArr, attributeSet, d1VarO.f806b, R.attr.checkedTextViewStyle, 0);
        boolean z = true;
        try {
            if (!d1VarO.m(1) || (iJ2 = d1VarO.j(1, 0)) == 0) {
                z = false;
            } else {
                try {
                    setCheckMarkDrawable(c.b.a.e(getContext(), iJ2));
                } catch (Resources.NotFoundException unused) {
                    z = false;
                }
            }
            if (!z && d1VarO.m(0) && (iJ = d1VarO.j(0, 0)) != 0) {
                CheckedTextView checkedTextView = kVar.a;
                checkedTextView.setCheckMarkDrawable(c.b.a.e(checkedTextView.getContext(), iJ));
            }
            if (d1VarO.m(2)) {
                kVar.a.setCheckMarkTintList(d1VarO.b(2));
            }
            if (d1VarO.m(3)) {
                kVar.a.setCheckMarkTintMode(k0.c(d1VarO.h(3, -1), null));
            }
            d1VarO.f806b.recycle();
            getEmojiTextViewHelper().a(attributeSet, R.attr.checkedTextViewStyle);
        } catch (Throwable th) {
            d1VarO.f806b.recycle();
            throw th;
        }
    }

    private p getEmojiTextViewHelper() {
        if (this.f868g == null) {
            this.f868g = new p(this);
        }
        return this.f868g;
    }

    @Override // android.widget.CheckedTextView, android.widget.TextView, android.view.View
    public void drawableStateChanged() {
        super.drawableStateChanged();
        d0 d0Var = this.f867f;
        if (d0Var != null) {
            d0Var.b();
        }
        g gVar = this.f866e;
        if (gVar != null) {
            gVar.a();
        }
        k kVar = this.f865b;
        if (kVar != null) {
            kVar.a();
        }
    }

    @Override // android.widget.TextView
    public ActionMode.Callback getCustomSelectionActionModeCallback() {
        return c.f.b.h.K(super.getCustomSelectionActionModeCallback());
    }

    public ColorStateList getSupportBackgroundTintList() {
        g gVar = this.f866e;
        if (gVar != null) {
            return gVar.b();
        }
        return null;
    }

    public PorterDuff.Mode getSupportBackgroundTintMode() {
        g gVar = this.f866e;
        if (gVar != null) {
            return gVar.c();
        }
        return null;
    }

    public ColorStateList getSupportCheckMarkTintList() {
        k kVar = this.f865b;
        if (kVar != null) {
            return kVar.f869b;
        }
        return null;
    }

    public PorterDuff.Mode getSupportCheckMarkTintMode() {
        k kVar = this.f865b;
        if (kVar != null) {
            return kVar.f870c;
        }
        return null;
    }

    public ColorStateList getSupportCompoundDrawablesTintList() {
        return this.f867f.d();
    }

    public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
        return this.f867f.e();
    }

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

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

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

    @Override // android.view.View
    public void setBackgroundResource(int i2) {
        super.setBackgroundResource(i2);
        g gVar = this.f866e;
        if (gVar != null) {
            gVar.f(i2);
        }
    }

    @Override // android.widget.CheckedTextView
    public void setCheckMarkDrawable(Drawable drawable) {
        super.setCheckMarkDrawable(drawable);
        k kVar = this.f865b;
        if (kVar != null) {
            if (kVar.f873f) {
                kVar.f873f = false;
            } else {
                kVar.f873f = true;
                kVar.a();
            }
        }
    }

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

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

    @Override // android.widget.TextView
    public void setCustomSelectionActionModeCallback(ActionMode.Callback callback) {
        super.setCustomSelectionActionModeCallback(c.f.b.h.L(this, callback));
    }

    public void setEmojiCompatEnabled(boolean z) {
        getEmojiTextViewHelper().f928b.a.c(z);
    }

    public void setSupportBackgroundTintList(ColorStateList colorStateList) {
        g gVar = this.f866e;
        if (gVar != null) {
            gVar.h(colorStateList);
        }
    }

    public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
        g gVar = this.f866e;
        if (gVar != null) {
            gVar.i(mode);
        }
    }

    public void setSupportCheckMarkTintList(ColorStateList colorStateList) {
        k kVar = this.f865b;
        if (kVar != null) {
            kVar.f869b = colorStateList;
            kVar.f871d = true;
            kVar.a();
        }
    }

    public void setSupportCheckMarkTintMode(PorterDuff.Mode mode) {
        k kVar = this.f865b;
        if (kVar != null) {
            kVar.f870c = mode;
            kVar.f872e = true;
            kVar.a();
        }
    }

    public void setSupportCompoundDrawablesTintList(ColorStateList colorStateList) {
        this.f867f.m(colorStateList);
        this.f867f.b();
    }

    public void setSupportCompoundDrawablesTintMode(PorterDuff.Mode mode) {
        this.f867f.n(mode);
        this.f867f.b();
    }

    @Override // android.widget.TextView
    public void setTextAppearance(Context context, int i2) {
        super.setTextAppearance(context, i2);
        d0 d0Var = this.f867f;
        if (d0Var != null) {
            d0Var.h(context, i2);
        }
    }

    @Override // android.widget.CheckedTextView
    public void setCheckMarkDrawable(int i2) {
        setCheckMarkDrawable(c.b.a.e(getContext(), i2));
    }
}
