162 lines
5.8 KiB
Java
162 lines
5.8 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.AccountSelectorAdapter;
|
|
import com.scb.phone.view.custom.common.NoSwipeViewPager;
|
|
import com.scb.phone.view.custom.easycash.CustomAccountSelector;
|
|
import java.util.List;
|
|
import me.relex.circleindicator.CircleIndicator;
|
|
import o.InterfaceC12824fIT;
|
|
import o.WW;
|
|
import o.nMh;
|
|
|
|
/* loaded from: classes5.dex */
|
|
public class CustomAccountSelector extends LinearLayout {
|
|
private int d;
|
|
|
|
@BindView
|
|
CircleIndicator mCircleIndicator;
|
|
|
|
@BindView
|
|
public NoSwipeViewPager mViewPager;
|
|
|
|
/* loaded from: classes5.dex */
|
|
public interface Sts {
|
|
void e(int i);
|
|
}
|
|
|
|
public CustomAccountSelector(Context context) {
|
|
this(context, null);
|
|
}
|
|
|
|
public CustomAccountSelector(Context context, AttributeSet attributeSet) {
|
|
this(context, attributeSet, 0);
|
|
}
|
|
|
|
public CustomAccountSelector(Context context, AttributeSet attributeSet, int i) {
|
|
super(context, attributeSet, i);
|
|
this.d = R.drawable.bg_white_rounded;
|
|
((LayoutInflater) context.getSystemService("layout_inflater")).inflate(R.layout.2131558900, (ViewGroup) this, true);
|
|
ButterKnife.c(this);
|
|
}
|
|
|
|
public final void d(List<WW> list, final Sts sts) {
|
|
this.mViewPager.setAdapter(new AccountSelectorAdapter(getContext(), list, new InterfaceC12824fIT(this, sts) { // from class: o.eCJ
|
|
private CustomAccountSelector b;
|
|
private CustomAccountSelector.Sts e;
|
|
|
|
@Override // o.InterfaceC12824fIT
|
|
public final void a(int i) {
|
|
CustomAccountSelector.a(this.b, this.e, i);
|
|
}
|
|
|
|
{
|
|
this.b = this;
|
|
this.e = sts;
|
|
}
|
|
}));
|
|
a(list, sts);
|
|
}
|
|
|
|
public final void a(List<WW> list, Sts sts) {
|
|
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);
|
|
if (list.size() >= 10) {
|
|
this.mCircleIndicator.setVisibility(8);
|
|
} else {
|
|
this.mCircleIndicator.setVisibility(0);
|
|
}
|
|
this.mViewPager.addOnPageChangeListener(new ViewPager.ojQ(this, sts) { // from class: com.scb.phone.view.custom.easycash.CustomAccountSelector.3
|
|
private Sts a;
|
|
private CustomAccountSelector e;
|
|
|
|
@Override // androidx.viewpager.widget.ViewPager.ojQ
|
|
public final void onPageScrollStateChanged(int i) {
|
|
}
|
|
|
|
@Override // androidx.viewpager.widget.ViewPager.ojQ
|
|
public final void onPageScrolled(int i, float f, int i2) {
|
|
}
|
|
|
|
{
|
|
this.e = this;
|
|
this.a = sts;
|
|
}
|
|
|
|
@Override // androidx.viewpager.widget.ViewPager.ojQ
|
|
public final void onPageSelected(int i) {
|
|
this.e.setSelectedAccountStyle(i);
|
|
this.a.e(i);
|
|
}
|
|
});
|
|
}
|
|
|
|
public void setSelectedAccount(int i) {
|
|
if (this.mViewPager.getAdapter() instanceof AccountSelectorAdapter) {
|
|
((AccountSelectorAdapter) this.mViewPager.getAdapter()).c = i;
|
|
}
|
|
this.mViewPager.setCurrentItem(i);
|
|
setSelectedAccountStyle(i);
|
|
}
|
|
|
|
public final WW e() {
|
|
if (!(this.mViewPager.getAdapter() instanceof AccountSelectorAdapter)) {
|
|
return null;
|
|
}
|
|
AccountSelectorAdapter accountSelectorAdapter = (AccountSelectorAdapter) this.mViewPager.getAdapter();
|
|
int currentItem = this.mViewPager.getCurrentItem();
|
|
if (currentItem < accountSelectorAdapter.getCount()) {
|
|
return accountSelectorAdapter.a.get(currentItem);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public void setSelectedAccountStyle(int i) {
|
|
int[] iArr = {i - 1, i, i + 1};
|
|
for (int i2 = 0; i2 < 3; i2++) {
|
|
int i3 = iArr[i2];
|
|
NoSwipeViewPager noSwipeViewPager = this.mViewPager;
|
|
if (noSwipeViewPager != null) {
|
|
View findViewWithTag = noSwipeViewPager.findViewWithTag("TAG_ACCOUNT_SELECTOR_ADAPTER_BACKGROUND".concat(String.valueOf(i3)));
|
|
TextView textView = (TextView) this.mViewPager.findViewWithTag("TAG_ACCOUNT_SELECTOR_ADAPTER_TEXT".concat(String.valueOf(i3)));
|
|
if (findViewWithTag != null) {
|
|
findViewWithTag.setBackground(nMh.getDrawable(getContext(), i == i3 ? R.drawable.rounded_purple_view_pager : this.d));
|
|
}
|
|
if (textView != null) {
|
|
textView.setTextColor(nMh.getColor(getContext(), i == i3 ? R.color.f2982131099805 : R.color.f3092131099816));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public static /* synthetic */ void a(CustomAccountSelector customAccountSelector, Sts sts, int i) {
|
|
customAccountSelector.mViewPager.setCurrentItem(i, true);
|
|
sts.e(i);
|
|
}
|
|
|
|
public static /* synthetic */ void d(CustomAccountSelector customAccountSelector, Sts sts, int i) {
|
|
customAccountSelector.mViewPager.setCurrentItem(i, true);
|
|
sts.e(i);
|
|
}
|
|
|
|
public void setBackgroundDrawable(int i) {
|
|
this.d = i;
|
|
}
|
|
}
|