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

92 lines
2.8 KiB
Java

package com.scb.phone.view.custom.common;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.text.InputFilter;
import android.util.AttributeSet;
import android.view.KeyEvent;
import androidx.appcompat.widget.AppCompatEditText;
import com.scb.phone.R;
import java.util.ArrayList;
import java.util.Arrays;
import o.C12919fLP;
import o.nMh;
/* loaded from: classes5.dex */
public class CustomEditText extends AppCompatEditText {
private LWm a;
private IeS b;
/* loaded from: classes5.dex */
public interface IeS {
boolean e(CustomEditText customEditText, String str);
}
/* loaded from: classes5.dex */
public interface LWm {
void a();
}
public CustomEditText(Context context) {
super(context);
}
public CustomEditText(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
public CustomEditText(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
}
@Override // android.widget.TextView, android.view.View
public boolean onKeyPreIme(int i, KeyEvent keyEvent) {
LWm lWm;
if (i == 4 && keyEvent.getAction() == 1 && (lWm = this.a) != null) {
lWm.a();
}
return super.dispatchKeyEvent(keyEvent);
}
@Override // androidx.appcompat.widget.AppCompatEditText, android.widget.EditText, android.widget.TextView
public boolean onTextContextMenuItem(int i) {
if (i == 16908322) {
ClipData primaryClip = ((ClipboardManager) getContext().getSystemService("clipboard")).getPrimaryClip();
if (this.b != null && primaryClip != null) {
return this.b.e(this, primaryClip.getItemAt(0).coerceToText(getContext()).toString());
}
}
return super.onTextContextMenuItem(i);
}
public void setFilter(String str) {
if (str != null) {
C12919fLP c12919fLP = new C12919fLP(str);
if (getFilters() == null) {
setFilters(new InputFilter[]{c12919fLP});
return;
}
ArrayList arrayList = new ArrayList(Arrays.asList(getFilters()));
arrayList.add(c12919fLP);
setFilters((InputFilter[]) arrayList.toArray(new InputFilter[arrayList.size()]));
}
}
public final void e(boolean z) {
if (z) {
setBackground(nMh.getDrawable(getContext(), R.drawable.shape_gray_rounded_rectangle));
} else {
setBackground(nMh.getDrawable(getContext(), R.drawable.shape_red_reounded_reactangle_border));
}
}
public void setOnPasteListener(IeS ieS) {
this.b = ieS;
}
public void setOnBackListener(LWm lWm) {
this.a = lWm;
}
}