package com.scb.phone.view.custom.common; import android.content.Context; import android.content.res.TypedArray; import android.text.InputFilter; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import com.scb.phone.R; import o.C12919fLP; import o.C15715hv; import o.fJJ; import o.nMh; /* loaded from: classes5.dex */ public class CustomLaserIdInput extends RelativeLayout { private HBt b; @BindView public EditText etLaserIdFirst; @BindView public EditText etLaserIdSecond; @BindView public EditText etLaserIdThird; @BindView View laserIdHeader; @BindView ImageView laserIdHelpButton; @BindView public TextView tvLaserIdError; @BindView TextView tvLaserIdTitle; /* loaded from: classes5.dex */ public interface HBt { void t(); } public CustomLaserIdInput(Context context) { this(context, null); } public CustomLaserIdInput(Context context, AttributeSet attributeSet) { this(context, attributeSet, 0); } public CustomLaserIdInput(Context context, AttributeSet attributeSet, int i) { super(context, attributeSet, i); LayoutInflater.from(getContext()).inflate(R.layout.2131559257, (ViewGroup) this, true); ButterKnife.c(this); this.etLaserIdFirst.setFilters(new InputFilter[]{new C12919fLP("^[a-zA-Z .'-]+$")}); this.etLaserIdFirst.addTextChangedListener(new LWm(this, 3, this.etLaserIdSecond)); this.etLaserIdFirst.setFilters(new InputFilter[]{new InputFilter.AllCaps(), new InputFilter.LengthFilter(3)}); this.etLaserIdSecond.addTextChangedListener(new LWm(this, 7, this.etLaserIdThird)); this.etLaserIdSecond.setFilters(new InputFilter[]{new InputFilter.AllCaps(), new InputFilter.LengthFilter(7)}); this.etLaserIdThird.setFilters(new InputFilter[]{new InputFilter.AllCaps(), new InputFilter.LengthFilter(2)}); if (attributeSet != null) { TypedArray obtainStyledAttributes = getContext().getTheme().obtainStyledAttributes(attributeSet, C15715hv.jbe.CustomLaserIdInput, 0, 0); try { this.tvLaserIdError.setText(obtainStyledAttributes.getString(0)); this.tvLaserIdTitle.setText(obtainStyledAttributes.getString(1)); } finally { obtainStyledAttributes.recycle(); } } } @Override // android.view.ViewGroup, android.view.View public void clearFocus() { super.clearFocus(); this.tvLaserIdError.setFocusable(true); this.tvLaserIdError.setFocusableInTouchMode(true); this.tvLaserIdError.requestFocus(); } public void setFocusListener(View.OnFocusChangeListener onFocusChangeListener) { this.etLaserIdFirst.setOnFocusChangeListener(onFocusChangeListener); this.etLaserIdSecond.setOnFocusChangeListener(onFocusChangeListener); this.etLaserIdThird.setOnFocusChangeListener(onFocusChangeListener); } public void setError(String str) { this.tvLaserIdError.setText(str); } public final void d(boolean z) { int i = !z ? R.drawable.shape_red_reounded_reactangle_border : R.drawable.shape_gray_rounded_rectangle; this.etLaserIdFirst.setBackground(nMh.getDrawable(getContext(), i)); this.etLaserIdSecond.setBackground(nMh.getDrawable(getContext(), i)); this.etLaserIdThird.setBackground(nMh.getDrawable(getContext(), i)); } public final String c() { StringBuilder sb = new StringBuilder(); sb.append(this.etLaserIdFirst.getText().toString()); sb.append(this.etLaserIdSecond.getText().toString()); sb.append(this.etLaserIdThird.getText().toString()); return sb.toString(); } public void setLaserId(String str) { this.etLaserIdFirst.setText(str.substring(0, 3)); this.etLaserIdSecond.setText(str.substring(3, 10)); this.etLaserIdThird.setText(str.substring(10, 12)); } @OnClick public void onLaserIdButtonClicked(View view) { HBt hBt = this.b; if (hBt != null) { hBt.t(); } } public void setLaserIdButtonVisibility(boolean z) { this.laserIdHelpButton.setVisibility(z ? 0 : 8); } /* loaded from: classes5.dex */ class LWm extends fJJ { private int a; private CustomLaserIdInput d; private EditText e; public LWm(CustomLaserIdInput customLaserIdInput, int i, EditText editText) { this.d = customLaserIdInput; this.a = i; this.e = editText; } @Override // o.fJJ, android.text.TextWatcher public final void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { EditText editText; if (charSequence.length() != this.a || (editText = this.e) == null || i3 > 1) { return; } editText.requestFocus(); } } public void setOnLaserIdListener(HBt hBt) { this.b = hBt; } }