what-the-bank/sources/com/scb/phone/view/custom/common/ScbEditText.java

79 lines
2.6 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.custom.common;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.EditText;
import android.widget.TextView;
import androidx.appcompat.widget.AppCompatEditText;
import java.lang.reflect.Field;
import o.C6583cXR;
import o.guQ;
/* loaded from: classes5.dex */
public class ScbEditText extends AppCompatEditText {
private LWm b;
private boolean e;
/* loaded from: classes5.dex */
public interface LWm {
boolean apD_(EditText editText, String str);
}
public ScbEditText(Context context) {
super(context);
this.e = false;
}
public ScbEditText(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.e = false;
}
@Override // androidx.appcompat.widget.AppCompatEditText, android.widget.EditText, android.widget.TextView
public boolean onTextContextMenuItem(int i) {
ClipData primaryClip;
LWm lWm;
if (i == 16908322 && (primaryClip = ((ClipboardManager) getContext().getSystemService("clipboard")).getPrimaryClip()) != null && (lWm = this.b) != null) {
return lWm.apD_(this, primaryClip.getItemAt(0).coerceToText(getContext()).toString());
}
return super.onTextContextMenuItem(i);
}
@Override // android.widget.TextView, android.view.View
public boolean onTouchEvent(MotionEvent motionEvent) {
if (this.e && motionEvent.getAction() == 0) {
try {
Field declaredField = TextView.class.getDeclaredField("mEditor");
declaredField.setAccessible(true);
Object obj = declaredField.get(this);
Field declaredField2 = Class.forName("android.widget.Editor").getDeclaredField("mInsertionControllerEnabled");
declaredField2.setAccessible(true);
declaredField2.set(obj, Boolean.FALSE);
} catch (Exception e) {
guQ.e(e);
}
}
return super.onTouchEvent(motionEvent);
}
/* loaded from: classes5.dex */
public static class HBt implements LWm {
@Override // com.scb.phone.view.custom.common.ScbEditText.LWm
public final boolean apD_(EditText editText, String str) {
editText.setText(C6583cXR.n(str));
return true;
}
}
public void setOnPasteListener(LWm lWm) {
this.b = lWm;
}
public void setBlockInsertion(boolean z) {
this.e = z;
}
}