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

253 lines
8.5 KiB
Java

package com.scb.phone.view.custom.common;
import android.content.Context;
import android.text.Editable;
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.ImageButton;
import android.widget.RelativeLayout;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.scb.phone.R;
import com.scb.phone.view.custom.common.CustomATMInput;
import java.nio.charset.StandardCharsets;
import o.fKJ;
import o.nMh;
/* loaded from: classes5.dex */
public class CustomATMInput extends RelativeLayout {
private static int c = 0;
private static int d = 1;
private static byte e = 6;
private String a;
@BindView
public ScbEditText atmPin;
private Sts b;
@BindView
protected ImageButton clearButton;
@BindView
protected TextView mErrorValidation;
/* loaded from: classes5.dex */
public interface Sts {
void a(String str);
void e(boolean z);
}
private void f(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] ^ e);
}
objArr[0] = new String(bArr, StandardCharsets.UTF_8);
}
public CustomATMInput(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
((LayoutInflater) context.getSystemService("layout_inflater")).inflate(R.layout.2131558922, (ViewGroup) this, true);
ButterKnife.c(this);
this.atmPin.setLongClickable(false);
this.atmPin.setTextIsSelectable(false);
this.atmPin.setCustomSelectionActionModeCallback(new fKJ());
this.atmPin.addTextChangedListener(new TextWatcher(this) { // from class: com.scb.phone.view.custom.common.CustomATMInput.5
private CustomATMInput a;
@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.a = this;
}
@Override // android.text.TextWatcher
public final void afterTextChanged(Editable editable) {
this.a.a = editable.toString();
int length = this.a.a.length();
this.a.b.e(this.a.a());
this.a.clearButton.setVisibility(length > 0 ? 0 : 8);
this.a.b.a(this.a.a);
}
});
this.atmPin.setOnFocusChangeListener(new View.OnFocusChangeListener(this) { // from class: o.eBi
private CustomATMInput b;
@Override // android.view.View.OnFocusChangeListener
public final void onFocusChange(View view, boolean z) {
CustomATMInput.a(this.b, z);
}
{
this.b = this;
}
});
}
public void setStyle(int i, int i2) {
if (getContext() != null) {
this.atmPin.setBackground(nMh.getDrawable(getContext(), i));
this.atmPin.setTextColor(nMh.getColor(getContext(), i2));
}
}
public void setOnEditorActionListener(TextView.OnEditorActionListener onEditorActionListener) {
this.atmPin.setOnEditorActionListener(onEditorActionListener);
}
public void setHint(String str) {
this.atmPin.setHint(str);
}
public final boolean a() {
String str = this.a;
int length = str == null ? 0 : str.length();
if (length > 0) {
return length == 4 || length == 6;
}
return false;
}
public void setErrorValidationVisibility(int i) {
this.mErrorValidation.setVisibility(i);
}
/* JADX WARN: Code restructure failed: missing block: B:11:0x0035, code lost:
r3 = r5.substring(4);
r5 = new java.lang.Object[1];
f(r3, r5);
r5 = ((java.lang.String) r5[0]).intern();
r13 = r4.getText(r13);
*/
/* JADX WARN: Code restructure failed: missing block: B:12:0x004e, code lost:
if ((r13 instanceof android.text.Spanned) == false) goto L12;
*/
/* JADX WARN: Code restructure failed: missing block: B:13:0x0050, code lost:
r2 = new android.text.SpannableString(r5);
r13 = (android.text.SpannableString) r2;
android.text.TextUtils.copySpansFrom((android.text.SpannedString) r13, 0, r5.length(), java.lang.Object.class, r2, 0);
r5 = r2;
*/
/* JADX WARN: Code restructure failed: missing block: B:15:0x0033, code lost:
if (r5.startsWith(",*,)") != false) goto L9;
*/
/* JADX WARN: Code restructure failed: missing block: B:4:0x0022, code lost:
if (r5.startsWith(",*,)") != false) goto L9;
*/
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r2v5, types: [android.text.SpannableString, android.text.Spannable] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void setErrorInLine(int r13) {
/*
r12 = this;
r0 = 2
int r1 = r0 % r0
int r1 = com.scb.phone.view.custom.common.CustomATMInput.d
int r1 = r1 + 71
int r2 = r1 % 128
com.scb.phone.view.custom.common.CustomATMInput.c = r2
int r1 = r1 % r0
r2 = 0
java.lang.String r3 = ",*,)"
if (r1 == 0) goto L25
android.widget.TextView r1 = r12.mErrorValidation
android.content.Context r4 = r1.getContext()
java.lang.String r5 = r4.getString(r13)
boolean r3 = r5.startsWith(r3)
r6 = 21
int r6 = r6 / r2
if (r3 == 0) goto L68
goto L35
L25:
android.widget.TextView r1 = r12.mErrorValidation
android.content.Context r4 = r1.getContext()
java.lang.String r5 = r4.getString(r13)
boolean r3 = r5.startsWith(r3)
if (r3 == 0) goto L68
L35:
r3 = 4
java.lang.String r3 = r5.substring(r3)
r5 = 1
java.lang.Object[] r5 = new java.lang.Object[r5]
r12.f(r3, r5)
r2 = r5[r2]
java.lang.String r2 = (java.lang.String) r2
java.lang.String r5 = r2.intern()
java.lang.CharSequence r13 = r4.getText(r13)
boolean r2 = r13 instanceof android.text.Spanned
if (r2 == 0) goto L68
android.text.SpannableString r2 = new android.text.SpannableString
r2.<init>(r5)
r6 = r13
android.text.SpannedString r6 = (android.text.SpannedString) r6
r7 = 0
int r8 = r5.length()
java.lang.Class<java.lang.Object> r9 = java.lang.Object.class
r13 = r2
android.text.SpannableString r13 = (android.text.SpannableString) r13
r11 = 0
r10 = r2
android.text.TextUtils.copySpansFrom(r6, r7, r8, r9, r10, r11)
r5 = r2
L68:
r1.setText(r5)
int r13 = com.scb.phone.view.custom.common.CustomATMInput.c
int r13 = r13 + 45
int r1 = r13 % 128
com.scb.phone.view.custom.common.CustomATMInput.d = r1
int r13 = r13 % r0
if (r13 == 0) goto L77
return
L77:
r13 = 0
throw r13
*/
throw new UnsupportedOperationException("Method not decompiled: com.scb.phone.view.custom.common.CustomATMInput.setErrorInLine(int):void");
}
public void setATMNumber(String str) {
this.atmPin.setText(str);
}
@OnClick
public void onClearButtonClick() {
this.atmPin.setText("");
this.b.e(false);
}
public static /* synthetic */ void a(CustomATMInput customATMInput, boolean z) {
if (z) {
customATMInput.clearButton.setVisibility(TextUtils.isEmpty(customATMInput.atmPin.getText()) ? 8 : 0);
} else {
customATMInput.clearButton.setVisibility(8);
}
}
public void setCardInputListener(Sts sts) {
this.b = sts;
}
}