what-the-bank/sources/com/scb/phone/view/fragment/investment/purchase/AccountTabFragment.java

189 lines
6.2 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.fragment.investment.purchase;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
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.investment.purchase.AccountDetailsAdapter;
import java.util.List;
import me.relex.circleindicator.CircleIndicator;
import o.C0386Fk;
import o.C3743bFe;
import o.InterfaceC12876fJt;
import o.InterfaceC13391fZD;
import o.InterfaceC6668cZk;
import o.fIG;
import o.mSw;
import o.nMh;
/* loaded from: classes5.dex */
public class AccountTabFragment extends Hilt_AccountTabFragment implements ViewPager.ojQ, InterfaceC6668cZk.RVV {
@InterfaceC13391fZD
public C3743bFe accountPayPresenter;
AccountDetailsAdapter d;
private InterfaceC12876fJt g;
fIG h;
int j;
@BindView
CircleIndicator mCircleIndicator;
@BindView
TextView mEmptyCenterTitle;
@BindView
RelativeLayout mEmptyContainer;
@BindView
TextView mEmptyDescription;
@BindView
ImageView mEmptyImage;
@BindView
TextView mEmptyTitle;
@BindView
LinearLayout mErrorContainer;
@BindView
ViewPager mViewPager;
int c = 0;
private boolean f = false;
private String i = null;
@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) {
}
public static AccountTabFragment e(fIG fig, InterfaceC12876fJt interfaceC12876fJt, int i, boolean z, String str) {
AccountTabFragment accountTabFragment = new AccountTabFragment();
accountTabFragment.h = fig;
accountTabFragment.g = interfaceC12876fJt;
accountTabFragment.j = i;
accountTabFragment.f = z;
accountTabFragment.i = str;
return accountTabFragment;
}
@Override // androidx.fragment.app.Fragment
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
View inflate = layoutInflater.inflate(R.layout.2131559805, viewGroup, false);
ButterKnife.c(this, inflate);
this.mViewPager.addOnPageChangeListener(this);
this.accountPayPresenter.e((C3743bFe) this);
C3743bFe c3743bFe = this.accountPayPresenter;
int i = this.j;
boolean z = this.f;
String str = this.i;
c3743bFe.e = i;
c3743bFe.c = z;
c3743bFe.a = str;
C3743bFe c3743bFe2 = this.accountPayPresenter;
if (c3743bFe2.f != 0) {
c3743bFe2.f.v();
}
c3743bFe2.d.d();
mSw msw = c3743bFe2.d;
msw.d(msw.i, new C3743bFe.HBt(c3743bFe2));
return inflate;
}
@Override // o.InterfaceC6668cZk.RVV
public final void b() {
this.mErrorContainer.setVisibility(0);
this.mViewPager.setVisibility(8);
this.mCircleIndicator.setVisibility(8);
this.mEmptyImage.setVisibility(8);
}
@Override // o.InterfaceC6668cZk.RVV
public final void c(List<C0386Fk> list) {
if (!list.isEmpty()) {
AccountDetailsAdapter accountDetailsAdapter = new AccountDetailsAdapter(getContext(), list);
this.d = accountDetailsAdapter;
this.mViewPager.setAdapter(accountDetailsAdapter);
this.mViewPager.setClipToPadding(false);
this.mViewPager.setPadding(getResources().getDimensionPixelOffset(R.dimen.f28572131166623), 0, getResources().getDimensionPixelOffset(R.dimen.f28572131166623), 0);
this.mViewPager.setOffscreenPageLimit(1);
this.mCircleIndicator.setViewPager(this.mViewPager);
this.mViewPager.setCurrentItem(0);
this.d.d = 0;
if (list.size() == 1 || list.size() >= 10) {
this.mCircleIndicator.setVisibility(8);
} else {
this.mCircleIndicator.setVisibility(0);
}
C0386Fk c0386Fk = this.d.a.get(0);
fIG fig = this.h;
if (fig != null) {
fig.c(c0386Fk, null);
return;
}
return;
}
this.mEmptyContainer.setVisibility(0);
this.mEmptyTitle.setText(getResources().getString(R.string.account_empty_title));
this.mEmptyTitle.setVisibility(0);
this.mEmptyCenterTitle.setVisibility(8);
this.mEmptyDescription.setVisibility(0);
this.mEmptyDescription.setText(getResources().getString(R.string.account_empty_description));
this.mViewPager.setVisibility(8);
this.mCircleIndicator.setVisibility(8);
this.mEmptyImage.setVisibility(8);
}
@Override // o.InterfaceC6668cZk.RVV
public final void a(List<C0386Fk> list) {
InterfaceC12876fJt interfaceC12876fJt = this.g;
if (interfaceC12876fJt != null) {
interfaceC12876fJt.d(list);
}
}
@Override // androidx.viewpager.widget.ViewPager.ojQ
public void onPageSelected(int i) {
this.c = i;
int[] iArr = {i - 1, i, i + 1};
int i2 = 0;
while (true) {
if (i2 >= 3) {
break;
}
int i3 = iArr[i2];
ViewPager viewPager = this.mViewPager;
View findViewWithTag = viewPager != null ? viewPager.findViewWithTag("TAG_ACCOUNT_LIST_ADAPTER".concat(String.valueOf(i3))) : null;
if (findViewWithTag != null) {
if (i == i3) {
findViewWithTag.setBackground(nMh.getDrawable(getContext(), R.drawable.rounded_purple_view_pager));
} else {
findViewWithTag.setBackground(nMh.getDrawable(getContext(), R.drawable.bg_white_rounded));
}
}
i2++;
}
C0386Fk c0386Fk = this.d.a.get(i);
fIG fig = this.h;
if (fig != null) {
fig.c(c0386Fk, null);
}
AccountDetailsAdapter accountDetailsAdapter = this.d;
if (accountDetailsAdapter != null) {
accountDetailsAdapter.d = i;
}
}
}