186 lines
6.3 KiB
Java
186 lines
6.3 KiB
Java
package com.scb.phone.view.adapter.investment.onboarding;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.drawable.StateListDrawable;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.TextView;
|
|
import androidx.cardview.widget.CardView;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
import butterknife.BindView;
|
|
import butterknife.ButterKnife;
|
|
import butterknife.Unbinder;
|
|
import com.scb.phone.R;
|
|
import com.scb.phone.view.adapter.investment.onboarding.FundAccountPagerAdapter;
|
|
import java.util.List;
|
|
import o.PL;
|
|
import o.WYJ;
|
|
import o.nMh;
|
|
import o.pyT;
|
|
|
|
/* loaded from: classes5.dex */
|
|
public final class FundAccountPagerAdapter extends WYJ {
|
|
public int a = -1;
|
|
private LayoutInflater b;
|
|
private final Sts c;
|
|
private final List<PL> d;
|
|
private Context e;
|
|
|
|
/* loaded from: classes5.dex */
|
|
public interface Sts {
|
|
void e(int i);
|
|
}
|
|
|
|
@Override // o.WYJ
|
|
public final boolean isViewFromObject(View view, Object obj) {
|
|
return view == obj;
|
|
}
|
|
|
|
/* loaded from: classes5.dex */
|
|
public class ItemViewHolder_ViewBinding implements Unbinder {
|
|
private ItemViewHolder c;
|
|
|
|
public ItemViewHolder_ViewBinding(ItemViewHolder itemViewHolder, View view) {
|
|
this.c = itemViewHolder;
|
|
itemViewHolder.name = (TextView) pyT.e(view, R.id.text_account_name, "field 'name'", TextView.class);
|
|
itemViewHolder.number = (TextView) pyT.e(view, R.id.text_account_number, "field 'number'", TextView.class);
|
|
itemViewHolder.branch = (TextView) pyT.e(view, R.id.text_account_branch, "field 'branch'", TextView.class);
|
|
itemViewHolder.layoutContainer = (LinearLayout) pyT.e(view, R.id.layout_container, "field 'layoutContainer'", LinearLayout.class);
|
|
itemViewHolder.cardViewContainer = (CardView) pyT.e(view, R.id.card_view_container, "field 'cardViewContainer'", CardView.class);
|
|
}
|
|
|
|
@Override // butterknife.Unbinder
|
|
public final void a() {
|
|
ItemViewHolder itemViewHolder = this.c;
|
|
if (itemViewHolder == null) {
|
|
throw new IllegalStateException("Bindings already cleared.");
|
|
}
|
|
this.c = null;
|
|
itemViewHolder.name = null;
|
|
itemViewHolder.number = null;
|
|
itemViewHolder.branch = null;
|
|
itemViewHolder.layoutContainer = null;
|
|
itemViewHolder.cardViewContainer = null;
|
|
}
|
|
}
|
|
|
|
public FundAccountPagerAdapter(Context context, List<PL> list, Sts sts) {
|
|
this.b = (LayoutInflater) context.getSystemService("layout_inflater");
|
|
this.d = list;
|
|
this.e = context;
|
|
this.c = sts;
|
|
}
|
|
|
|
public final PL e(int i) {
|
|
if (this.d.isEmpty()) {
|
|
return null;
|
|
}
|
|
return this.d.get(i);
|
|
}
|
|
|
|
@Override // o.WYJ
|
|
public final int getCount() {
|
|
return this.d.size();
|
|
}
|
|
|
|
@Override // o.WYJ
|
|
public final void destroyItem(ViewGroup viewGroup, int i, Object obj) {
|
|
viewGroup.removeView((View) obj);
|
|
}
|
|
|
|
@Override // o.WYJ
|
|
public final int getItemPosition(Object obj) {
|
|
if (!(obj instanceof LinearLayout)) {
|
|
return -1;
|
|
}
|
|
LinearLayout linearLayout = (LinearLayout) obj;
|
|
LinearLayout linearLayout2 = (LinearLayout) linearLayout.findViewById(R.id.layout_container);
|
|
boolean z = false;
|
|
linearLayout2.setSelected(false);
|
|
String str = (String) linearLayout.getTag();
|
|
if (this.a >= 0) {
|
|
StringBuilder sb = new StringBuilder("");
|
|
sb.append(this.a);
|
|
if (sb.toString().equals(str)) {
|
|
z = true;
|
|
}
|
|
}
|
|
linearLayout2.setSelected(z);
|
|
return super.getItemPosition(obj);
|
|
}
|
|
|
|
@Override // o.WYJ
|
|
public final Object instantiateItem(ViewGroup viewGroup, final int i) {
|
|
PL pl2 = this.d.get(i);
|
|
ItemViewHolder itemViewHolder = new ItemViewHolder(this.b.inflate(R.layout.2131559130, (ViewGroup) null));
|
|
String str = pl2.c;
|
|
itemViewHolder.name.setVisibility((str == null || str.isEmpty()) ? 8 : 0);
|
|
itemViewHolder.name.setText(str);
|
|
itemViewHolder.number.setText(pl2.d);
|
|
itemViewHolder.branch.setVisibility(pl2.h ? 0 : 8);
|
|
itemViewHolder.branch.setText(pl2.b);
|
|
View view = itemViewHolder.d;
|
|
view.setTag("".concat(String.valueOf(i)));
|
|
itemViewHolder.layoutContainer.setOnClickListener(new View.OnClickListener(this, i) { // from class: o.evD
|
|
private FundAccountPagerAdapter b;
|
|
private int d;
|
|
|
|
@Override // android.view.View.OnClickListener
|
|
public final void onClick(View view2) {
|
|
FundAccountPagerAdapter.a(this.b, this.d);
|
|
}
|
|
|
|
{
|
|
this.b = this;
|
|
this.d = i;
|
|
}
|
|
});
|
|
StateListDrawable stateListDrawable = new StateListDrawable();
|
|
stateListDrawable.addState(new int[]{android.R.attr.state_selected}, nMh.getDrawable(this.e, R.drawable.card_selector_state_selected));
|
|
stateListDrawable.addState(new int[0], nMh.getDrawable(this.e, R.drawable.card_selector_state_normal));
|
|
itemViewHolder.layoutContainer.setBackground(stateListDrawable);
|
|
LinearLayout linearLayout = itemViewHolder.layoutContainer;
|
|
int i2 = this.a;
|
|
linearLayout.setSelected(i2 >= 0 && i == i2);
|
|
viewGroup.addView(view, 0);
|
|
return view;
|
|
}
|
|
|
|
/* loaded from: classes5.dex */
|
|
static class ItemViewHolder extends RecyclerView.zJl {
|
|
|
|
@BindView
|
|
TextView branch;
|
|
|
|
@BindView
|
|
CardView cardViewContainer;
|
|
View d;
|
|
|
|
@BindView
|
|
LinearLayout layoutContainer;
|
|
|
|
@BindView
|
|
TextView name;
|
|
|
|
@BindView
|
|
TextView number;
|
|
|
|
ItemViewHolder(View view) {
|
|
super(view);
|
|
this.d = view;
|
|
ButterKnife.c(this, view);
|
|
}
|
|
}
|
|
|
|
public static /* synthetic */ void a(FundAccountPagerAdapter fundAccountPagerAdapter, int i) {
|
|
fundAccountPagerAdapter.a = i;
|
|
Sts sts = fundAccountPagerAdapter.c;
|
|
if (sts != null) {
|
|
sts.e(i);
|
|
}
|
|
fundAccountPagerAdapter.notifyDataSetChanged();
|
|
}
|
|
}
|