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

167 lines
5.6 KiB
Java

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.CreditCardDetailsAdapter;
import com.scb.phone.view.custom.common.NoSwipeViewPager;
import java.util.List;
import me.relex.circleindicator.CircleIndicator;
import o.C0367Fb;
import o.C3742bFd;
import o.InterfaceC13391fZD;
import o.InterfaceC6668cZk;
import o.fIG;
import o.mSw;
import o.nMh;
/* loaded from: classes5.dex */
public class CreditCardTabFragment extends Hilt_CreditCardTabFragment implements ViewPager.ojQ, InterfaceC6668cZk.LWm {
CreditCardDetailsAdapter c;
@InterfaceC13391fZD
public C3742bFd creditCardPayPresenter;
int d = 0;
int g;
fIG j;
@BindView
CircleIndicator mCircleIndicator;
@BindView
TextView mEmptyCenterTitle;
@BindView
RelativeLayout mEmptyContainer;
@BindView
TextView mEmptyDescription;
@BindView
ImageView mEmptyImage;
@BindView
TextView mEmptyTitle;
@BindView
LinearLayout mErrorContainer;
@BindView
NoSwipeViewPager mViewPager;
@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 CreditCardTabFragment e(fIG fig, int i) {
CreditCardTabFragment creditCardTabFragment = new CreditCardTabFragment();
creditCardTabFragment.j = fig;
creditCardTabFragment.g = i;
return creditCardTabFragment;
}
@Override // androidx.fragment.app.Fragment
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
byte b = 0;
View inflate = layoutInflater.inflate(R.layout.2131559806, viewGroup, false);
ButterKnife.c(this, inflate);
this.mViewPager.addOnPageChangeListener(this);
this.creditCardPayPresenter.e((C3742bFd) this);
C3742bFd c3742bFd = this.creditCardPayPresenter;
if (c3742bFd.f != 0) {
c3742bFd.f.v();
}
c3742bFd.d.e();
mSw msw = c3742bFd.d;
msw.d(msw.i, new C3742bFd.LWm(c3742bFd, b));
return inflate;
}
@Override // o.InterfaceC6668cZk.LWm
public final void d() {
this.mErrorContainer.setVisibility(0);
this.mViewPager.setVisibility(8);
this.mCircleIndicator.setVisibility(8);
this.mEmptyImage.setVisibility(8);
}
@Override // o.InterfaceC6668cZk.LWm
public final void e(List<C0367Fb> list) {
if (!list.isEmpty()) {
CreditCardDetailsAdapter creditCardDetailsAdapter = new CreditCardDetailsAdapter(getContext(), list);
this.c = creditCardDetailsAdapter;
this.mViewPager.setAdapter(creditCardDetailsAdapter);
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.c.d = 0;
if (list.size() == 1 || list.size() >= 10) {
this.mCircleIndicator.setVisibility(8);
} else {
this.mCircleIndicator.setVisibility(0);
}
C0367Fb c0367Fb = this.c.e.get(0);
fIG fig = this.j;
if (fig != null) {
fig.c(null, c0367Fb);
return;
}
return;
}
this.mEmptyContainer.setVisibility(0);
this.mEmptyTitle.setText(getResources().getString(R.string.credit_card_empty_title));
this.mEmptyTitle.setVisibility(0);
this.mEmptyCenterTitle.setVisibility(8);
this.mEmptyDescription.setText(getResources().getString(R.string.credit_card_empty_description));
this.mViewPager.setVisibility(8);
this.mCircleIndicator.setVisibility(8);
this.mEmptyImage.setVisibility(8);
}
@Override // androidx.viewpager.widget.ViewPager.ojQ
public void onPageSelected(int i) {
this.d = i;
int[] iArr = {i - 1, i, i + 1};
int i2 = 0;
while (true) {
if (i2 >= 3) {
break;
}
int i3 = iArr[i2];
NoSwipeViewPager noSwipeViewPager = this.mViewPager;
View findViewWithTag = noSwipeViewPager != null ? noSwipeViewPager.findViewWithTag("TAG_CREDIT_CARD_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++;
}
C0367Fb c0367Fb = this.c.e.get(i);
fIG fig = this.j;
if (fig != null) {
fig.c(null, c0367Fb);
}
CreditCardDetailsAdapter creditCardDetailsAdapter = this.c;
if (creditCardDetailsAdapter != null) {
creditCardDetailsAdapter.d = i;
}
}
}