package com.scb.phone.view.fragment.ntb; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.text.Editable; import android.text.InputFilter; import android.text.TextWatcher; import android.text.method.DigitsKeyListener; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; import androidx.viewpager.widget.ViewPager; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import com.akexorcist.localizationactivity.LocalizationActivity; import com.scb.phone.R; import com.scb.phone.view.activity.BaseActivity; import com.scb.phone.view.activity.demo.ntb.NTBLandingActivity; import com.scb.phone.view.activity.hml.HmlNTBApplyLoanEntryActivity; import com.scb.phone.view.adapter.ntb.UserProfileImageSelectionAdapter; import com.scb.phone.view.custom.common.CommonInputViewGroup; import com.scb.phone.view.custom.common.CustomEditText; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.regex.Pattern; import me.relex.circleindicator.CircleIndicator; import o.C0566Jp; import o.C0907Rf; import o.C12912fKx; import o.C14957gcv; import o.C1731aMq; import o.C6583cXR; import o.C7689ct; import o.FsF; import o.InterfaceC13391fZD; import o.InterfaceC6656cZW; import o.ZI; import o.cXH; import o.lUI; /* loaded from: classes5.dex */ public class NtbUserInfoFragment extends Hilt_NtbUserInfoFragment implements InterfaceC6656cZW.LWm, ViewPager.ojQ { private static final Map d; private UserProfileImageSelectionAdapter c; private InputFilter[] g; @BindView protected Button mBtnAction; @BindView protected CommonInputViewGroup mEmailInput; @BindView protected CircleIndicator mIndicator; @BindView protected CommonInputViewGroup mMobileNumberInput; @BindView protected CommonInputViewGroup mNameInput; @BindView protected ImageView mNtbUserInfoLeftImageView; @BindView protected ImageView mNtbUserInfoRightImageView; @InterfaceC13391fZD public C1731aMq mPresenter; @InterfaceC13391fZD public SharedPreferences mSharedPreferences; @BindView protected ViewPager mViewPager; private TextWatcher i = new TextWatcher(this) { // from class: com.scb.phone.view.fragment.ntb.NtbUserInfoFragment.4 private NtbUserInfoFragment b; @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.b = this; } @Override // android.text.TextWatcher public final void afterTextChanged(Editable editable) { if (this.b.mPresenter != null) { this.b.mPresenter.b(editable.toString()); } } }; private TextWatcher j = new TextWatcher(this) { // from class: com.scb.phone.view.fragment.ntb.NtbUserInfoFragment.5 private NtbUserInfoFragment e; @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.e = this; } @Override // android.text.TextWatcher public final void afterTextChanged(Editable editable) { if (this.e.mPresenter != null) { String obj = editable.toString(); lUI lui = this.e.mPresenter.f8497o; String trim = obj != null ? obj.trim() : obj; if (trim != null && Pattern.compile("^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$").matcher(trim).matches()) { this.e.mPresenter.c(obj); } else { this.e.a(); } } } }; private TextWatcher h = new TextWatcher(this) { // from class: com.scb.phone.view.fragment.ntb.NtbUserInfoFragment.1 private NtbUserInfoFragment 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.mMobileNumberInput.mEditText.removeTextChangedListener(this); String replace = editable.toString().replace("-", ""); if (this.c.mPresenter != null && editable.length() == 10 && !editable.toString().equalsIgnoreCase(this.c.mPresenter.h)) { this.c.mPresenter.d(replace); } else if (this.c.mPresenter != null && !replace.equalsIgnoreCase(this.c.mPresenter.h)) { C1731aMq c1731aMq = this.c.mPresenter; c1731aMq.h = null; c1731aMq.a = false; this.c.a(); this.c.mMobileNumberInput.mEditText.setFilters(this.c.g); this.c.mMobileNumberInput.mEditText.setText(replace); this.c.mMobileNumberInput.mEditText.setSelection(this.c.mMobileNumberInput.mEditText.getText().length()); } this.c.mMobileNumberInput.mEditText.addTextChangedListener(this); } }; @Override // androidx.viewpager.widget.ViewPager.ojQ public void onPageScrollStateChanged(int i) { } @Override // androidx.viewpager.widget.ViewPager.ojQ public void onPageScrolled(int i, float f, int i2) { } static { LinkedHashMap linkedHashMap = new LinkedHashMap(); d = linkedHashMap; linkedHashMap.put("M", Integer.valueOf(R.drawable.ic_ntb_avatar_man)); linkedHashMap.put("F", Integer.valueOf(R.drawable.ic_ntb_avatar_woman)); } public static NtbUserInfoFragment b(cXH.HBt.RVV rvv) { Bundle bundle = new Bundle(); bundle.putSerializable("WELCOME_ABOARD_BUTTON_TYPE", rvv); NtbUserInfoFragment ntbUserInfoFragment = new NtbUserInfoFragment(); ntbUserInfoFragment.setArguments(bundle); return ntbUserInfoFragment; } @Override // androidx.fragment.app.Fragment public void onCreate(Bundle bundle) { super.onCreate(bundle); C1731aMq c1731aMq = this.mPresenter; if (c1731aMq != null) { c1731aMq.e((C1731aMq) this); } } @Override // androidx.fragment.app.Fragment public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { View inflate = layoutInflater.inflate(R.layout.2131559793, viewGroup, false); ButterKnife.c(this, inflate); return inflate; } @Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment public void onActivityCreated(Bundle bundle) { super.onActivityCreated(bundle); UserProfileImageSelectionAdapter userProfileImageSelectionAdapter = new UserProfileImageSelectionAdapter(d); this.c = userProfileImageSelectionAdapter; this.mViewPager.setAdapter(userProfileImageSelectionAdapter); this.mViewPager.addOnPageChangeListener(this); this.mIndicator.setViewPager(this.mViewPager); CommonInputViewGroup commonInputViewGroup = this.mNameInput; TextWatcher textWatcher = this.i; commonInputViewGroup.mEditText.addTextChangedListener(textWatcher); commonInputViewGroup.d.add(textWatcher); byte b = 0; this.mNameInput.mEditText.setOnFocusChangeListener(new HBt(this, b)); CommonInputViewGroup commonInputViewGroup2 = this.mEmailInput; TextWatcher textWatcher2 = this.j; commonInputViewGroup2.mEditText.addTextChangedListener(textWatcher2); commonInputViewGroup2.d.add(textWatcher2); this.mEmailInput.mEditText.setOnEditorActionListener(new IeS(this, b)); this.mEmailInput.mEditText.setOnFocusChangeListener(new Sts(this, b)); CommonInputViewGroup commonInputViewGroup3 = this.mMobileNumberInput; TextWatcher textWatcher3 = this.h; commonInputViewGroup3.mEditText.addTextChangedListener(textWatcher3); commonInputViewGroup3.d.add(textWatcher3); this.mMobileNumberInput.mEditText.setOnEditorActionListener(new RVV(this, b)); this.mMobileNumberInput.mEditText.setOnFocusChangeListener(new LWm(this, b)); this.mMobileNumberInput.mEditText.setKeyListener(DigitsKeyListener.getInstance("0123456789-")); this.g = this.mMobileNumberInput.mEditText.getFilters(); } @Override // o.InterfaceC6656cZW.LWm public final void n() { this.mNameInput.e(); } @Override // o.InterfaceC6656cZW.LWm public final void m() { this.mNameInput.setErrorText(getString(R.string.incomplete_information)); this.mNameInput.c(); } @Override // o.InterfaceC6656cZW.LWm public final void o() { this.mNameInput.setErrorText(getString(R.string.invalid_name_format)); this.mNameInput.c(); } @Override // o.InterfaceC6656cZW.LWm public final void g() { this.mEmailInput.e(); } @Override // o.InterfaceC6656cZW.LWm public final void e() { this.mEmailInput.setErrorText(getString(R.string.incomplete_information)); this.mEmailInput.c(); } @Override // o.InterfaceC6656cZW.LWm public final void c() { this.mEmailInput.setErrorText(getString(R.string.invalid_format_please_try_again)); this.mEmailInput.c(); } @Override // o.InterfaceC6656cZW.LWm public final void f() { this.mMobileNumberInput.setErrorText(getString(R.string.incomplete_information)); this.mMobileNumberInput.c(); } @Override // o.InterfaceC6656cZW.LWm public final void h() { this.mMobileNumberInput.setErrorText(getString(R.string.invalid_format_please_try_again)); this.mMobileNumberInput.c(); } @Override // o.InterfaceC6656cZW.LWm public final void j() { this.mPresenter.c(R.string.error_generic_resource); } @Override // o.InterfaceC6656cZW.LWm public final void b() { this.mBtnAction.setEnabled(true); } @Override // o.InterfaceC6656cZW.LWm public final void a() { this.mBtnAction.setEnabled(false); } public void e(List list) { Intent putParcelableArrayListExtra = new Intent(getContext(), (Class) NTBLandingActivity.class).putParcelableArrayListExtra("INTRODUCTION_LIST", new ArrayList<>(list)); putParcelableArrayListExtra.setFlags(268468224); startActivity(putParcelableArrayListExtra); } @Override // o.InterfaceC6656cZW.LWm public final void a(C0907Rf.Sts sts) { WeakReference weakReference = new WeakReference<>((BaseActivity) getActivity()); C12912fKx.RVV rvv = new C12912fKx.RVV((byte) 0); rvv.d = weakReference; rvv.e = sts; rvv.a = true; C12912fKx.d(rvv); } @Override // o.InterfaceC6656cZW.LWm public final void d() { HmlNTBApplyLoanEntryActivity.HBt hBt = HmlNTBApplyLoanEntryActivity.m; Context context = getContext(); C14957gcv.e(context, ""); startActivity(new Intent(context, (Class) HmlNTBApplyLoanEntryActivity.class)); } @OnClick public void onClickPrevNavigation() { if (this.mViewPager != null) { this.mNtbUserInfoRightImageView.setVisibility(0); int currentItem = this.mViewPager.getCurrentItem() > 1 ? this.mViewPager.getCurrentItem() - 1 : 0; if (currentItem == 0) { this.mNtbUserInfoLeftImageView.setVisibility(4); } this.mViewPager.setCurrentItem(currentItem); } } @OnClick public void onClickNextNavigation() { if (this.mViewPager != null) { this.mNtbUserInfoLeftImageView.setVisibility(0); int count = this.mViewPager.getAdapter().getCount() - 1; int currentItem = this.mViewPager.getCurrentItem() < count ? this.mViewPager.getCurrentItem() + 1 : count; if (currentItem == count) { this.mNtbUserInfoRightImageView.setVisibility(4); } this.mViewPager.setCurrentItem(currentItem); } } @OnClick public void onClickSubmit() { UserProfileImageSelectionAdapter userProfileImageSelectionAdapter = this.c; int currentItem = this.mViewPager.getCurrentItem(); List list = userProfileImageSelectionAdapter.d; String str = list == null ? null : list.get(currentItem); String string = this.mSharedPreferences.getString("randomDeviceId", ""); String B_ = ((LocalizationActivity) getActivity()).B_(); Bundle arguments = getArguments(); if (arguments == null || !arguments.containsKey("WELCOME_ABOARD_BUTTON_TYPE")) { return; } C1731aMq c1731aMq = this.mPresenter; cXH.HBt.RVV rvv = (cXH.HBt.RVV) arguments.getSerializable("WELCOME_ABOARD_BUTTON_TYPE"); if (c1731aMq.c && c1731aMq.b && c1731aMq.a) { if (!c1731aMq.e) { ZI.IeS ieS = new ZI.IeS() { // from class: o.aMt @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC6656cZW.LWm) obj).y(); } }; if (c1731aMq.f != 0) { ieS.e(c1731aMq.f); } c1731aMq.n = rvv; C7689ct c7689ct = new C7689ct(string, c1731aMq.g.trim(), c1731aMq.d, c1731aMq.h, B_, str, c1731aMq.l.e.e(), c1731aMq.l.e.a()); c1731aMq.k = c7689ct; c1731aMq.i.c(c7689ct); FsF fsF = c1731aMq.i; fsF.d(fsF.i, new C1731aMq.RVV(c1731aMq)); return; } c1731aMq.a(); } } @Override // androidx.viewpager.widget.ViewPager.ojQ public void onPageSelected(int i) { int count = this.mViewPager.getAdapter().getCount(); this.mNtbUserInfoRightImageView.setVisibility(0); this.mNtbUserInfoLeftImageView.setVisibility(0); if (i == count - 1) { this.mNtbUserInfoRightImageView.setVisibility(4); } if (i == 0) { this.mNtbUserInfoLeftImageView.setVisibility(4); } } /* loaded from: classes5.dex */ class HBt implements View.OnFocusChangeListener { private NtbUserInfoFragment a; private HBt(NtbUserInfoFragment ntbUserInfoFragment) { this.a = ntbUserInfoFragment; } @Override // android.view.View.OnFocusChangeListener public final void onFocusChange(View view, boolean z) { EditText editText = (EditText) view; if (z) { return; } this.a.mPresenter.b(editText.getText().toString()); } /* synthetic */ HBt(NtbUserInfoFragment ntbUserInfoFragment, byte b) { this(ntbUserInfoFragment); } } /* loaded from: classes5.dex */ class IeS implements TextView.OnEditorActionListener { private NtbUserInfoFragment b; private IeS(NtbUserInfoFragment ntbUserInfoFragment) { this.b = ntbUserInfoFragment; } @Override // android.widget.TextView.OnEditorActionListener public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { if (i != 6) { return false; } this.b.mEmailInput.clearFocus(); return true; } /* synthetic */ IeS(NtbUserInfoFragment ntbUserInfoFragment, byte b) { this(ntbUserInfoFragment); } } /* loaded from: classes5.dex */ class Sts implements View.OnFocusChangeListener { private NtbUserInfoFragment b; private Sts(NtbUserInfoFragment ntbUserInfoFragment) { this.b = ntbUserInfoFragment; } @Override // android.view.View.OnFocusChangeListener public final void onFocusChange(View view, boolean z) { EditText editText = (EditText) view; if (z) { return; } this.b.mPresenter.c(editText.getText().toString()); } /* synthetic */ Sts(NtbUserInfoFragment ntbUserInfoFragment, byte b) { this(ntbUserInfoFragment); } } /* loaded from: classes5.dex */ class RVV implements TextView.OnEditorActionListener { private NtbUserInfoFragment d; private RVV(NtbUserInfoFragment ntbUserInfoFragment) { this.d = ntbUserInfoFragment; } @Override // android.widget.TextView.OnEditorActionListener public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { if (i != 6) { return false; } this.d.mMobileNumberInput.clearFocus(); this.d.aN_(); return true; } /* synthetic */ RVV(NtbUserInfoFragment ntbUserInfoFragment, byte b) { this(ntbUserInfoFragment); } } /* loaded from: classes5.dex */ class LWm implements View.OnFocusChangeListener { private NtbUserInfoFragment d; private LWm(NtbUserInfoFragment ntbUserInfoFragment) { this.d = ntbUserInfoFragment; } @Override // android.view.View.OnFocusChangeListener public final void onFocusChange(View view, boolean z) { EditText editText = (EditText) view; if (z) { return; } this.d.mPresenter.d(editText.getText().toString().replace("-", "")); } /* synthetic */ LWm(NtbUserInfoFragment ntbUserInfoFragment, byte b) { this(ntbUserInfoFragment); } } @Override // o.InterfaceC6656cZW.LWm public final void i() { CustomEditText customEditText = this.mMobileNumberInput.mEditText; customEditText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(this.mMobileNumberInput.a + 2)}); customEditText.setText(C6583cXR.c("MOB", customEditText.getText().toString())); customEditText.setSelection(customEditText.getText().length()); this.mMobileNumberInput.e(); } public static Map l() { return d; } }