what-the-bank/sources/com/scb/phone/view/custom/easycash/CustomEmail.java

211 lines
7.1 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.custom.easycash;
import android.content.Context;
import android.content.res.TypedArray;
import android.text.Editable;
import android.text.InputFilter;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.scb.phone.R;
import com.scb.phone.view.custom.common.CustomEditText;
import com.scb.phone.view.custom.easycash.CustomEmail;
import o.C15715hv;
import o.InterfaceC10373eCZ;
import o.URz;
import o.nMh;
/* loaded from: classes5.dex */
public class CustomEmail extends RelativeLayout {
private String a;
private InterfaceC10373eCZ b;
private String d;
private int e;
@BindView
CustomEditText emailEditText;
@BindView
TextView errorText;
@BindView
TextView titleText;
public CustomEmail(Context context) {
this(context, null);
}
public CustomEmail(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public CustomEmail(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.e = 100;
((LayoutInflater) context.getSystemService("layout_inflater")).inflate(R.layout.2131559008, (ViewGroup) this, true);
ButterKnife.c(this);
if (attributeSet != null) {
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, C15715hv.jbe.EmailText);
this.e = obtainStyledAttributes.getInteger(2, this.e);
if (obtainStyledAttributes.getString(3) != null) {
this.titleText.setText(obtainStyledAttributes.getString(3));
}
if (obtainStyledAttributes.getString(0) != null) {
this.emailEditText.setHint(obtainStyledAttributes.getString(0));
}
if (obtainStyledAttributes.getString(1) != null) {
String string = obtainStyledAttributes.getString(1);
this.a = string;
this.errorText.setText(string);
}
obtainStyledAttributes.recycle();
}
this.emailEditText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(this.e), new InputFilter() { // from class: o.eDb
@Override // android.text.InputFilter
public final CharSequence filter(CharSequence charSequence, int i2, int i3, Spanned spanned, int i4, int i5) {
CharSequence lowerCase;
lowerCase = String.valueOf(charSequence).toLowerCase();
return lowerCase;
}
}});
URz.we_(this.errorText, R.style.f56002132017858);
}
public void setNecessaryInfo(String str, String str2, InterfaceC10373eCZ interfaceC10373eCZ) {
this.b = interfaceC10373eCZ;
if (TextUtils.isEmpty(this.a)) {
this.a = this.errorText.getText().toString();
}
this.d = str2;
if (!TextUtils.isEmpty(str)) {
this.emailEditText.setText(str);
c();
}
this.emailEditText.setOnBackListener(new CustomEditText.LWm(this) { // from class: o.eCX
private CustomEmail d;
@Override // com.scb.phone.view.custom.common.CustomEditText.LWm
public final void a() {
this.d.c();
}
{
this.d = this;
}
});
this.emailEditText.setOnEditorActionListener(new TextView.OnEditorActionListener(this) { // from class: o.eCV
private CustomEmail e;
@Override // android.widget.TextView.OnEditorActionListener
public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
return CustomEmail.d(this.e, i);
}
{
this.e = this;
}
});
this.emailEditText.setOnFocusChangeListener(new View.OnFocusChangeListener(this) { // from class: o.eCW
private CustomEmail a;
@Override // android.view.View.OnFocusChangeListener
public final void onFocusChange(View view, boolean z) {
CustomEmail.a(this.a, z);
}
{
this.a = this;
}
});
this.emailEditText.addTextChangedListener(new TextWatcher(this) { // from class: com.scb.phone.view.custom.easycash.CustomEmail.2
private CustomEmail e;
@Override // android.text.TextWatcher
public final void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override // android.text.TextWatcher
public final void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
{
this.e = this;
}
@Override // android.text.TextWatcher
public final void afterTextChanged(Editable editable) {
this.e.b(false);
this.e.b.e(editable.toString());
}
});
this.emailEditText.setOnPasteListener(new CustomEditText.IeS(this) { // from class: o.eCT
private CustomEmail d;
@Override // com.scb.phone.view.custom.common.CustomEditText.IeS
public final boolean e(CustomEditText customEditText, String str3) {
return CustomEmail.d(this.d, str3);
}
{
this.d = this;
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public void c() {
String obj = this.emailEditText.getText().toString();
if (!TextUtils.isEmpty(obj) && this.b.e(obj)) {
b(false);
return;
}
if (TextUtils.isEmpty(this.emailEditText.getText().toString())) {
this.errorText.setText(this.a);
} else {
this.errorText.setText(this.d);
}
b(true);
}
/* JADX INFO: Access modifiers changed from: private */
public void b(boolean z) {
if (z) {
this.errorText.setVisibility(0);
this.emailEditText.setBackground(nMh.getDrawable(getContext(), R.drawable.shape_red_reounded_reactangle_border));
} else {
this.errorText.setVisibility(8);
this.emailEditText.setBackground(nMh.getDrawable(getContext(), R.drawable.shape_gray_rounded_rectangle));
}
}
public static /* synthetic */ boolean d(CustomEmail customEmail, int i) {
if (i != 6) {
return false;
}
customEmail.c();
return false;
}
public static /* synthetic */ boolean d(CustomEmail customEmail, String str) {
customEmail.emailEditText.setText(str);
return true;
}
public static /* synthetic */ void a(CustomEmail customEmail, boolean z) {
if (z) {
customEmail.b(false);
} else {
customEmail.c();
}
}
}