package com.scb.phone.view.custom.hml; import android.content.Context; import android.util.AttributeSet; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; 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.hml.CustomDecimalAmountVerification; import o.C14957gcv; import o.fJJ; /* loaded from: classes5.dex */ public final class CustomDecimalAmountVerification extends LinearLayout { private IeS c; @BindView public LinearLayout container; @BindView public CustomEditText editText; /* loaded from: classes5.dex */ public interface IeS { void c(); void d(); void d(String str, boolean z); void e(boolean z); } public CustomDecimalAmountVerification(Context context) { super(context); b(); } public CustomDecimalAmountVerification(Context context, AttributeSet attributeSet) { super(context, attributeSet); b(); } public CustomDecimalAmountVerification(Context context, AttributeSet attributeSet, int i) { super(context, attributeSet, i); b(); } private final void b() { LayoutInflater.from(getContext()).inflate(R.layout.2131558987, (ViewGroup) this, true); ButterKnife.c(this, this); e(); } private final void e() { CustomEditText customEditText = this.editText; CustomEditText customEditText2 = null; if (customEditText == null) { C14957gcv.a(""); customEditText = null; } customEditText.setLongClickable(false); CustomEditText customEditText3 = this.editText; if (customEditText3 == null) { C14957gcv.a(""); customEditText3 = null; } customEditText3.setTextIsSelectable(true); CustomEditText customEditText4 = this.editText; if (customEditText4 == null) { C14957gcv.a(""); customEditText4 = null; } customEditText4.setFocusable(true); CustomEditText customEditText5 = this.editText; if (customEditText5 == null) { C14957gcv.a(""); customEditText5 = null; } customEditText5.setImeOptions(6); CustomEditText customEditText6 = this.editText; if (customEditText6 == null) { C14957gcv.a(""); customEditText6 = null; } customEditText6.setOnKeyListener(new View.OnKeyListener(this) { // from class: o.eDa private CustomDecimalAmountVerification e; @Override // android.view.View.OnKeyListener public final boolean onKey(View view, int i, KeyEvent keyEvent) { return CustomDecimalAmountVerification.apI_(this.e, keyEvent); } { this.e = this; } }); CustomEditText customEditText7 = this.editText; if (customEditText7 == null) { C14957gcv.a(""); customEditText7 = null; } customEditText7.setOnEditorActionListener(new TextView.OnEditorActionListener(this) { // from class: o.eDf private CustomDecimalAmountVerification b; @Override // android.widget.TextView.OnEditorActionListener public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { return CustomDecimalAmountVerification.a(this.b, i); } { this.b = this; } }); CustomEditText customEditText8 = this.editText; if (customEditText8 == null) { C14957gcv.a(""); customEditText8 = null; } customEditText8.addTextChangedListener(new Sts(this)); CustomEditText customEditText9 = this.editText; if (customEditText9 != null) { customEditText2 = customEditText9; } else { C14957gcv.a(""); } customEditText2.setOnFocusChangeListener(new View.OnFocusChangeListener(this) { // from class: o.eDe private CustomDecimalAmountVerification a; @Override // android.view.View.OnFocusChangeListener public final void onFocusChange(View view, boolean z) { CustomDecimalAmountVerification.c(this.a, z); } { this.a = this; } }); } /* loaded from: classes5.dex */ public static final class Sts extends fJJ { private CustomDecimalAmountVerification d; Sts(CustomDecimalAmountVerification customDecimalAmountVerification) { this.d = customDecimalAmountVerification; } @Override // o.fJJ, android.text.TextWatcher public final void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { IeS ieS = this.d.c; if (ieS != null) { String valueOf = String.valueOf(charSequence); boolean z = false; if (charSequence != null && charSequence.length() == 2) { z = true; } ieS.d(valueOf, z); } } } public final void c(boolean z) { LinearLayout linearLayout = null; if (z) { LinearLayout linearLayout2 = this.container; if (linearLayout2 != null) { linearLayout = linearLayout2; } else { C14957gcv.a(""); } linearLayout.setBackgroundResource(R.drawable.bg_error_line_rounded_corners); return; } LinearLayout linearLayout3 = this.container; if (linearLayout3 != null) { linearLayout = linearLayout3; } else { C14957gcv.a(""); } linearLayout.setBackgroundResource(R.drawable.bg_lightgray_line_rounded_corners); } public static /* synthetic */ boolean apI_(CustomDecimalAmountVerification customDecimalAmountVerification, KeyEvent keyEvent) { IeS ieS; C14957gcv.e(customDecimalAmountVerification, ""); if (keyEvent == null || keyEvent.getAction() != 1) { return false; } if ((keyEvent.getKeyCode() != 16 && keyEvent.getKeyCode() != 4) || (ieS = customDecimalAmountVerification.c) == null) { return false; } ieS.d(); return false; } public static /* synthetic */ void c(CustomDecimalAmountVerification customDecimalAmountVerification, boolean z) { C14957gcv.e(customDecimalAmountVerification, ""); if (z) { IeS ieS = customDecimalAmountVerification.c; if (ieS != null) { ieS.c(); return; } return; } IeS ieS2 = customDecimalAmountVerification.c; if (ieS2 != null) { CustomEditText customEditText = customDecimalAmountVerification.editText; if (customEditText == null) { C14957gcv.a(""); customEditText = null; } ieS2.e(String.valueOf(customEditText.getText()).length() == 2); } } public static /* synthetic */ boolean a(CustomDecimalAmountVerification customDecimalAmountVerification, int i) { IeS ieS; C14957gcv.e(customDecimalAmountVerification, ""); if (i != 6 || (ieS = customDecimalAmountVerification.c) == null) { return false; } ieS.d(); return false; } public final void setInputCodeListener(IeS ieS) { C14957gcv.e(ieS, ""); this.c = ieS; } public final void setEditText(CustomEditText customEditText) { C14957gcv.e(customEditText, ""); this.editText = customEditText; } public final void setContainer(LinearLayout linearLayout) { C14957gcv.e(linearLayout, ""); this.container = linearLayout; } }