package com.scb.phone.view.fragment.merchant; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.appcompat.widget.Toolbar; import androidx.fragment.app.Fragment; import androidx.viewpager.widget.ViewPager; import butterknife.BindView; import butterknife.ButterKnife; import com.google.android.material.tabs.TabLayout; import com.scb.phone.R; import com.scb.phone.view.fragment.merchant.MerchantWalletTransactionFragment; import java.util.Objects; import o.C12348ewX; import o.C16918sPB; import o.C4169bSH; import o.InterfaceC1244Ytw; import o.InterfaceC13391fZD; import o.NoP; import o.RK; import o.YKU; import o.ZI; import o.cXG; import o.cZR; import o.gxQ; import o.irv; import o.qsu; import o.rgl; import o.utN; import o.wxK; import org.threeten.bp.OffsetDateTime; /* loaded from: classes5.dex */ public class MerchantWalletTransactionFragment extends Hilt_MerchantWalletTransactionFragment implements cZR.Sts { private MerchantWalletIncomingTransactionFragment c; private cZR.IeS d; private C12348ewX f; private MerchantWalletOutgoingTransactionFragment g; private cZR.IeS j; @InterfaceC13391fZD public C4169bSH mPresenter; @BindView protected TabLayout mTabLayoutTransaction; @BindView protected TextView mTextTxn; @BindView protected TextView mTextTxnMonth; @BindView protected Toolbar mToolbarTxn; @BindView protected ViewPager mViewPager; @Override // androidx.fragment.app.Fragment public void onCreate(Bundle bundle) { super.onCreate(bundle); this.mPresenter.e((C4169bSH) this); } @Override // androidx.fragment.app.Fragment public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { View inflate = layoutInflater.inflate(R.layout.2131559754, viewGroup, false); ButterKnife.c(this, inflate); this.mToolbarTxn.a(R.menu.2131689485); this.mToolbarTxn.setOnMenuItemClickListener(new Toolbar.HBt(this) { // from class: o.fnL private MerchantWalletTransactionFragment a; @Override // androidx.appcompat.widget.Toolbar.HBt public final boolean awL_(MenuItem menuItem) { return MerchantWalletTransactionFragment.avH_(this.a, menuItem); } { this.a = this; } }); return inflate; } @Override // com.scb.phone.view.fragment.merchant.Hilt_MerchantWalletTransactionFragment, com.scb.phone.view.fragment.Hilt_BaseFragment, androidx.fragment.app.Fragment public void onAttach(Context context) { super.onAttach(context); getChildFragmentManager().a(new gxQ(this) { // from class: o.fnP private MerchantWalletTransactionFragment c; @Override // o.gxQ public final void d(yRS yrs, Fragment fragment) { MerchantWalletTransactionFragment.d(this.c, fragment); } { this.c = this; } }); } @Override // o.cZR.Sts public final void c(RK rk, String str, String str2, boolean z) { C12348ewX c12348ewX = this.f; if (c12348ewX == null) { C12348ewX c12348ewX2 = new C12348ewX(getChildFragmentManager(), getContext(), rk, str, str2, z); this.f = c12348ewX2; this.mViewPager.setAdapter(c12348ewX2); this.mTabLayoutTransaction.setupWithViewPager(this.mViewPager); return; } c12348ewX.d = rk; c12348ewX.a = str; c12348ewX.c = str2; c12348ewX.b = z; MerchantWalletIncomingTransactionFragment merchantWalletIncomingTransactionFragment = this.c; if (merchantWalletIncomingTransactionFragment != null) { merchantWalletIncomingTransactionFragment.c(rk.i, str, str2); } MerchantWalletOutgoingTransactionFragment merchantWalletOutgoingTransactionFragment = this.g; if (merchantWalletOutgoingTransactionFragment != null) { merchantWalletOutgoingTransactionFragment.c(rk.i, str, str2); } } @Override // com.scb.phone.view.fragment.BaseFragment public final void aJ_() { cZR.IeS ieS; cZR.IeS ieS2; if (this.f != null) { if (this.mViewPager.getCurrentItem() == 0 && (ieS2 = this.d) != null) { ieS2.aJ_(); } else { if (this.mViewPager.getCurrentItem() != 1 || (ieS = this.j) == null) { return; } ieS.aJ_(); } } } public static /* synthetic */ String e(MerchantWalletTransactionFragment merchantWalletTransactionFragment, OffsetDateTime offsetDateTime, OffsetDateTime offsetDateTime2) { if (offsetDateTime.getMonth() == offsetDateTime2.getMonth()) { return merchantWalletTransactionFragment.getString(R.string.deposit_detail_filter_this_month); } return cXG.VL_(merchantWalletTransactionFragment.getResources(), "MMM yyyy", offsetDateTime2); } public static /* synthetic */ boolean avH_(final MerchantWalletTransactionFragment merchantWalletTransactionFragment, MenuItem menuItem) { if (menuItem.getItemId() != R.id.menu_filter) { return false; } final OffsetDateTime now = OffsetDateTime.now(); irv irvVar = new irv(merchantWalletTransactionFragment.getContext(), merchantWalletTransactionFragment.mToolbarTxn.findViewById(R.id.menu_filter)); final NoP noP = irvVar.c; rgl a = rgl.a(6); Objects.requireNonNull(now); YKU yku = new YKU(a.b, new C16918sPB(a.d, new utN(now) { // from class: o.fnJ private OffsetDateTime e; @Override // o.utN public final Object d(int i) { OffsetDateTime minusMonths; minusMonths = this.e.minusMonths(i); return minusMonths; } { this.e = now; } })); new YKU(yku.a, new wxK(yku.b, new InterfaceC1244Ytw(merchantWalletTransactionFragment, now) { // from class: o.fnK private OffsetDateTime c; private MerchantWalletTransactionFragment e; @Override // o.InterfaceC1244Ytw public final Object d(Object obj) { return MerchantWalletTransactionFragment.e(this.e, this.c, (OffsetDateTime) obj); } { this.e = merchantWalletTransactionFragment; this.c = now; } })).d(new qsu(noP) { // from class: o.fnM private Menu a; @Override // o.qsu public final void d(Object obj) { r0.add(0, 0, this.a.size(), (String) obj); } { this.a = noP; } }); irvVar.b = new irv.RVV(merchantWalletTransactionFragment) { // from class: o.fnI private MerchantWalletTransactionFragment c; @Override // o.irv.RVV public final boolean avK_(MenuItem menuItem2) { return MerchantWalletTransactionFragment.avI_(this.c, menuItem2); } { this.c = merchantWalletTransactionFragment; } }; irvVar.e.e(); return true; } public static /* synthetic */ boolean avI_(MerchantWalletTransactionFragment merchantWalletTransactionFragment, MenuItem menuItem) { final C4169bSH c4169bSH = merchantWalletTransactionFragment.mPresenter; OffsetDateTime minusMonths = OffsetDateTime.now().minusMonths(menuItem.getOrder()); c4169bSH.d = minusMonths.withDayOfMonth(1).format(c4169bSH.b); c4169bSH.e = minusMonths.plusMonths(1L).withDayOfMonth(1).minusDays(1L).format(c4169bSH.b); ZI.IeS ieS = new ZI.IeS(c4169bSH) { // from class: o.bSK private C4169bSH c; @Override // o.ZI.IeS public final void e(Object obj) { ((cZR.Sts) obj).c(r0.a, r0.d, this.c.e, false); } { this.c = c4169bSH; } }; if (c4169bSH.f != 0) { ieS.e(c4169bSH.f); } merchantWalletTransactionFragment.mTextTxnMonth.setText(menuItem.getTitle()); merchantWalletTransactionFragment.mTextTxnMonth.setVisibility(0); return true; } public static /* synthetic */ void d(MerchantWalletTransactionFragment merchantWalletTransactionFragment, Fragment fragment) { if (fragment instanceof MerchantWalletIncomingTransactionFragment) { merchantWalletTransactionFragment.c = (MerchantWalletIncomingTransactionFragment) fragment; } else if (fragment instanceof MerchantWalletOutgoingTransactionFragment) { merchantWalletTransactionFragment.g = (MerchantWalletOutgoingTransactionFragment) fragment; } } @Override // o.cZR.Sts public final void d(cZR.IeS ieS) { this.j = ieS; } @Override // o.cZR.Sts public final void b(cZR.IeS ieS) { this.d = ieS; } }