package com.scb.phone.view.custom.common; import android.content.Context; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.text.TextUtils; 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.CustomCardInformationInput; import java.nio.charset.StandardCharsets; import o.fKJ; import o.fLJ; import o.nMh; /* loaded from: classes5.dex */ public class CustomCardInformationInput extends RelativeLayout { private static int b = 1; private static byte d = 6; private static int e; private Sts a; private boolean c; @BindView public ScbEditText cardNoInputField; @BindView protected ImageButton clearButton; @BindView public TextView headerLabel; @BindView protected TextView mErrorValidation; /* loaded from: classes5.dex */ public interface Sts { void a(String str); void b(boolean z); String c(String str); void d(); void d(boolean z); void e(String str); } 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] ^ d); } objArr[0] = new String(bArr, StandardCharsets.UTF_8); } public CustomCardInformationInput(Context context, AttributeSet attributeSet) { super(context, attributeSet); ((LayoutInflater) context.getSystemService("layout_inflater")).inflate(R.layout.2131558921, (ViewGroup) this, true); ButterKnife.c(this); this.clearButton.setFocusable(false); this.cardNoInputField.setLongClickable(false); this.cardNoInputField.setTextIsSelectable(false); this.cardNoInputField.setCustomSelectionActionModeCallback(new fKJ()); this.cardNoInputField.setBlockInsertion(true); ScbEditText scbEditText = this.cardNoInputField; fLJ flj = new fLJ(scbEditText, "XXXX XXXX XXXX XXXX", new fLJ.Sts(this) { // from class: o.eBm private CustomCardInformationInput b; @Override // o.fLJ.Sts public final String c(String str) { String c; c = this.b.a.c(str); return c; } { this.b = this; } }); flj.b = new fLJ.IeS(this) { // from class: com.scb.phone.view.custom.common.CustomCardInformationInput.3 private CustomCardInformationInput d; { this.d = this; } @Override // o.fLJ.IeS public final void b(String str) { String replace = str.replace(" ", ""); this.d.a.d(true); this.d.a.e(replace); } @Override // o.fLJ.IeS public final void e(String str) { String replace = str.replace(" ", ""); int length = replace.length(); if ((this.d.c && !replace.isEmpty()) || (!this.d.c && replace.isEmpty())) { this.d.c = replace.isEmpty(); Sts unused = this.d.a; boolean unused2 = this.d.c; } if (length > 0) { if (length == 6) { this.d.a.a(replace); this.d.a.d(false); } else if (length < 6) { this.d.setIcon(R.drawable.ic_sample_card); this.d.a.d(false); this.d.a.b(false); } else { this.d.setErrorValidationVisibility(8); this.d.a.d(); this.d.a.d(false); } this.d.clearButton.setVisibility(0); return; } this.d.a.a(replace); this.d.clearButton.setVisibility(8); this.d.a.b(replace.isEmpty()); } }; scbEditText.addTextChangedListener(flj); this.cardNoInputField.setOnFocusChangeListener(new View.OnFocusChangeListener(this) { // from class: o.eBn private CustomCardInformationInput a; @Override // android.view.View.OnFocusChangeListener public final void onFocusChange(View view, boolean z) { CustomCardInformationInput.a(this.a, z); } { this.a = this; } }); } public void setRegularText() { if (getContext() != null) { this.cardNoInputField.setTypeface(Typeface.createFromAsset(getContext().getAssets(), "fonts/db_heavent_regular.ttf")); } } public void setStyle(int i, int i2) { if (getContext() != null) { this.cardNoInputField.setBackground(nMh.getDrawable(getContext(), i)); this.cardNoInputField.setTextColor(nMh.getColor(getContext(), i2)); } } public void setCardNoEditorActionListener(TextView.OnEditorActionListener onEditorActionListener) { this.cardNoInputField.setOnEditorActionListener(onEditorActionListener); } public void setIcon(int i) { this.cardNoInputField.setCompoundDrawablesWithIntrinsicBounds(i, 0, 0, 0); } public void setIcon(Drawable drawable) { this.cardNoInputField.setCompoundDrawablesWithIntrinsicBounds(drawable, (Drawable) null, (Drawable) null, (Drawable) null); } public void setLabel(String str) { this.headerLabel.setText(str); } public void setHint(String str) { this.cardNoInputField.setHint(str); } public void setErrorValidationVisibility(int i) { this.mErrorValidation.setVisibility(i); } /* JADX WARN: Code restructure failed: missing block: B:13:0x0035, code lost: if (r6.startsWith(",*,)") != false) goto L9; */ /* JADX WARN: Code restructure failed: missing block: B:4:0x0024, code lost: if ((!r6.startsWith(",*,)")) != false) goto L13; */ /* JADX WARN: Code restructure failed: missing block: B:5:0x0037, code lost: r2 = new java.lang.Object[1]; f(r6.substring(4), r2); r6 = ((java.lang.String) r2[0]).intern(); r14 = r5.getText(r14); */ /* JADX WARN: Code restructure failed: missing block: B:6:0x004f, code lost: if ((r14 instanceof android.text.Spanned) == false) goto L12; */ /* JADX WARN: Code restructure failed: missing block: B:7:0x0051, code lost: r0 = new android.text.SpannableString(r6); r14 = (android.text.SpannableString) r0; android.text.TextUtils.copySpansFrom((android.text.SpannedString) r14, 0, r6.length(), java.lang.Object.class, r0, 0); r6 = r0; */ /* JADX WARN: Code restructure failed: missing block: B:8:0x006a, code lost: r14 = com.scb.phone.view.custom.common.CustomCardInformationInput.e + 85; com.scb.phone.view.custom.common.CustomCardInformationInput.b = r14 % 128; r14 = r14 % 2; */ /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Type inference failed for: r0v1, 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 r14) { /* r13 = this; r0 = 2 int r1 = r0 % r0 int r1 = com.scb.phone.view.custom.common.CustomCardInformationInput.e int r1 = r1 + 93 int r2 = r1 % 128 com.scb.phone.view.custom.common.CustomCardInformationInput.b = r2 int r1 = r1 % r0 r2 = 1 r3 = 0 java.lang.String r4 = ",*,)" if (r1 != 0) goto L27 android.widget.TextView r1 = r13.mErrorValidation android.content.Context r5 = r1.getContext() java.lang.String r6 = r5.getString(r14) boolean r4 = r6.startsWith(r4) r7 = 92 int r7 = r7 / r3 r4 = r4 ^ r2 if (r4 == 0) goto L37 goto L73 L27: android.widget.TextView r1 = r13.mErrorValidation android.content.Context r5 = r1.getContext() java.lang.String r6 = r5.getString(r14) boolean r4 = r6.startsWith(r4) if (r4 == 0) goto L73 L37: r4 = 4 java.lang.String r4 = r6.substring(r4) java.lang.Object[] r2 = new java.lang.Object[r2] r13.f(r4, r2) r2 = r2[r3] java.lang.String r2 = (java.lang.String) r2 java.lang.String r6 = r2.intern() java.lang.CharSequence r14 = r5.getText(r14) boolean r2 = r14 instanceof android.text.Spanned if (r2 == 0) goto L6a android.text.SpannableString r0 = new android.text.SpannableString r0.(r6) r7 = r14 android.text.SpannedString r7 = (android.text.SpannedString) r7 r8 = 0 int r9 = r6.length() java.lang.Class r10 = java.lang.Object.class r14 = r0 android.text.SpannableString r14 = (android.text.SpannableString) r14 r12 = 0 r11 = r0 android.text.TextUtils.copySpansFrom(r7, r8, r9, r10, r11, r12) r6 = r0 goto L73 L6a: int r14 = com.scb.phone.view.custom.common.CustomCardInformationInput.e int r14 = r14 + 85 int r2 = r14 % 128 com.scb.phone.view.custom.common.CustomCardInformationInput.b = r2 int r14 = r14 % r0 L73: r1.setText(r6) return */ throw new UnsupportedOperationException("Method not decompiled: com.scb.phone.view.custom.common.CustomCardInformationInput.setErrorInLine(int):void"); } public void setHeaderVisibility(int i) { this.headerLabel.setVisibility(i); } public void setCardNumber(String str) { this.cardNoInputField.setText(str); } @OnClick public void onClearButtonClick() { setErrorValidationVisibility(8); this.a.d(); this.a.d(false); this.cardNoInputField.setText(""); } public void setOnFocusLostListener(final Runnable runnable) { this.cardNoInputField.setOnFocusChangeListener(new View.OnFocusChangeListener(this, runnable) { // from class: o.eBo private Runnable a; private CustomCardInformationInput c; @Override // android.view.View.OnFocusChangeListener public final void onFocusChange(View view, boolean z) { CustomCardInformationInput.a(this.c, this.a, z); } { this.c = this; this.a = runnable; } }); } public final void e() { this.clearButton.setVisibility(8); } public static /* synthetic */ void a(CustomCardInformationInput customCardInformationInput, Runnable runnable, boolean z) { if (!z) { customCardInformationInput.clearButton.setVisibility(8); runnable.run(); } else { customCardInformationInput.clearButton.setVisibility(TextUtils.isEmpty(customCardInformationInput.cardNoInputField.getText()) ? 8 : 0); } } public static /* synthetic */ void a(CustomCardInformationInput customCardInformationInput, boolean z) { if (z) { customCardInformationInput.clearButton.setVisibility(TextUtils.isEmpty(customCardInformationInput.cardNoInputField.getText()) ? 8 : 0); } else { customCardInformationInput.clearButton.setVisibility(8); } } public void setCardInputListener(Sts sts) { this.a = sts; } }