package com.scb.phone.view.fragment.purchase; import android.os.Bundle; import android.text.Html; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import androidx.viewpager.widget.ViewPager; import butterknife.BindView; import butterknife.ButterKnife; import com.scb.phone.R; import com.scb.phone.view.adapter.accountsummary.ErrorPagerAdapter; import com.scb.phone.view.adapter.purchase.PurchaseAccountSourceAdapter; import com.scb.phone.view.custom.common.NoSwipeViewPager; import com.scb.phone.view.fragment.purchase.PurchaseDepositFragment; import java.util.List; import me.relex.circleindicator.CircleIndicator; import o.AbstractC13482fbE; import o.C1203Xy; import o.C7908cxH; import o.InterfaceC12824fIT; import o.InterfaceC13391fZD; import o.InterfaceC8972dat; import o.WW; import o.nMh; /* loaded from: classes5.dex */ public class PurchaseDepositFragment extends Hilt_PurchaseDepositFragment implements InterfaceC8972dat.Sts, InterfaceC12824fIT { private boolean c; PurchaseAccountSourceAdapter d; private boolean f; private PurchaseDepositInputFragment g; private C1203Xy j; @BindView LinearLayout layoutNoAccount; @BindView CircleIndicator mIndicator; @InterfaceC13391fZD public C7908cxH mPresenter; @BindView NoSwipeViewPager mViewPager; @BindView TextView tvNoCardTitle; public static PurchaseDepositFragment e(C1203Xy c1203Xy, boolean z, boolean z2) { Bundle bundle = new Bundle(); bundle.putParcelable("com.scb.phone.TransferTabFragment.EXTRA_BILL_SCAN", c1203Xy); bundle.putBoolean("com.scb.phone.EXTRA_IS_POINT_ENABLE", z); bundle.putBoolean("com.scb.phone.IS_HIDE_POINT", z2); PurchaseDepositFragment purchaseDepositFragment = new PurchaseDepositFragment(); purchaseDepositFragment.setArguments(bundle); return purchaseDepositFragment; } @Override // androidx.fragment.app.Fragment public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { View inflate = layoutInflater.inflate(R.layout.2131559843, viewGroup, false); ButterKnife.c(this, inflate); this.mPresenter.e((C7908cxH) this); this.mIndicator.setViewPager(this.mViewPager); if (getArguments() != null && getArguments().getParcelable("com.scb.phone.TransferTabFragment.EXTRA_BILL_SCAN") != null) { this.j = (C1203Xy) getArguments().getParcelable("com.scb.phone.TransferTabFragment.EXTRA_BILL_SCAN"); this.f = getArguments().getBoolean("com.scb.phone.EXTRA_IS_POINT_ENABLE", false); this.c = getArguments().getBoolean("com.scb.phone.IS_HIDE_POINT", false); } return inflate; } @Override // androidx.fragment.app.Fragment public void onViewCreated(View view, Bundle bundle) { this.tvNoCardTitle.setText(Html.fromHtml(getString(R.string.purchase_account_empty_title))); this.g = PurchaseDepositInputFragment.b(this.j, this.f, this.c); AbstractC13482fbE a = getChildFragmentManager().a(); a.b(R.id.deposit_input_container, this.g, null, 2); a.b(); } @Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment public void onActivityCreated(Bundle bundle) { super.onActivityCreated(bundle); this.mPresenter.d(); } @Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment public void onDestroy() { super.onDestroy(); this.mPresenter.w_(); } @Override // o.InterfaceC8972dat.Sts public final void b(List list) { PurchaseDepositInputFragment purchaseDepositInputFragment; this.d = new PurchaseAccountSourceAdapter(getContext(), list, this); this.mViewPager.addOnPageChangeListener(new ViewPager.ojQ(this) { // from class: com.scb.phone.view.fragment.purchase.PurchaseDepositFragment.4 private PurchaseDepositFragment e; @Override // androidx.viewpager.widget.ViewPager.ojQ public final void onPageScrollStateChanged(int i) { } @Override // androidx.viewpager.widget.ViewPager.ojQ public final void onPageScrolled(int i, float f, int i2) { } { this.e = this; } @Override // androidx.viewpager.widget.ViewPager.ojQ public final void onPageSelected(int i) { PurchaseDepositFragment.d(this.e, i); if (this.e.g != null) { this.e.g.b(this.e.d.b(i)); } } }); this.mViewPager.setAdapter(this.d); this.mViewPager.setClipToPadding(false); this.mViewPager.setVisibility(0); this.mIndicator.setVisibility(0); if (list.size() == 1) { this.mViewPager.setPadding(getResources().getDimensionPixelOffset(R.dimen.f28532131166619), 0, 0, 0); } else { this.mViewPager.setPadding(getResources().getDimensionPixelOffset(R.dimen.f28522131166618), 0, getResources().getDimensionPixelOffset(R.dimen.f28512131166617), 0); } if (list.size() > 0 && (purchaseDepositInputFragment = this.g) != null) { purchaseDepositInputFragment.b(this.d.b(0)); } this.mIndicator.setViewPager(this.mViewPager); PurchaseDepositInputFragment purchaseDepositInputFragment2 = this.g; if (purchaseDepositInputFragment2 != null) { purchaseDepositInputFragment2.purchaseDepositInputPresenter.d(this.j); } } @Override // o.InterfaceC8972dat.Sts public final void e() { ErrorPagerAdapter errorPagerAdapter = new ErrorPagerAdapter(getContext(), ErrorPagerAdapter.LWm.ACCOUNT_SUMMARY_ERROR, new View.OnClickListener(this) { // from class: o.fvT private PurchaseDepositFragment d; @Override // android.view.View.OnClickListener public final void onClick(View view) { this.d.mPresenter.d(); } { this.d = this; } }); this.mViewPager.setVisibility(0); this.mViewPager.setAdapter(errorPagerAdapter); this.mViewPager.setClipToPadding(false); this.mViewPager.setPadding(getResources().getDimensionPixelOffset(R.dimen.f28542131166620), 0, getResources().getDimensionPixelOffset(R.dimen.f28542131166620), 0); this.mIndicator.setVisibility(8); } @Override // o.InterfaceC8972dat.Sts public final void c() { this.mViewPager.setVisibility(8); this.mIndicator.setVisibility(8); this.layoutNoAccount.setVisibility(0); PurchaseDepositInputFragment purchaseDepositInputFragment = this.g; if (purchaseDepositInputFragment != null) { purchaseDepositInputFragment.purchaseDepositInputPresenter.d(this.j); } } @Override // o.InterfaceC8972dat.Sts public final void b() { this.mIndicator.setVisibility(0); } @Override // o.InterfaceC8972dat.Sts public final void d() { this.mIndicator.setVisibility(8); } @Override // o.InterfaceC12824fIT public final void a(int i) { d(i); this.mViewPager.setCurrentItem(i); } private void d(int i) { int[] iArr = {i - 1, i, i + 1}; if (i == 0) { this.mViewPager.setPadding(getResources().getDimensionPixelOffset(R.dimen.f28522131166618), 0, getResources().getDimensionPixelOffset(R.dimen.f28512131166617), 0); } else { if (this.d != null && i == r4.getCount() - 1) { this.mViewPager.setPadding(getResources().getDimensionPixelOffset(R.dimen.f28512131166617), 0, getResources().getDimensionPixelOffset(R.dimen.f28522131166618), 0); } else { this.mViewPager.setPadding(getResources().getDimensionPixelOffset(R.dimen.f28502131166616), 0, getResources().getDimensionPixelOffset(R.dimen.f28502131166616), 0); } } for (int i2 = 0; i2 < 3; i2++) { int i3 = iArr[i2]; NoSwipeViewPager noSwipeViewPager = this.mViewPager; if (noSwipeViewPager != null) { View findViewWithTag = noSwipeViewPager.findViewWithTag("TAG_ACCOUNT_SOURCE_ADAPTER".concat(String.valueOf(i3))); TextView textView = (TextView) this.mViewPager.findViewWithTag("TAG_ACCOUNT_SOURCE_ADAPTER_TEXT".concat(String.valueOf(i3))); if (findViewWithTag != null && textView != null) { if (i == i3) { findViewWithTag.setBackground(nMh.getDrawable(getContext(), R.drawable.rounded_purple_view_pager)); textView.setTextColor(nMh.getColor(getContext(), R.color.f2982131099805)); } else { findViewWithTag.setBackground(nMh.getDrawable(getContext(), R.drawable.bg_white_rounded_with_border)); textView.setTextColor(nMh.getColor(getContext(), R.color.f3092131099816)); } } } } } static /* bridge */ /* synthetic */ void d(PurchaseDepositFragment purchaseDepositFragment, int i) { purchaseDepositFragment.d(i); PurchaseAccountSourceAdapter purchaseAccountSourceAdapter = purchaseDepositFragment.d; if (purchaseAccountSourceAdapter != null) { purchaseAccountSourceAdapter.d = i; } } }