package c.b.f;

import android.app.Activity;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.text.Editable;
import android.text.method.KeyListener;
import android.text.method.NumberKeyListener;
import android.util.AttributeSet;
import android.util.Log;
import android.view.ActionMode;
import android.view.DragEvent;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.view.textclassifier.TextClassifier;
import android.widget.EditText;
import c.b.f.c0;
import c.f.j.h;
import com.ifpdos.debugmenu.R;

/* JADX INFO: compiled from: AppCompatEditText.java */
/* JADX INFO: loaded from: classes.dex */
public class n extends EditText implements c.f.j.u {

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

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

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

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final c.f.k.q f904g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final o f905h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public a f906i;

    /* JADX INFO: compiled from: AppCompatEditText.java */
    public class a {
        public a() {
        }
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public n(Context context, AttributeSet attributeSet) {
        super(context, attributeSet, R.attr.editTextStyle);
        a1.a(context);
        y0.a(this, getContext());
        g gVar = new g(this);
        this.f901b = gVar;
        gVar.d(attributeSet, R.attr.editTextStyle);
        d0 d0Var = new d0(this);
        this.f902e = d0Var;
        d0Var.g(attributeSet, R.attr.editTextStyle);
        d0Var.b();
        this.f903f = new c0(this);
        this.f904g = new c.f.k.q();
        o oVar = new o(this);
        this.f905h = oVar;
        oVar.b(attributeSet, R.attr.editTextStyle);
        KeyListener keyListener = getKeyListener();
        if (!(keyListener instanceof NumberKeyListener)) {
            boolean zIsFocusable = isFocusable();
            boolean zIsClickable = isClickable();
            boolean zIsLongClickable = isLongClickable();
            int inputType = getInputType();
            KeyListener keyListenerA = oVar.a(keyListener);
            if (keyListenerA == keyListener) {
                return;
            }
            super.setKeyListener(keyListenerA);
            setRawInputType(inputType);
            setFocusable(zIsFocusable);
            setClickable(zIsClickable);
            setLongClickable(zIsLongClickable);
        }
    }

    private a getSuperCaller() {
        if (this.f906i == null) {
            this.f906i = new a();
        }
        return this.f906i;
    }

    @Override // c.f.j.u
    public c.f.j.h a(c.f.j.h hVar) {
        return this.f904g.a(this, hVar);
    }

    @Override // android.widget.TextView, android.view.View
    public void drawableStateChanged() {
        super.drawableStateChanged();
        g gVar = this.f901b;
        if (gVar != null) {
            gVar.a();
        }
        d0 d0Var = this.f902e;
        if (d0Var != null) {
            d0Var.b();
        }
    }

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

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

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

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

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

    @Override // android.widget.TextView
    public TextClassifier getTextClassifier() {
        c0 c0Var;
        if (Build.VERSION.SDK_INT >= 28 || (c0Var = this.f903f) == null) {
            return super.getTextClassifier();
        }
        TextClassifier textClassifier = c0Var.f781b;
        return textClassifier == null ? c0.a.a(c0Var.a) : textClassifier;
    }

    @Override // android.widget.TextView, android.view.View
    public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
        String[] strArrG;
        InputConnection inputConnectionOnCreateInputConnection = super.onCreateInputConnection(editorInfo);
        this.f902e.i(this, inputConnectionOnCreateInputConnection, editorInfo);
        c.b.a.f(inputConnectionOnCreateInputConnection, editorInfo, this);
        if (inputConnectionOnCreateInputConnection != null && Build.VERSION.SDK_INT <= 30 && (strArrG = c.f.j.a0.g(this)) != null) {
            editorInfo.contentMimeTypes = strArrG;
            inputConnectionOnCreateInputConnection = new c.f.j.o0.c(inputConnectionOnCreateInputConnection, false, new c.f.j.o0.a(this));
        }
        return this.f905h.c(inputConnectionOnCreateInputConnection, editorInfo);
    }

    @Override // android.widget.TextView, android.view.View
    public boolean onDragEvent(DragEvent dragEvent) {
        Activity activity;
        boolean zA = false;
        if (Build.VERSION.SDK_INT < 31 && dragEvent.getLocalState() == null && c.f.j.a0.g(this) != null) {
            Context context = getContext();
            while (true) {
                if (!(context instanceof ContextWrapper)) {
                    activity = null;
                    break;
                }
                if (context instanceof Activity) {
                    activity = (Activity) context;
                    break;
                }
                context = ((ContextWrapper) context).getBaseContext();
            }
            if (activity == null) {
                Log.i("ReceiveContent", "Can't handle drop: no activity: view=" + this);
            } else if (dragEvent.getAction() != 1 && dragEvent.getAction() == 3) {
                zA = y.a(dragEvent, this, activity);
            }
        }
        if (zA) {
            return true;
        }
        return super.onDragEvent(dragEvent);
    }

    @Override // android.widget.EditText, android.widget.TextView
    public boolean onTextContextMenuItem(int i2) {
        int i3 = Build.VERSION.SDK_INT;
        if (i3 < 31 && c.f.j.a0.g(this) != null && (i2 == 16908322 || i2 == 16908337)) {
            ClipboardManager clipboardManager = (ClipboardManager) getContext().getSystemService("clipboard");
            ClipData primaryClip = clipboardManager == null ? null : clipboardManager.getPrimaryClip();
            if (primaryClip != null && primaryClip.getItemCount() > 0) {
                h.b aVar = i3 >= 31 ? new h.a(primaryClip, 1) : new h.c(primaryClip, 1);
                aVar.d(i2 != 16908322 ? 1 : 0);
                c.f.j.a0.j(this, aVar.a());
            }
            i = 1;
        }
        if (i != 0) {
            return true;
        }
        return super.onTextContextMenuItem(i2);
    }

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

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

    @Override // android.widget.TextView
    public void setCompoundDrawables(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
        super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
        d0 d0Var = this.f902e;
        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.f902e;
        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) {
        this.f905h.f918b.a.c(z);
    }

    @Override // android.widget.TextView
    public void setKeyListener(KeyListener keyListener) {
        super.setKeyListener(this.f905h.a(keyListener));
    }

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

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

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

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

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

    @Override // android.widget.TextView
    public void setTextClassifier(TextClassifier textClassifier) {
        c0 c0Var;
        if (Build.VERSION.SDK_INT >= 28 || (c0Var = this.f903f) == null) {
            super.setTextClassifier(textClassifier);
        } else {
            c0Var.f781b = textClassifier;
        }
    }

    @Override // android.widget.EditText, android.widget.TextView
    public Editable getText() {
        return Build.VERSION.SDK_INT >= 28 ? super.getText() : getEditableText();
    }
}
