package com.scb.phone.view.fragment.prepaid.activation; import android.content.Context; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.text.Editable; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; import androidx.viewpager.widget.ViewPager; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import com.scb.phone.R; import com.scb.phone.view.activity.BaseActivity; import com.scb.phone.view.custom.common.CustomEditText; import com.scb.phone.view.fragment.BaseFragment; import com.scb.phone.view.fragment.prepaid.activation.PrepaidActivationInputFragment; import java.util.ArrayList; import java.util.Collection; import java.util.List; import kotlin.NoWhenBranchMatchedException; import me.relex.circleindicator.CircleIndicator; import o.AbstractC14961gcz; import o.C1049Un; import o.C1068Ux; import o.C1070Uy; import o.C12385exH; import o.C14851gaI; import o.C14957gcv; import o.C15861jH; import o.C7620crk; import o.C9508dl; import o.Dwh; import o.InterfaceC12862fJf; import o.InterfaceC13391fZD; import o.InterfaceC13393fZL; import o.InterfaceC14890gbN; import o.InterfaceC9559dly; import o.QE; import o.ZI; import o.fJJ; import o.fZZ; import o.gdZ; import o.iAn; import o.nMh; /* loaded from: classes5.dex */ public final class PrepaidActivationInputFragment extends Hilt_PrepaidActivationInputFragment implements InterfaceC9559dly.RVV { public static final Sts c = new Sts(0); @BindView public Button btActivate; @BindView public CustomEditText cusEtPrepaidCard; private fJJ d; private C12385exH f = new C12385exH(C14851gaI.c); private C1068Ux g; private final InterfaceC13393fZL h; private InterfaceC12862fJf i; @BindView public CircleIndicator indicator; @InterfaceC13391fZD public C7620crk presenter; @BindView public TextView tvPrepaidCardError; @BindView public ViewPager vpPrepaidCard; public PrepaidActivationInputFragment() { IeS ieS = IeS.c; C14957gcv.e(ieS, ""); this.h = new fZZ(ieS); } /* loaded from: classes5.dex */ public static final class Sts { private Sts() { } public /* synthetic */ Sts(byte b) { this(); } } /* JADX WARN: Multi-variable type inference failed */ @Override // com.scb.phone.view.fragment.prepaid.activation.Hilt_PrepaidActivationInputFragment, com.scb.phone.view.fragment.Hilt_BaseFragment, androidx.fragment.app.Fragment public final void onAttach(Context context) { C14957gcv.e(context, ""); super.onAttach(context); this.i = (InterfaceC12862fJf) context; } @Override // androidx.fragment.app.Fragment public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { C14957gcv.e(layoutInflater, ""); return layoutInflater.inflate(R.layout.2131559822, viewGroup, false); } @Override // androidx.fragment.app.Fragment public final void onViewCreated(View view, Bundle bundle) { C14957gcv.e(view, ""); super.onViewCreated(view, bundle); ((BaseFragment) this).a = ButterKnife.c(this, view); C7620crk c7620crk = this.presenter; CustomEditText customEditText = null; if (c7620crk == null) { C14957gcv.a(""); c7620crk = null; } c7620crk.e((C7620crk) this); Bundle arguments = getArguments(); C1068Ux c1068Ux = arguments != null ? (C1068Ux) arguments.getParcelable("ARGS_PREPAID_DISPLAY") : null; this.g = c1068Ux; if (c1068Ux != null) { C7620crk c7620crk2 = this.presenter; if (c7620crk2 == null) { C14957gcv.a(""); c7620crk2 = null; } C14957gcv.e(c1068Ux, ""); List list = c1068Ux.c; C14957gcv.e(list, ""); ArrayList arrayList = new ArrayList(list instanceof Collection ? list.size() : 10); for (C1049Un c1049Un : list) { arrayList.add(c7620crk2.c.b(c1049Un.j, c1049Un.g)); } final ArrayList arrayList2 = arrayList; c7620crk2.b = c1068Ux.c; ZI.IeS ieS = new ZI.IeS(arrayList2) { // from class: o.crn private List e; @Override // o.ZI.IeS public final void e(Object obj) { C7620crk.a(this.e, (InterfaceC9559dly.RVV) obj); } { this.e = arrayList2; } }; if (c7620crk2.f != 0) { ieS.e(c7620crk2.f); } } ViewPager viewPager = this.vpPrepaidCard; if (viewPager == null) { C14957gcv.a(""); viewPager = null; } viewPager.setAdapter(this.f); ViewPager viewPager2 = this.vpPrepaidCard; if (viewPager2 == null) { C14957gcv.a(""); viewPager2 = null; } viewPager2.addOnPageChangeListener(new RVV(this)); C7620crk c7620crk3 = this.presenter; if (c7620crk3 == null) { C14957gcv.a(""); c7620crk3 = null; } c7620crk3.a = c7620crk3.b.get(0); CircleIndicator circleIndicator = this.indicator; if (circleIndicator == null) { C14957gcv.a(""); circleIndicator = null; } ViewPager viewPager3 = this.vpPrepaidCard; if (viewPager3 == null) { C14957gcv.a(""); viewPager3 = null; } circleIndicator.setViewPager(viewPager3); C12385exH c12385exH = this.f; CircleIndicator circleIndicator2 = this.indicator; if (circleIndicator2 == null) { C14957gcv.a(""); circleIndicator2 = null; } c12385exH.registerDataSetObserver(circleIndicator2.c); this.d = new HBt(this); CustomEditText customEditText2 = this.cusEtPrepaidCard; if (customEditText2 == null) { C14957gcv.a(""); customEditText2 = null; } customEditText2.clearFocus(); CustomEditText customEditText3 = this.cusEtPrepaidCard; if (customEditText3 == null) { C14957gcv.a(""); customEditText3 = null; } fJJ fjj = this.d; if (fjj == null) { C14957gcv.a(""); fjj = null; } customEditText3.addTextChangedListener(fjj); CustomEditText customEditText4 = this.cusEtPrepaidCard; if (customEditText4 == null) { C14957gcv.a(""); customEditText4 = null; } customEditText4.setOnBackListener(new CustomEditText.LWm(this) { // from class: o.ftH private PrepaidActivationInputFragment a; @Override // com.scb.phone.view.custom.common.CustomEditText.LWm public final void a() { PrepaidActivationInputFragment.e(this.a); } { this.a = this; } }); CustomEditText customEditText5 = this.cusEtPrepaidCard; if (customEditText5 == null) { C14957gcv.a(""); customEditText5 = null; } customEditText5.setOnEditorActionListener(new TextView.OnEditorActionListener(this) { // from class: o.ftI private PrepaidActivationInputFragment c; @Override // android.widget.TextView.OnEditorActionListener public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { return PrepaidActivationInputFragment.a(this.c, i); } { this.c = this; } }); CustomEditText customEditText6 = this.cusEtPrepaidCard; if (customEditText6 != null) { customEditText = customEditText6; } else { C14957gcv.a(""); } customEditText.setOnFocusChangeListener(new View.OnFocusChangeListener(this) { // from class: o.ftD private PrepaidActivationInputFragment e; @Override // android.view.View.OnFocusChangeListener public final void onFocusChange(View view2, boolean z) { PrepaidActivationInputFragment.e(this.e, z); } { this.e = this; } }); Dwh dwh = (Dwh) this.h.e(); if (getActivity() != null) { dwh.c(((BaseActivity) getActivity()).scbAnalytics, "planetscb_cardactivate_input_screen"); } } /* loaded from: classes5.dex */ public static final class RVV extends ViewPager.jbe { private PrepaidActivationInputFragment a; RVV(PrepaidActivationInputFragment prepaidActivationInputFragment) { this.a = prepaidActivationInputFragment; } @Override // androidx.viewpager.widget.ViewPager.jbe, androidx.viewpager.widget.ViewPager.ojQ public final void onPageSelected(int i) { C7620crk c7620crk = this.a.presenter; if (c7620crk == null) { C14957gcv.a(""); c7620crk = null; } c7620crk.a = c7620crk.b.get(i); } } /* loaded from: classes5.dex */ public static final class HBt extends fJJ { private PrepaidActivationInputFragment d; HBt(PrepaidActivationInputFragment prepaidActivationInputFragment) { this.d = prepaidActivationInputFragment; } @Override // o.fJJ, android.text.TextWatcher public final void afterTextChanged(Editable editable) { C14957gcv.e(editable, ""); final C7620crk c7620crk = this.d.presenter; if (c7620crk == null) { C14957gcv.a(""); c7620crk = null; } final String obj = editable.toString(); C14957gcv.e(obj, ""); c7620crk.e = obj; ZI.IeS ieS = new ZI.IeS(c7620crk, obj) { // from class: o.crj private String a; private C7620crk d; @Override // o.ZI.IeS public final void e(Object obj2) { C7620crk.d(this.d, this.a, (InterfaceC9559dly.RVV) obj2); } { this.d = c7620crk; this.a = obj; } }; if (c7620crk.f != 0) { ieS.e(c7620crk.f); } } } @Override // o.InterfaceC9559dly.RVV public final void c(List list) { C14957gcv.e(list, ""); C12385exH c12385exH = this.f; C14957gcv.e(list, ""); c12385exH.e = list; c12385exH.notifyDataSetChanged(); } @Override // o.InterfaceC9559dly.RVV public final void e(boolean z) { int i; CircleIndicator circleIndicator = this.indicator; if (circleIndicator == null) { C14957gcv.a(""); circleIndicator = null; } if (z) { i = 0; } else { if (z) { throw new NoWhenBranchMatchedException(); } i = 8; } circleIndicator.setVisibility(i); } @OnClick public final void onActivateButtonClick() { C7620crk c7620crk = this.presenter; C1049Un c1049Un = null; if (c7620crk == null) { C14957gcv.a(""); c7620crk = null; } c7620crk.e = gdZ.a(c7620crk.e, " ", ""); if (c7620crk.f != 0) { c7620crk.f.y(); } C9508dl c9508dl = new C9508dl((byte) 0); String str = c7620crk.e; C14957gcv.e(str, ""); c9508dl.e = str; C1049Un c1049Un2 = c7620crk.a; if (c1049Un2 == null) { C14957gcv.a(""); } else { c1049Un = c1049Un2; } String str2 = c1049Un.i; C14957gcv.e(str2, ""); c9508dl.a = str2; C15861jH c15861jH = c7620crk.d; C7620crk.Sts sts = new C7620crk.Sts(c7620crk); C7620crk.RVV rvv = new C7620crk.RVV(c7620crk); C14957gcv.e(sts, ""); C14957gcv.e(rvv, ""); C14957gcv.e(c9508dl, ""); c15861jH.b(c15861jH.c, sts, rvv, new iAn.Sts(c9508dl)); } @Override // o.InterfaceC9559dly.RVV public final void d(String str) { C14957gcv.e(str, ""); CustomEditText customEditText = this.cusEtPrepaidCard; fJJ fjj = null; if (customEditText == null) { C14957gcv.a(""); customEditText = null; } fJJ fjj2 = this.d; if (fjj2 == null) { C14957gcv.a(""); fjj2 = null; } customEditText.removeTextChangedListener(fjj2); customEditText.setText(str); customEditText.setSelection(str.length()); fJJ fjj3 = this.d; if (fjj3 == null) { C14957gcv.a(""); } else { fjj = fjj3; } customEditText.addTextChangedListener(fjj); } @Override // o.InterfaceC9559dly.RVV public final void a(boolean z) { Button button = this.btActivate; if (button == null) { C14957gcv.a(""); button = null; } button.setEnabled(z); } @Override // o.InterfaceC9559dly.RVV public final void d(boolean z) { Drawable drawable; Drawable drawable2; TextView textView = null; if (z) { CustomEditText customEditText = this.cusEtPrepaidCard; if (customEditText == null) { C14957gcv.a(""); customEditText = null; } Context context = getContext(); if (context != null) { C14957gcv.e(context, ""); drawable2 = nMh.getDrawable(context, R.drawable.shape_gray_rounded_rectangle); } else { drawable2 = null; } customEditText.setBackground(drawable2); TextView textView2 = this.tvPrepaidCardError; if (textView2 != null) { textView = textView2; } else { C14957gcv.a(""); } textView.setVisibility(8); return; } CustomEditText customEditText2 = this.cusEtPrepaidCard; if (customEditText2 == null) { C14957gcv.a(""); customEditText2 = null; } Context context2 = getContext(); if (context2 != null) { C14957gcv.e(context2, ""); drawable = nMh.getDrawable(context2, R.drawable.shape_red_reounded_reactangle_border); } else { drawable = null; } customEditText2.setBackground(drawable); TextView textView3 = this.tvPrepaidCardError; if (textView3 != null) { textView = textView3; } else { C14957gcv.a(""); } textView.setVisibility(0); } @Override // o.InterfaceC9559dly.RVV public final void e(C1070Uy c1070Uy) { C14957gcv.e(c1070Uy, ""); InterfaceC12862fJf interfaceC12862fJf = this.i; C1049Un c1049Un = null; if (interfaceC12862fJf == null) { C14957gcv.a(""); interfaceC12862fJf = null; } C7620crk c7620crk = this.presenter; if (c7620crk == null) { C14957gcv.a(""); c7620crk = null; } C1049Un c1049Un2 = c7620crk.a; if (c1049Un2 == null) { C14957gcv.a(""); } else { c1049Un = c1049Un2; } interfaceC12862fJf.c(c1070Uy, c1049Un); } @Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment public final void onDestroyView() { C7620crk c7620crk = this.presenter; if (c7620crk == null) { C14957gcv.a(""); c7620crk = null; } c7620crk.w_(); super.onDestroyView(); } /* loaded from: classes5.dex */ static final class IeS extends AbstractC14961gcz implements InterfaceC14890gbN { public static final IeS c = new IeS(); @Override // o.InterfaceC14890gbN public final /* synthetic */ Dwh invoke() { return new Dwh(); } IeS() { super(0); } } public static /* synthetic */ void e(PrepaidActivationInputFragment prepaidActivationInputFragment, boolean z) { C14957gcv.e(prepaidActivationInputFragment, ""); final C7620crk c7620crk = prepaidActivationInputFragment.presenter; if (c7620crk == null) { C14957gcv.a(""); c7620crk = null; } boolean z2 = !z; ZI.IeS ieS = new ZI.IeS(c7620crk) { // from class: o.crl private C7620crk d; @Override // o.ZI.IeS public final void e(Object obj) { C7620crk.a(this.d, (InterfaceC9559dly.RVV) obj); } { this.d = c7620crk; } }; if (!z2 || c7620crk.f == 0) { return; } ieS.e(c7620crk.f); } public static /* synthetic */ boolean a(PrepaidActivationInputFragment prepaidActivationInputFragment, int i) { C14957gcv.e(prepaidActivationInputFragment, ""); if (i != 6) { return false; } CustomEditText customEditText = prepaidActivationInputFragment.cusEtPrepaidCard; if (customEditText == null) { C14957gcv.a(""); customEditText = null; } customEditText.clearFocus(); prepaidActivationInputFragment.aN_(); return true; } public static /* synthetic */ void e(PrepaidActivationInputFragment prepaidActivationInputFragment) { C14957gcv.e(prepaidActivationInputFragment, ""); CustomEditText customEditText = prepaidActivationInputFragment.cusEtPrepaidCard; if (customEditText == null) { C14957gcv.a(""); customEditText = null; } customEditText.clearFocus(); } }