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

244 lines
8.6 KiB
Java
Raw Permalink 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.graphics.drawable.Drawable;
import android.text.Editable;
import android.text.InputFilter;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.SpannedString;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.util.Base64;
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.ScbEditText;
import com.scb.phone.view.custom.easycash.CustomPhone;
import java.nio.charset.StandardCharsets;
import o.C15715hv;
import o.C6583cXR;
import o.InterfaceC10373eCZ;
import o.URz;
import o.nMh;
/* loaded from: classes5.dex */
public class CustomPhone extends RelativeLayout {
private static byte g = 6;
private static int m = 1;
/* renamed from: o, reason: collision with root package name */
private static int f8021o;
public boolean a;
private InputFilter[] b;
private boolean c;
public String d;
private InputFilter[] e;
@BindView
protected TextView errorValidation;
private TextWatcher f;
private String h;
private String i;
private InterfaceC10373eCZ j;
@BindView
TextView proxyLabel;
@BindView
ScbEditText proxyNumberField;
private void k(String str, Object[] objArr) {
byte[] decode = Base64.decode(str, 0);
byte[] bArr = new byte[decode.length];
for (int i = 0; i < decode.length; i++) {
bArr[i] = (byte) (decode[(decode.length - i) - 1] ^ g);
}
objArr[0] = new String(bArr, StandardCharsets.UTF_8);
}
public CustomPhone(Context context) {
this(context, null);
}
public CustomPhone(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public CustomPhone(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.c = true;
((LayoutInflater) context.getSystemService("layout_inflater")).inflate(R.layout.2131559288, (ViewGroup) this, true);
ButterKnife.c(this);
if (attributeSet != null) {
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, C15715hv.jbe.PhoneNumber);
if (obtainStyledAttributes.getString(0) != null) {
this.proxyNumberField.setHint(obtainStyledAttributes.getString(0));
}
if (obtainStyledAttributes.getString(3) != null) {
this.proxyLabel.setText(obtainStyledAttributes.getString(3));
}
if (obtainStyledAttributes.getString(1) != null) {
String string = obtainStyledAttributes.getString(1);
this.h = string;
this.errorValidation.setText(string);
}
obtainStyledAttributes.recycle();
}
URz.we_(this.errorValidation, R.style.f56002132017858);
}
/* JADX INFO: Access modifiers changed from: private */
public void a(String str) {
String replace = str.replace("-", "");
this.d = replace;
InterfaceC10373eCZ interfaceC10373eCZ = this.j;
this.a = interfaceC10373eCZ != null && interfaceC10373eCZ.e(replace);
}
private void d() {
InterfaceC10373eCZ interfaceC10373eCZ = this.j;
if (interfaceC10373eCZ != null) {
if (interfaceC10373eCZ.e(TextUtils.isEmpty(this.d) ? "" : this.d)) {
String str = (String) C6583cXR.c(new Object[]{false, true, TextUtils.isEmpty(this.d) ? "" : this.d}, -1092823629, 1092823630, (int) System.currentTimeMillis());
this.proxyNumberField.setFilters(this.e);
this.proxyNumberField.setText(str);
d(false);
return;
}
}
if (TextUtils.isEmpty(TextUtils.isEmpty(this.d) ? "" : this.d)) {
this.errorValidation.setText(this.h);
} else {
this.errorValidation.setText(this.i);
}
this.proxyNumberField.setText(TextUtils.isEmpty(this.d) ? "" : this.d);
d(true);
}
public final void a() {
this.proxyNumberField.setText("");
d(false);
}
private void d(boolean z) {
if (this.c) {
if (z) {
this.errorValidation.setVisibility(0);
this.proxyNumberField.setBackground(nMh.getDrawable(getContext(), R.drawable.shape_red_reounded_reactangle_border));
} else {
this.errorValidation.setVisibility(8);
this.proxyNumberField.setBackground(nMh.getDrawable(getContext(), R.drawable.shape_gray_rounded_rectangle));
}
}
}
public void setTextFieldBackground(Drawable drawable) {
this.proxyNumberField.setBackground(drawable);
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r2v9, types: [android.text.SpannableString, android.text.Spannable] */
public void setProxyLabel(int i) {
int i2 = 2 % 2;
int i3 = m + 67;
f8021o = i3 % 128;
if (i3 % 2 != 0) {
this.proxyLabel.getContext().getString(i).startsWith(",*,)");
Object obj = null;
obj.hashCode();
throw null;
}
TextView textView = this.proxyLabel;
Context context = textView.getContext();
String string = context.getString(i);
if (string.startsWith(",*,)")) {
String substring = string.substring(4);
Object[] objArr = new Object[1];
k(substring, objArr);
string = ((String) objArr[0]).intern();
CharSequence text = context.getText(i);
if (text instanceof Spanned) {
?? spannableString = new SpannableString(string);
TextUtils.copySpansFrom((SpannedString) text, 0, string.length(), Object.class, spannableString, 0);
string = spannableString;
}
}
textView.setText(string);
int i4 = f8021o + 119;
m = i4 % 128;
int i5 = i4 % 2;
}
public static /* synthetic */ void a(CustomPhone customPhone, boolean z) {
if (z) {
customPhone.proxyNumberField.setFilters(customPhone.b);
customPhone.d(false);
customPhone.proxyNumberField.setText(TextUtils.isEmpty(customPhone.d) ? "" : customPhone.d);
customPhone.proxyNumberField.addTextChangedListener(customPhone.f);
return;
}
customPhone.proxyNumberField.removeTextChangedListener(customPhone.f);
customPhone.d = customPhone.proxyNumberField.getText().toString();
customPhone.d();
}
public void setNecessaryInfo(String str, String str2, InterfaceC10373eCZ interfaceC10373eCZ) {
this.j = interfaceC10373eCZ;
this.f = new TextWatcher(this) { // from class: com.scb.phone.view.custom.easycash.CustomPhone.1
private CustomPhone c;
@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.c = this;
}
@Override // android.text.TextWatcher
public final void afterTextChanged(Editable editable) {
this.c.a(editable.toString());
}
};
if (TextUtils.isEmpty(this.h)) {
this.h = this.errorValidation.getText().toString();
}
this.i = str2;
this.b = new InputFilter[]{new InputFilter.LengthFilter(10)};
this.e = new InputFilter[]{new InputFilter.LengthFilter(12)};
if (!TextUtils.isEmpty(str)) {
a(str);
d();
}
this.proxyNumberField.setOnFocusChangeListener(new View.OnFocusChangeListener(this) { // from class: o.eCY
private CustomPhone a;
@Override // android.view.View.OnFocusChangeListener
public final void onFocusChange(View view, boolean z) {
CustomPhone.a(this.a, z);
}
{
this.a = this;
}
});
this.proxyNumberField.setOnPasteListener(new ScbEditText.HBt());
}
public void setEnableInlineError(boolean z) {
this.c = z;
}
}