what-the-bank/sources/com/scb/phone/view/fragment/accountsummary/MerchantWalletFragment.java

282 lines
10 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.fragment.accountsummary;
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager.widget.ViewPager;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.scb.phone.R;
import com.scb.phone.view.activity.merchant.MerchantWalletDetailActivity;
import com.scb.phone.view.adapter.accountsummary.MerchantWalletViewPagerAdapter;
import com.scb.phone.view.fragment.BaseFragment;
import com.scb.phone.view.fragment.accountsummary.MerchantWalletFragment;
import java.util.Collections;
import java.util.List;
import o.C14957gcv;
import o.C16157lj;
import o.C17558xn;
import o.C17566xq;
import o.C2440aee;
import o.InterfaceC13391fZD;
import o.InterfaceC6627cYe;
import o.PuL;
import o.RK;
import o.ZI;
import o.fSQ;
import o.glR;
/* loaded from: classes5.dex */
public class MerchantWalletFragment extends Hilt_MerchantWalletFragment implements InterfaceC6627cYe.saX {
private int f;
private MerchantWalletViewPagerAdapter h;
@BindView
TextView mTotalAmount;
@InterfaceC13391fZD
public C2440aee merchantWalletPresenter;
@Override // androidx.fragment.app.Fragment
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
View inflate = layoutInflater.inflate(R.layout.2131559442, viewGroup, false);
ButterKnife.c(this, inflate);
((BaseFragment) this).b = glR.Ge_(getContext(), new IntentFilter("com.scb.phone/BROADCAST_SWIPE_REFRESH")).subscribe(new fSQ(this) { // from class: o.eFV
private MerchantWalletFragment c;
@Override // o.fSQ
public final void c(Object obj) {
this.c.merchantWalletPresenter.b();
}
{
this.c = this;
}
}, new fSQ() { // from class: o.eFU
@Override // o.fSQ
public final void c(Object obj) {
guQ.a((Throwable) obj);
}
});
((BaseCardFragment) this).d = glR.Ge_(getContext(), new IntentFilter("com.scb.phone/BROADCAST_HOME_ACTIVITY_REFRESH")).subscribe(new fSQ(this) { // from class: o.eFZ
private MerchantWalletFragment d;
@Override // o.fSQ
public final void c(Object obj) {
this.d.merchantWalletPresenter.b();
}
{
this.d = this;
}
}, new fSQ() { // from class: o.eFU
@Override // o.fSQ
public final void c(Object obj) {
guQ.a((Throwable) obj);
}
});
((BaseCardFragment) this).j = glR.Ge_(getContext(), new IntentFilter("com.scb.phone/BROADCAST_REGISTERED_ACCOUNTS_UPDATED")).subscribe(new fSQ(this) { // from class: o.eGc
private MerchantWalletFragment c;
@Override // o.fSQ
public final void c(Object obj) {
this.c.merchantWalletPresenter.b();
}
{
this.c = this;
}
}, new fSQ() { // from class: o.eFU
@Override // o.fSQ
public final void c(Object obj) {
guQ.a((Throwable) obj);
}
});
this.merchantWalletPresenter.e((C2440aee) this);
return inflate;
}
@Override // androidx.fragment.app.Fragment
public void onResume() {
MerchantWalletViewPagerAdapter merchantWalletViewPagerAdapter;
super.onResume();
if (!this.merchantWalletPresenter.a() || (merchantWalletViewPagerAdapter = this.h) == null) {
if (this.merchantWalletPresenter.a()) {
this.merchantWalletPresenter.b();
return;
}
if (this.mViewPager.getAdapter() == ((BaseCardFragment) this).c) {
final C2440aee c2440aee = this.merchantWalletPresenter;
final List<PuL> a = c2440aee.b.e.a();
if (a != null) {
ZI.IeS ieS = new ZI.IeS(c2440aee, a) { // from class: o.aeg
private C2440aee b;
private List e;
@Override // o.ZI.IeS
public final void e(Object obj) {
C2440aee.d(this.b, this.e, (InterfaceC6627cYe.saX) obj);
}
{
this.b = c2440aee;
this.e = a;
}
};
if (c2440aee.f != 0) {
ieS.e(c2440aee.f);
return;
}
return;
}
return;
}
return;
}
C2440aee c2440aee2 = this.merchantWalletPresenter;
List<RK> list = merchantWalletViewPagerAdapter.b;
List<PuL> a2 = c2440aee2.b.e.a();
if (a2 == null) {
if (c2440aee2.a()) {
c2440aee2.b();
return;
}
ZI.IeS ieS2 = new ZI.IeS() { // from class: o.aei
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6627cYe.saX) obj).aM_();
}
};
if (c2440aee2.f != 0) {
ieS2.e(c2440aee2.f);
return;
}
return;
}
if (list != null) {
C17558xn c17558xn = c2440aee2.a;
boolean T = c2440aee2.b.d.T();
C14957gcv.e(a2, "");
final List list2 = (List) C16157lj.c(new Object[]{a2, new C17566xq(c17558xn, T, true)}, -1846295624, 1846295631, (int) System.currentTimeMillis());
C14957gcv.c(list2, "");
if (list.equals(list2)) {
return;
}
ZI.IeS ieS3 = new ZI.IeS(list2) { // from class: o.aeh
private List a;
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6627cYe.saX) obj).e((List<RK>) this.a);
}
{
this.a = list2;
}
};
if (c2440aee2.f != 0) {
ieS3.e(c2440aee2.f);
}
}
}
@Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment
public void onActivityCreated(Bundle bundle) {
super.onActivityCreated(bundle);
this.merchantWalletPresenter.b();
}
@Override // com.scb.phone.view.fragment.accountsummary.BaseCardFragment, com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment
public void onDestroy() {
C2440aee c2440aee = this.merchantWalletPresenter;
if (c2440aee != null) {
c2440aee.w_();
}
super.onDestroy();
}
@Override // o.InterfaceC6627cYe.saX
public final void e(List<RK> list) {
if (list.isEmpty()) {
RelativeLayout relativeLayout = this.mParentLayout;
if (relativeLayout != null) {
relativeLayout.setVisibility(8);
return;
}
return;
}
this.mTotalAmount.setVisibility(8);
MerchantWalletViewPagerAdapter merchantWalletViewPagerAdapter = new MerchantWalletViewPagerAdapter(getActivity(), list);
this.h = merchantWalletViewPagerAdapter;
merchantWalletViewPagerAdapter.e = new MerchantWalletViewPagerAdapter.HBt(this) { // from class: o.eFW
private MerchantWalletFragment d;
@Override // com.scb.phone.view.adapter.accountsummary.MerchantWalletViewPagerAdapter.HBt
public final void e(int i, List list2) {
MerchantWalletDetailActivity.c(this.d.getContext(), i, list2);
}
{
this.d = this;
}
};
int i = this.f;
if (i > 0 && i < this.h.getCount()) {
this.mViewPager.setCurrentItem(this.f);
}
this.mViewPager.setAdapter(this.h);
this.mViewPager.setClipToPadding(false);
this.mViewPager.setPadding(getResources().getDimensionPixelOffset(R.dimen.f28542131166620), 0, getResources().getDimensionPixelOffset(R.dimen.f28542131166620), 0);
this.mViewPager.addOnPageChangeListener(new ViewPager.ojQ(this) { // from class: com.scb.phone.view.fragment.accountsummary.MerchantWalletFragment.2
private MerchantWalletFragment e;
@Override // androidx.viewpager.widget.ViewPager.ojQ
public final void onPageScrollStateChanged(int i2) {
}
@Override // androidx.viewpager.widget.ViewPager.ojQ
public final void onPageScrolled(int i2, float f, int i3) {
}
{
this.e = this;
}
@Override // androidx.viewpager.widget.ViewPager.ojQ
public final void onPageSelected(int i2) {
this.e.f = i2;
}
});
b(list);
RelativeLayout relativeLayout2 = this.mParentLayout;
if (relativeLayout2 != null) {
relativeLayout2.setVisibility(0);
}
}
@Override // com.scb.phone.view.fragment.accountsummary.BaseCardFragment, com.scb.phone.view.fragment.BaseFragment, o.InterfaceC6638cYp
public final void v() {
FragmentActivity activity = getActivity();
if (activity != null) {
MerchantWalletViewPagerAdapter merchantWalletViewPagerAdapter = new MerchantWalletViewPagerAdapter(activity, Collections.emptyList());
e(merchantWalletViewPagerAdapter);
merchantWalletViewPagerAdapter.c = true;
merchantWalletViewPagerAdapter.notifyDataSetChanged();
}
}
@Override // com.scb.phone.view.fragment.accountsummary.BaseCardFragment, o.InterfaceC6627cYe.HBt
public final void aM_() {
FragmentActivity activity = getActivity();
if (activity != null) {
e(new MerchantWalletViewPagerAdapter(activity, Collections.singletonList(new RK())));
}
this.h = null;
}
}