99 lines
3.5 KiB
Java
99 lines
3.5 KiB
Java
|
package com.scb.phone.view.custom.easycash;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.util.AttributeSet;
|
||
|
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.easycash.CardLoanOfferViewPagerAdapter;
|
||
|
import java.util.List;
|
||
|
import me.relex.circleindicator.CircleIndicator;
|
||
|
import o.IR;
|
||
|
import o.JO;
|
||
|
import o.nMh;
|
||
|
|
||
|
/* loaded from: classes5.dex */
|
||
|
public class CustomCreditCardPageSelector extends LinearLayout {
|
||
|
|
||
|
@BindView
|
||
|
ViewPager cardViewPager;
|
||
|
|
||
|
@BindView
|
||
|
protected CircleIndicator mCircleIndicator;
|
||
|
|
||
|
@BindView
|
||
|
TextView sectionHeader;
|
||
|
|
||
|
public CustomCreditCardPageSelector(Context context) {
|
||
|
this(context, null);
|
||
|
}
|
||
|
|
||
|
public CustomCreditCardPageSelector(Context context, AttributeSet attributeSet) {
|
||
|
this(context, attributeSet, 0);
|
||
|
}
|
||
|
|
||
|
public CustomCreditCardPageSelector(Context context, AttributeSet attributeSet, int i) {
|
||
|
super(context, attributeSet, i);
|
||
|
setOrientation(1);
|
||
|
((LayoutInflater) context.getSystemService("layout_inflater")).inflate(R.layout.2131558983, (ViewGroup) this, true);
|
||
|
ButterKnife.c(this);
|
||
|
}
|
||
|
|
||
|
private void d(List<JO> list, boolean z, boolean z2, boolean z3, ViewPager.ojQ ojq) {
|
||
|
this.cardViewPager.setAdapter(new CardLoanOfferViewPagerAdapter(list, z, z2));
|
||
|
this.cardViewPager.setClipToPadding(false);
|
||
|
this.cardViewPager.setPadding(getResources().getDimensionPixelOffset(R.dimen.f28582131166624), 0, getResources().getDimensionPixelOffset(R.dimen.f28582131166624), 0);
|
||
|
this.cardViewPager.clearOnPageChangeListeners();
|
||
|
this.cardViewPager.addOnPageChangeListener(ojq);
|
||
|
ojq.onPageSelected(0);
|
||
|
if (z3) {
|
||
|
this.mCircleIndicator.setViewPager(this.cardViewPager);
|
||
|
this.cardViewPager.setCurrentItem(0);
|
||
|
if (list.size() < 10) {
|
||
|
this.mCircleIndicator.setVisibility(0);
|
||
|
} else {
|
||
|
this.mCircleIndicator.setVisibility(8);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final void c() {
|
||
|
this.mCircleIndicator.setVisibility(8);
|
||
|
}
|
||
|
|
||
|
public void setSelectedCard(int i) {
|
||
|
View findViewWithTag;
|
||
|
if (this.cardViewPager.getAdapter() instanceof CardLoanOfferViewPagerAdapter) {
|
||
|
((CardLoanOfferViewPagerAdapter) this.cardViewPager.getAdapter()).e = i;
|
||
|
}
|
||
|
int[] iArr = {i - 1, i, i + 1};
|
||
|
for (int i2 = 0; i2 < 3; i2++) {
|
||
|
int i3 = iArr[i2];
|
||
|
ViewPager viewPager = this.cardViewPager;
|
||
|
if (viewPager != null && (findViewWithTag = viewPager.findViewWithTag("TAG_ACCOUNT_SELECTOR_ADAPTER_BACKGROUND".concat(String.valueOf(i3)))) != 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));
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final void e(IR ir, ViewPager.ojQ ojq) {
|
||
|
this.sectionHeader.setText(ir.d);
|
||
|
d(ir.e, true, false, false, ojq);
|
||
|
}
|
||
|
|
||
|
public final void d(IR ir, boolean z, ViewPager.ojQ ojq) {
|
||
|
this.sectionHeader.setText(ir.d);
|
||
|
d(ir.e, false, z, true, ojq);
|
||
|
}
|
||
|
}
|