what-the-bank/sources/o/dXX.java

174 lines
5.5 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import android.content.Context;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import com.scb.phone.view.activity.mwpartner.MwBusinessDetailsActivity;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import o.PRA;
import o.dXX;
/* loaded from: classes5.dex */
public final class dXX<T> extends BaseAdapter {
private final String a;
final IeS<T> c;
Context e;
private final Sts<T> f;
private final ArrayAdapter<String> g;
final List<T> b = new ArrayList();
public boolean d = false;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes5.dex */
public interface IeS<T> {
void e(T t);
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes5.dex */
public interface Sts<T> {
String a(T t);
}
@Override // android.widget.BaseAdapter, android.widget.ListAdapter
public final boolean isEnabled(int i) {
return i != 0;
}
public dXX(Context context, String str, Sts<T> sts, IeS<T> ieS) {
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this, context, context) { // from class: o.dXX.2
private Context c;
private dXX e;
{
this.e = this;
this.c = context;
}
@Override // android.widget.ArrayAdapter, android.widget.BaseAdapter, android.widget.SpinnerAdapter
public final View getDropDownView(int i, View view, ViewGroup viewGroup) {
View dropDownView = super.getDropDownView(i, view, viewGroup);
TextView textView = (TextView) dropDownView;
if (i == 0) {
textView.setTextColor(-3553587);
} else {
textView.setTextColor(-13290951);
}
return dropDownView;
}
@Override // android.widget.ArrayAdapter, android.widget.Adapter
public final View getView(int i, View view, ViewGroup viewGroup) {
View view2 = super.getView(i, view, viewGroup);
TextView textView = (TextView) view2;
if (i == 0) {
textView.setTextColor(-3553587);
} else {
textView.setTextColor(-13290951);
}
return view2;
}
};
this.g = arrayAdapter;
arrayAdapter.setDropDownViewResource(com.scb.phone.R.layout.2131559352);
this.a = str;
this.f = sts;
this.c = ieS;
this.e = context;
}
public final void aif_(Spinner spinner) {
this.g.addAll(this.a);
spinner.setAdapter((SpinnerAdapter) this);
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(this) { // from class: o.dXX.1
private dXX e;
@Override // android.widget.AdapterView.OnItemSelectedListener
public final void onNothingSelected(AdapterView<?> adapterView) {
}
{
this.e = this;
}
@Override // android.widget.AdapterView.OnItemSelectedListener
public final void onItemSelected(AdapterView<?> adapterView, View view, int i, long j) {
if (this.e.c == null || i <= 0) {
return;
}
this.e.c.e(this.e.b.get(i - 1));
}
});
spinner.setOnTouchListener(new View.OnTouchListener(this) { // from class: o.dYb
private dXX e;
@Override // android.view.View.OnTouchListener
public final boolean onTouch(View view, MotionEvent motionEvent) {
dXX dxx = this.e;
view.performClick();
dxx.d = true;
((MwBusinessDetailsActivity) dxx.e).aN_();
return false;
}
{
this.e = this;
}
});
}
public final void d(Collection<T> collection) {
this.b.clear();
this.b.addAll(collection);
YKU yku = new YKU(this.b);
final Sts<T> sts = this.f;
Objects.requireNonNull(sts);
List list = (List) new YKU(yku.a, new wxK(yku.b, new InterfaceC1244Ytw(sts) { // from class: o.dXY
private dXX.Sts a;
@Override // o.InterfaceC1244Ytw
public final Object d(Object obj) {
return this.a.a(obj);
}
{
this.a = sts;
}
})).a(new PRA.Sts(new PRA.AnonymousClass4(), new PRA.AnonymousClass8()));
list.add(0, this.a);
this.g.clear();
this.g.addAll(list);
notifyDataSetChanged();
}
@Override // android.widget.Adapter
public final int getCount() {
return this.g.getCount();
}
@Override // android.widget.Adapter
public final T getItem(int i) {
return this.b.get(i);
}
@Override // android.widget.Adapter
public final long getItemId(int i) {
return this.g.getItemId(i);
}
@Override // android.widget.Adapter
public final View getView(int i, View view, ViewGroup viewGroup) {
return this.g.getView(i, view, viewGroup);
}
}