what-the-bank/sources/com/scb/phone/view/fragment/requesttopay/PromptPayTargetSelectFragme...

160 lines
5.9 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.fragment.requesttopay;
import android.os.Bundle;
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.transferandpay.ProxySourceAdapter;
import com.scb.phone.view.custom.common.NoSwipeViewPager;
import java.util.List;
import me.relex.circleindicator.CircleIndicator;
import o.C5973cEq;
import o.InterfaceC12824fIT;
import o.InterfaceC13391fZD;
import o.InterfaceC8929daC;
import o.VL;
import o.nMh;
/* loaded from: classes5.dex */
public class PromptPayTargetSelectFragment extends Hilt_PromptPayTargetSelectFragment implements ViewPager.ojQ, InterfaceC8929daC.ojQ, InterfaceC12824fIT {
RVV c;
private ProxySourceAdapter d;
@BindView
LinearLayout mAccountSourceLayout;
@BindView
CircleIndicator mCircleIndicator;
@BindView
LinearLayout mEmptyCard;
@BindView
TextView mEmptyDescription;
@BindView
TextView mEmptyTitle;
@BindView
NoSwipeViewPager mViewPager;
@InterfaceC13391fZD
public C5973cEq promptPayAccountTargetPresenter;
/* loaded from: classes5.dex */
public interface RVV {
void c(VL vl);
}
@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) {
}
@Override // androidx.fragment.app.Fragment
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
View inflate = layoutInflater.inflate(R.layout.2131559889, viewGroup, false);
ButterKnife.c(this, inflate);
this.mViewPager.addOnPageChangeListener(this);
return inflate;
}
@Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment
public void onDestroy() {
this.promptPayAccountTargetPresenter.w_();
super.onDestroy();
}
@Override // o.InterfaceC8929daC.ojQ
public final void b(List<VL> list) {
ProxySourceAdapter proxySourceAdapter = new ProxySourceAdapter(getContext(), list, this);
this.d = proxySourceAdapter;
this.mViewPager.setAdapter(proxySourceAdapter);
this.mViewPager.setClipToPadding(false);
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);
}
this.mCircleIndicator.setViewPager(this.mViewPager);
this.mViewPager.setCurrentItem(0);
RVV rvv = this.c;
if (rvv != null) {
rvv.c(this.d.c.get(0));
}
this.mAccountSourceLayout.setVisibility(0);
this.mEmptyCard.setVisibility(8);
}
@Override // o.InterfaceC8929daC.ojQ
public final void e() {
this.mAccountSourceLayout.setVisibility(8);
this.mEmptyTitle.setText(getResources().getString(R.string.custom_empty_title));
this.mEmptyTitle.setGravity(3);
this.mEmptyDescription.setText(getResources().getString(R.string.custom_empty_description));
this.mEmptyCard.setVisibility(0);
}
@Override // o.InterfaceC12824fIT
public final void a(int i) {
this.mViewPager.setCurrentItem(i, true);
d(i);
}
@Override // androidx.viewpager.widget.ViewPager.ojQ
public void onPageSelected(int i) {
d(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;
View findViewWithTag = noSwipeViewPager != null ? noSwipeViewPager.findViewWithTag("TAG_ACCOUNT_SOURCE_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));
}
}
}
RVV rvv = this.c;
if (rvv != null) {
rvv.c(this.d.c.get(i));
}
ProxySourceAdapter proxySourceAdapter = this.d;
if (proxySourceAdapter != null) {
proxySourceAdapter.e = i;
}
}
@Override // o.InterfaceC6627cYe.HBt
public final void aM_() {
this.mViewPager.setAdapter(new ErrorPagerAdapter(getContext()));
this.mViewPager.setClipToPadding(false);
this.mViewPager.setPadding(getResources().getDimensionPixelOffset(R.dimen.f28542131166620), 0, getResources().getDimensionPixelOffset(R.dimen.f28542131166620), 0);
this.mCircleIndicator.setViewPager(this.mViewPager);
}
}