package o;

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.view.ActionMode;
import android.view.DragEvent;
import android.view.inputmethod.InputMethodManager;
import android.view.textclassifier.TextClassifier;
import android.widget.EditText;
import android.widget.TextView;
import com.google.android.gms.common.R;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public class X7 extends EditText implements QT {
    public final C2689v7 l;
    public final A8 m;
    public final DH n;

    /* renamed from: o, reason: collision with root package name */
    public final C1307gf0 f407o;
    public final C3040yr p;
    public W7 q;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public X7(Context context, AttributeSet attributeSet) {
        super(context, attributeSet, R.attr.editTextStyle);
        Gf0.a(context);
        AbstractC1498if0.a(this, getContext());
        C2689v7 c2689v7 = new C2689v7(this);
        this.l = c2689v7;
        c2689v7.m(attributeSet, R.attr.editTextStyle);
        A8 a8 = new A8(this);
        this.m = a8;
        a8.f(attributeSet, R.attr.editTextStyle);
        a8.b();
        DH dh = new DH();
        dh.l = this;
        this.n = dh;
        this.f407o = new C1307gf0();
        C3040yr c3040yr = new C3040yr(this);
        this.p = c3040yr;
        c3040yr.g(attributeSet, R.attr.editTextStyle);
        KeyListener keyListener = getKeyListener();
        if (keyListener instanceof NumberKeyListener) {
            return;
        }
        boolean zIsFocusable = super.isFocusable();
        boolean zIsClickable = super.isClickable();
        boolean zIsLongClickable = super.isLongClickable();
        int inputType = super.getInputType();
        KeyListener keyListenerD = c3040yr.d(keyListener);
        if (keyListenerD == keyListener) {
            return;
        }
        super.setKeyListener(keyListenerD);
        super.setRawInputType(inputType);
        super.setFocusable(zIsFocusable);
        super.setClickable(zIsClickable);
        super.setLongClickable(zIsLongClickable);
    }

    private W7 getSuperCaller() {
        if (this.q == null) {
            this.q = new W7(this);
        }
        return this.q;
    }

    @Override // o.QT
    public final C2271qm a(C2271qm c2271qm) {
        this.f407o.getClass();
        return C1307gf0.a(this, c2271qm);
    }

    @Override // android.widget.TextView, android.view.View
    public final void drawableStateChanged() {
        super.drawableStateChanged();
        C2689v7 c2689v7 = this.l;
        if (c2689v7 != null) {
            c2689v7.i();
        }
        A8 a8 = this.m;
        if (a8 != null) {
            a8.b();
        }
    }

    @Override // android.widget.TextView
    public ActionMode.Callback getCustomSelectionActionModeCallback() {
        return F3.V(super.getCustomSelectionActionModeCallback());
    }

    public ColorStateList getSupportBackgroundTintList() {
        C2689v7 c2689v7 = this.l;
        if (c2689v7 != null) {
            return c2689v7.j();
        }
        return null;
    }

    public PorterDuff.Mode getSupportBackgroundTintMode() {
        C2689v7 c2689v7 = this.l;
        if (c2689v7 != null) {
            return c2689v7.k();
        }
        return null;
    }

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

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

    @Override // android.widget.TextView
    public TextClassifier getTextClassifier() {
        DH dh;
        if (Build.VERSION.SDK_INT >= 28 || (dh = this.n) == null) {
            return super.getTextClassifier();
        }
        TextClassifier textClassifier = (TextClassifier) dh.m;
        return textClassifier == null ? AbstractC2596u8.a((TextView) dh.l) : textClassifier;
    }

    /* JADX WARN: Removed duplicated region for block: B:26:0x0060 A[PHI: r1
      0x0060: PHI (r1v10 java.lang.String[]) = (r1v5 java.lang.String[]), (r1v11 java.lang.String[]) binds: [B:33:0x0073, B:25:0x005e] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:38:0x007a  */
    @Override // android.widget.TextView, android.view.View
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public android.view.inputmethod.InputConnection onCreateInputConnection(android.view.inputmethod.EditorInfo r8) {
        /*
            r7 = this;
            android.view.inputmethod.InputConnection r0 = super.onCreateInputConnection(r8)
            o.A8 r1 = r7.m
            r1.getClass()
            int r1 = android.os.Build.VERSION.SDK_INT
            r2 = 30
            if (r1 >= r2) goto L18
            if (r0 == 0) goto L18
            java.lang.CharSequence r3 = r7.getText()
            o.AbstractC0752ap.c0(r8, r3)
        L18:
            o.AbstractC1155f00.B(r0, r8, r7)
            if (r0 == 0) goto L80
            if (r1 > r2) goto L80
            java.lang.String[] r2 = o.Oj0.g(r7)
            if (r2 == 0) goto L80
            java.lang.String r3 = "android.support.v13.view.inputmethod.EditorInfoCompat.CONTENT_MIME_TYPES"
            java.lang.String r4 = "androidx.core.view.inputmethod.EditorInfoCompat.CONTENT_MIME_TYPES"
            r5 = 25
            if (r1 < r5) goto L31
            o.AbstractC0955cv.q(r8, r2)
            goto L46
        L31:
            android.os.Bundle r6 = r8.extras
            if (r6 != 0) goto L3c
            android.os.Bundle r6 = new android.os.Bundle
            r6.<init>()
            r8.extras = r6
        L3c:
            android.os.Bundle r6 = r8.extras
            r6.putStringArray(r4, r2)
            android.os.Bundle r6 = r8.extras
            r6.putStringArray(r3, r2)
        L46:
            o.G1 r2 = new o.G1
            r6 = 10
            r2.<init>(r6, r7)
            if (r1 < r5) goto L56
            o.xH r1 = new o.xH
            r1.<init>(r0, r2)
        L54:
            r0 = r1
            goto L80
        L56:
            java.lang.String[] r6 = o.AbstractC0752ap.e
            if (r1 < r5) goto L62
            java.lang.String[] r1 = o.AbstractC0955cv.s(r8)
            if (r1 == 0) goto L76
        L60:
            r6 = r1
            goto L76
        L62:
            android.os.Bundle r1 = r8.extras
            if (r1 != 0) goto L67
            goto L76
        L67:
            java.lang.String[] r1 = r1.getStringArray(r4)
            if (r1 != 0) goto L73
            android.os.Bundle r1 = r8.extras
            java.lang.String[] r1 = r1.getStringArray(r3)
        L73:
            if (r1 == 0) goto L76
            goto L60
        L76:
            int r1 = r6.length
            if (r1 != 0) goto L7a
            goto L80
        L7a:
            o.yH r1 = new o.yH
            r1.<init>(r0, r2)
            goto L54
        L80:
            o.yr r1 = r7.p
            o.uv r8 = r1.h(r0, r8)
            return r8
        */
        throw new UnsupportedOperationException("Method not decompiled: o.X7.onCreateInputConnection(android.view.inputmethod.EditorInfo):android.view.inputmethod.InputConnection");
    }

    @Override // android.view.View
    public final void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        int i = Build.VERSION.SDK_INT;
        if (i < 30 || i >= 33) {
            return;
        }
        ((InputMethodManager) getContext().getSystemService("input_method")).isActive(this);
    }

    @Override // android.widget.TextView, android.view.View
    public final boolean onDragEvent(DragEvent dragEvent) {
        Activity activity;
        boolean zA = false;
        if (Build.VERSION.SDK_INT < 31 && dragEvent.getLocalState() == null && Oj0.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) {
                toString();
            } else if (dragEvent.getAction() != 1 && dragEvent.getAction() == 3) {
                zA = AbstractC1266g8.a(dragEvent, this, activity);
            }
        }
        if (zA) {
            return true;
        }
        return super.onDragEvent(dragEvent);
    }

    @Override // android.widget.EditText, android.widget.TextView
    public final boolean onTextContextMenuItem(int i) {
        InterfaceC1986nm od;
        int i2 = Build.VERSION.SDK_INT;
        if (i2 >= 31 || Oj0.g(this) == null || !(i == 16908322 || i == 16908337)) {
            return super.onTextContextMenuItem(i);
        }
        ClipboardManager clipboardManager = (ClipboardManager) getContext().getSystemService("clipboard");
        ClipData primaryClip = clipboardManager == null ? null : clipboardManager.getPrimaryClip();
        if (primaryClip != null && primaryClip.getItemCount() > 0) {
            if (i2 >= 31) {
                od = new OD(primaryClip, 1);
            } else {
                C2081om c2081om = new C2081om();
                c2081om.m = primaryClip;
                c2081om.n = 1;
                od = c2081om;
            }
            od.t(i == 16908322 ? 0 : 1);
            Oj0.i(this, od.build());
        }
        return true;
    }

    @Override // android.view.View
    public void setBackgroundDrawable(Drawable drawable) {
        super.setBackgroundDrawable(drawable);
        C2689v7 c2689v7 = this.l;
        if (c2689v7 != null) {
            c2689v7.o();
        }
    }

    @Override // android.view.View
    public void setBackgroundResource(int i) {
        super.setBackgroundResource(i);
        C2689v7 c2689v7 = this.l;
        if (c2689v7 != null) {
            c2689v7.p(i);
        }
    }

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

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

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

    public void setEmojiCompatEnabled(boolean z) {
        this.p.j(z);
    }

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

    public void setSupportBackgroundTintList(ColorStateList colorStateList) {
        C2689v7 c2689v7 = this.l;
        if (c2689v7 != null) {
            c2689v7.r(colorStateList);
        }
    }

    public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
        C2689v7 c2689v7 = this.l;
        if (c2689v7 != null) {
            c2689v7.s(mode);
        }
    }

    public void setSupportCompoundDrawablesTintList(ColorStateList colorStateList) {
        A8 a8 = this.m;
        a8.k(colorStateList);
        a8.b();
    }

    public void setSupportCompoundDrawablesTintMode(PorterDuff.Mode mode) {
        A8 a8 = this.m;
        a8.l(mode);
        a8.b();
    }

    @Override // android.widget.TextView
    public final void setTextAppearance(Context context, int i) {
        super.setTextAppearance(context, i);
        A8 a8 = this.m;
        if (a8 != null) {
            a8.g(context, i);
        }
    }

    @Override // android.widget.TextView
    public void setTextClassifier(TextClassifier textClassifier) {
        DH dh;
        if (Build.VERSION.SDK_INT >= 28 || (dh = this.n) == null) {
            super.setTextClassifier(textClassifier);
        } else {
            dh.m = textClassifier;
        }
    }

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