what-the-bank/sources/com/scb/phone/view/custom/investment/onboarding/CustomSpinnerWithTitle.java

645 lines
24 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.custom.investment.onboarding;
import android.content.Context;
import android.content.res.TypedArray;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import com.scb.phone.R;
import com.scb.phone.view.custom.investment.onboarding.CustomDropdownAwareSpinner;
import com.scb.phone.view.custom.investment.onboarding.CustomSpinnerWithTitle;
import java.util.ArrayList;
import java.util.List;
import o.AbstractC14961gcz;
import o.C14851gaI;
import o.C14881gav;
import o.C14957gcv;
import o.C15715hv;
import o.InterfaceC13393fZL;
import o.InterfaceC14890gbN;
import o.MYp;
import o.fZZ;
import o.nMh;
import o.qeC;
/* loaded from: classes5.dex */
public final class CustomSpinnerWithTitle extends LinearLayout {
boolean a;
public final ImageView b;
public final InterfaceC13393fZL c;
public final CustomDropdownAwareSpinner d;
String e;
public final RelativeLayout f;
private Sts g;
private ArrayAdapter<String> h;
private LWm i;
private int j;
private boolean k;
private String l;
private int m;
private boolean n;
/* renamed from: o, reason: collision with root package name */
private int f8022o;
private int p;
private View.OnClickListener q;
private List<String> r;
private String t;
/* loaded from: classes5.dex */
public interface LWm {
void bn_();
void bo_();
}
/* loaded from: classes5.dex */
public interface Sts {
void b();
}
public static final /* synthetic */ MYp e(CustomSpinnerWithTitle customSpinnerWithTitle) {
return (MYp) customSpinnerWithTitle.c.e();
}
/* loaded from: classes5.dex */
static final class RVV extends AbstractC14961gcz implements InterfaceC14890gbN<MYp> {
private CustomSpinnerWithTitle b;
@Override // o.InterfaceC14890gbN
public final /* synthetic */ MYp invoke() {
LayoutInflater from = LayoutInflater.from(this.b.getContext());
CustomSpinnerWithTitle customSpinnerWithTitle = this.b;
if (customSpinnerWithTitle == null) {
throw new NullPointerException("parent");
}
from.inflate(R.layout.2131559361, customSpinnerWithTitle);
int i = R.id.custom_spinner;
CustomDropdownAwareSpinner customDropdownAwareSpinner = (CustomDropdownAwareSpinner) qeC.e(customSpinnerWithTitle, R.id.custom_spinner);
if (customDropdownAwareSpinner != null) {
i = R.id.iv_icon;
ImageView imageView = (ImageView) qeC.e(customSpinnerWithTitle, R.id.iv_icon);
if (imageView != null) {
i = R.id.iv_spinner_arrow;
ImageView imageView2 = (ImageView) qeC.e(customSpinnerWithTitle, R.id.iv_spinner_arrow);
if (imageView2 != null) {
i = R.id.rl_layout_spinner_container;
RelativeLayout relativeLayout = (RelativeLayout) qeC.e(customSpinnerWithTitle, R.id.rl_layout_spinner_container);
if (relativeLayout != null) {
i = R.id.tv_description;
TextView textView = (TextView) qeC.e(customSpinnerWithTitle, R.id.tv_description);
if (textView != null) {
i = R.id.tv_title;
TextView textView2 = (TextView) qeC.e(customSpinnerWithTitle, R.id.tv_title);
if (textView2 != null) {
return new MYp(customSpinnerWithTitle, customDropdownAwareSpinner, imageView, imageView2, relativeLayout, textView, textView2);
}
}
}
}
}
}
throw new NullPointerException("Missing required view with ID: ".concat(customSpinnerWithTitle.getResources().getResourceName(i)));
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
RVV(CustomSpinnerWithTitle customSpinnerWithTitle) {
super(0);
this.b = customSpinnerWithTitle;
}
}
public final void setHint(String str) {
this.e = str;
((MYp) this.c.e()).d.setHint(str);
}
public final void setTitle(String str) {
this.t = str;
MYp mYp = (MYp) this.c.e();
mYp.h.setVisibility(str == null ? 8 : 0);
mYp.h.setText(str);
}
public final void setIcon(int i) {
this.f8022o = i;
MYp mYp = (MYp) this.c.e();
if (i != 0) {
mYp.b.setImageResource(i);
ImageView imageView = mYp.b;
C14957gcv.c(imageView, "");
ImageView imageView2 = imageView;
C14957gcv.e(imageView2, "");
imageView2.setVisibility(0);
}
}
public final String d() {
Object selectedItem;
if ((TextUtils.isEmpty(this.e) || ((MYp) this.c.e()).c.getSelectedItemPosition() != 0) && (selectedItem = ((MYp) this.c.e()).c.getSelectedItem()) != null) {
return selectedItem.toString();
}
return null;
}
public final void setSelectionIndex(int i) {
this.p = i;
((MYp) this.c.e()).c.setSelection(i);
}
public final String c() {
String obj;
CharSequence text = ((MYp) this.c.e()).d.getText();
return (text == null || (obj = text.toString()) == null) ? "" : obj;
}
public final void setDescriptionText(String str) {
C14957gcv.e(str, "");
this.l = str;
((MYp) this.c.e()).d.setText(str);
}
public CustomSpinnerWithTitle(Context context) {
this(context, null);
}
public CustomSpinnerWithTitle(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
/* JADX WARN: Multi-variable type inference failed */
public CustomSpinnerWithTitle(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
TypedArray obtainStyledAttributes;
RVV rvv = new RVV(this);
C14957gcv.e(rvv, "");
fZZ fzz = new fZZ(rvv);
this.c = fzz;
this.r = new ArrayList();
this.j = R.color.f3412131099849;
this.m = R.layout.2131559352;
RelativeLayout relativeLayout = ((MYp) fzz.e()).e;
C14957gcv.c(relativeLayout, "");
this.f = relativeLayout;
CustomDropdownAwareSpinner customDropdownAwareSpinner = ((MYp) fzz.e()).c;
C14957gcv.c(customDropdownAwareSpinner, "");
this.d = customDropdownAwareSpinner;
ImageView imageView = ((MYp) fzz.e()).a;
C14957gcv.c(imageView, "");
this.b = imageView;
this.p = -1;
this.l = "";
if (context != null && (obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, C15715hv.jbe.CustomSpinnerWithTitle, 0, 0)) != null) {
setTitle(obtainStyledAttributes.getString(3));
setHint(obtainStyledAttributes.getString(1));
setIcon(obtainStyledAttributes.getResourceId(2, 0));
((MYp) fzz.e()).d.setHintTextColor(nMh.getColor(getContext(), this.j));
obtainStyledAttributes.recycle();
}
MYp mYp = (MYp) fzz.e();
mYp.e.setOnClickListener(new View.OnClickListener(this) { // from class: o.eDi
private CustomSpinnerWithTitle d;
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
CustomSpinnerWithTitle.b(this.d);
}
{
this.d = this;
}
});
mYp.d.setOnClickListener(new View.OnClickListener(this) { // from class: o.eDk
private CustomSpinnerWithTitle c;
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
CustomSpinnerWithTitle.a(this.c);
}
{
this.c = this;
}
});
mYp.a.setOnClickListener(new View.OnClickListener(this) { // from class: o.eDj
private CustomSpinnerWithTitle a;
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
CustomSpinnerWithTitle.c(this.a);
}
{
this.a = this;
}
});
mYp.b.setOnClickListener(new View.OnClickListener(this) { // from class: o.eDo
private CustomSpinnerWithTitle b;
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
CustomSpinnerWithTitle.d(this.b, view);
}
{
this.b = this;
}
});
}
public final void setOnCustomSpinnerWithTitleCompletion(LWm lWm) {
setOnCustomSpinnerWithTitleCompletion(lWm, null);
}
public final void setItems(List<String> list, boolean z, boolean z2) {
if (this.h == null) {
HBt hBt = new HBt(this, getContext(), this.m, this.r);
hBt.setDropDownViewResource(this.m);
MYp mYp = (MYp) this.c.e();
mYp.c.setAdapter((SpinnerAdapter) hBt);
mYp.c.setOnItemSelectedListener(new ZqN(mYp, this));
this.h = hBt;
}
this.n = z2;
List<String> list2 = this.r;
list2.clear();
if (list == null) {
list = C14851gaI.c;
}
list2.addAll(list);
if (z) {
list2.add(0, this.e);
}
ArrayAdapter<String> arrayAdapter = this.h;
if (arrayAdapter != null) {
arrayAdapter.notifyDataSetChanged();
}
}
/* loaded from: classes5.dex */
public static final class HBt extends ArrayAdapter<String> {
private CustomSpinnerWithTitle d;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
HBt(CustomSpinnerWithTitle customSpinnerWithTitle, Context context, int i, List<String> list) {
super(context, i, list);
this.d = customSpinnerWithTitle;
}
/* JADX WARN: Code restructure failed: missing block: B:11:0x0022, code lost:
if ((!(r1 == null || o.gdZ.d((java.lang.CharSequence) r1))) != false) goto L14;
*/
/* JADX WARN: Removed duplicated region for block: B:16:0x003b */
/* JADX WARN: Removed duplicated region for block: B:18:0x0042 */
/* JADX WARN: Removed duplicated region for block: B:23:0x003f */
@Override // android.widget.ArrayAdapter, android.widget.Adapter
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final android.view.View getView(int r4, android.view.View r5, android.view.ViewGroup r6) {
/*
r3 = this;
java.lang.String r0 = ""
o.C14957gcv.e(r6, r0)
if (r4 != 0) goto L2b
com.scb.phone.view.custom.investment.onboarding.CustomSpinnerWithTitle r1 = r3.d
boolean r1 = com.scb.phone.view.custom.investment.onboarding.CustomSpinnerWithTitle.j(r1)
if (r1 == 0) goto L24
com.scb.phone.view.custom.investment.onboarding.CustomSpinnerWithTitle r1 = r3.d
java.lang.String r1 = r1.e
java.lang.CharSequence r1 = (java.lang.CharSequence) r1
r2 = 1
if (r1 == 0) goto L20
boolean r1 = o.gdZ.d(r1)
if (r1 != 0) goto L20
r1 = 0
goto L21
L20:
r1 = r2
L21:
r1 = r1 ^ r2
if (r1 == 0) goto L2b
L24:
com.scb.phone.view.custom.investment.onboarding.CustomSpinnerWithTitle r1 = r3.d
int r1 = com.scb.phone.view.custom.investment.onboarding.CustomSpinnerWithTitle.d(r1)
goto L2e
L2b:
r1 = 2131100905(0x7f0604e9, float:1.7814205E38)
L2e:
android.view.View r4 = super.getView(r4, r5, r6)
o.C14957gcv.c(r4, r0)
com.scb.phone.view.custom.investment.onboarding.CustomSpinnerWithTitle r5 = r3.d
boolean r6 = r4 instanceof android.widget.TextView
if (r6 == 0) goto L3f
r6 = r4
android.widget.TextView r6 = (android.widget.TextView) r6
goto L40
L3f:
r6 = 0
L40:
if (r6 == 0) goto L70
android.content.Context r0 = r6.getContext()
android.content.res.ColorStateList r0 = o.nMh.getColorStateList(r0, r1)
r6.setTextColor(r0)
int r0 = r6.getPaddingLeft()
int r1 = r6.getPaddingRight()
if (r0 != r1) goto L70
int r0 = r6.getPaddingLeft()
int r1 = r6.getPaddingTop()
o.MYp r5 = com.scb.phone.view.custom.investment.onboarding.CustomSpinnerWithTitle.e(r5)
android.widget.ImageView r5 = r5.a
int r5 = r5.getMeasuredWidth()
int r2 = r6.getPaddingBottom()
r6.setPadding(r0, r1, r5, r2)
L70:
return r4
*/
throw new UnsupportedOperationException("Method not decompiled: com.scb.phone.view.custom.investment.onboarding.CustomSpinnerWithTitle.HBt.getView(int, android.view.View, android.view.ViewGroup):android.view.View");
}
/* JADX WARN: Removed duplicated region for block: B:13:0x002e */
/* JADX WARN: Removed duplicated region for block: B:15:0x0035 */
/* JADX WARN: Removed duplicated region for block: B:18:0x0032 */
@Override // android.widget.ArrayAdapter, android.widget.BaseAdapter, android.widget.SpinnerAdapter
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final android.view.View getDropDownView(int r3, android.view.View r4, android.view.ViewGroup r5) {
/*
r2 = this;
java.lang.String r0 = ""
o.C14957gcv.e(r5, r0)
if (r3 != 0) goto L23
com.scb.phone.view.custom.investment.onboarding.CustomSpinnerWithTitle r0 = r2.d
java.lang.String r0 = r0.e
java.lang.CharSequence r0 = (java.lang.CharSequence) r0
r1 = 1
if (r0 == 0) goto L18
boolean r0 = o.gdZ.d(r0)
if (r0 != 0) goto L18
r0 = 0
goto L19
L18:
r0 = r1
L19:
r0 = r0 ^ r1
if (r0 == 0) goto L23
com.scb.phone.view.custom.investment.onboarding.CustomSpinnerWithTitle r0 = r2.d
int r0 = com.scb.phone.view.custom.investment.onboarding.CustomSpinnerWithTitle.d(r0)
goto L26
L23:
r0 = 2131100905(0x7f0604e9, float:1.7814205E38)
L26:
android.view.View r3 = super.getDropDownView(r3, r4, r5)
boolean r4 = r3 instanceof android.widget.TextView
if (r4 == 0) goto L32
r4 = r3
android.widget.TextView r4 = (android.widget.TextView) r4
goto L33
L32:
r4 = 0
L33:
if (r4 == 0) goto L40
android.content.Context r5 = r2.getContext()
int r5 = o.nMh.getColor(r5, r0)
r4.setTextColor(r5)
L40:
return r3
*/
throw new UnsupportedOperationException("Method not decompiled: com.scb.phone.view.custom.investment.onboarding.CustomSpinnerWithTitle.HBt.getDropDownView(int, android.view.View, android.view.ViewGroup):android.view.View");
}
@Override // android.widget.BaseAdapter, android.widget.ListAdapter
public final boolean isEnabled(int i) {
return !this.d.a || i > 0;
}
}
/* loaded from: classes5.dex */
public static final class ZqN implements AdapterView.OnItemSelectedListener {
private MYp a;
private CustomSpinnerWithTitle d;
ZqN(MYp mYp, CustomSpinnerWithTitle customSpinnerWithTitle) {
this.a = mYp;
this.d = customSpinnerWithTitle;
}
@Override // android.widget.AdapterView.OnItemSelectedListener
public final void onItemSelected(AdapterView<?> adapterView, View view, int i, long j) {
C14957gcv.e(view, "");
TextView textView = this.a.d;
C14957gcv.c(textView, "");
TextView textView2 = textView;
C14957gcv.e(textView2, "");
textView2.setVisibility(8);
LWm lWm = this.d.i;
if (lWm != null) {
lWm.bo_();
}
}
@Override // android.widget.AdapterView.OnItemSelectedListener
public final void onNothingSelected(AdapterView<?> adapterView) {
TextView textView = this.a.d;
C14957gcv.c(textView, "");
TextView textView2 = textView;
C14957gcv.e(textView2, "");
textView2.setVisibility(0);
}
}
public final void setItemsWithPlaceholder(List<String> list, boolean z) {
setItemsWithPlaceholder(list, z, true);
}
public final void setItemsWithPlaceholder(List<String> list, boolean z, boolean z2) {
setItems(list, z, true);
if (z2) {
((MYp) this.c.e()).c.performClick();
}
}
public final void setItemsWithOneItemCondition(List<String> list, boolean z) {
C14957gcv.e(list, "");
MYp mYp = (MYp) this.c.e();
if (list.size() == 1) {
mYp.d.setText((CharSequence) C14881gav.e((List) list));
CustomDropdownAwareSpinner customDropdownAwareSpinner = mYp.c;
C14957gcv.c(customDropdownAwareSpinner, "");
CustomDropdownAwareSpinner customDropdownAwareSpinner2 = customDropdownAwareSpinner;
C14957gcv.e(customDropdownAwareSpinner2, "");
customDropdownAwareSpinner2.setVisibility(8);
ImageView imageView = mYp.a;
C14957gcv.c(imageView, "");
ImageView imageView2 = imageView;
C14957gcv.e(imageView2, "");
imageView2.setVisibility(8);
return;
}
setItems(list, z, true);
}
public final void setItemsOnClick(List<String> list, boolean z, boolean z2, int i) {
C14957gcv.e(list, "");
MYp mYp = (MYp) this.c.e();
this.k = true;
if (list.size() == 1 && !z2) {
mYp.d.setText((CharSequence) C14881gav.e((List) list));
TextView textView = mYp.d;
C14957gcv.c(textView, "");
TextView textView2 = textView;
C14957gcv.e(textView2, "");
textView2.setVisibility(0);
CustomDropdownAwareSpinner customDropdownAwareSpinner = mYp.c;
C14957gcv.c(customDropdownAwareSpinner, "");
CustomDropdownAwareSpinner customDropdownAwareSpinner2 = customDropdownAwareSpinner;
C14957gcv.e(customDropdownAwareSpinner2, "");
customDropdownAwareSpinner2.setVisibility(8);
return;
}
if (true ^ list.isEmpty()) {
CustomDropdownAwareSpinner customDropdownAwareSpinner3 = mYp.c;
C14957gcv.c(customDropdownAwareSpinner3, "");
CustomDropdownAwareSpinner customDropdownAwareSpinner4 = customDropdownAwareSpinner3;
C14957gcv.e(customDropdownAwareSpinner4, "");
customDropdownAwareSpinner4.setVisibility(0);
setItemsWithPlaceholder(list, z, z2);
setSelectionIndex(i);
return;
}
mYp.d.setText("");
TextView textView3 = mYp.d;
C14957gcv.c(textView3, "");
TextView textView4 = textView3;
C14957gcv.e(textView4, "");
textView4.setVisibility(0);
CustomDropdownAwareSpinner customDropdownAwareSpinner5 = mYp.c;
C14957gcv.c(customDropdownAwareSpinner5, "");
CustomDropdownAwareSpinner customDropdownAwareSpinner6 = customDropdownAwareSpinner5;
C14957gcv.e(customDropdownAwareSpinner6, "");
customDropdownAwareSpinner6.setVisibility(8);
}
public final void b() {
this.n = false;
if (!this.r.isEmpty()) {
((MYp) this.c.e()).c.setSelection(0);
}
}
public final void e() {
if (!this.r.isEmpty()) {
((MYp) this.c.e()).c.performClick();
return;
}
Sts sts = this.g;
if (sts != null) {
sts.b();
}
}
@Override // android.view.View
public final void setEnabled(boolean z) {
MYp mYp = (MYp) this.c.e();
mYp.c.setEnabled(z);
mYp.a.setEnabled(z);
}
public final void setForegroundFontEnabled(boolean z) {
setEnabled(z);
((MYp) this.c.e()).h.setTextColor(nMh.getColor(getContext(), isEnabled() ? R.color.f2982131099805 : R.color.f3092131099816));
}
public final void setSpinnerBackground(boolean z) {
((MYp) this.c.e()).e.setBackground(nMh.getDrawable(getContext(), z ? R.drawable.shape_red_reounded_reactangle_border : R.drawable.bg_spinner));
}
public final void setDisabledText(String str) {
setHint(str);
setEnabled(false);
}
public final void setSpinnerEventsListener(CustomDropdownAwareSpinner.RVV rvv) {
C14957gcv.e(rvv, "");
((MYp) this.c.e()).c.setSpinnerEventsListener(rvv);
}
/* loaded from: classes5.dex */
public static final class IeS {
private IeS() {
}
public /* synthetic */ IeS(byte b) {
this();
}
}
public static /* synthetic */ void a(CustomSpinnerWithTitle customSpinnerWithTitle) {
LWm lWm;
C14957gcv.e(customSpinnerWithTitle, "");
if (!customSpinnerWithTitle.k || (lWm = customSpinnerWithTitle.i) == null) {
return;
}
lWm.bn_();
}
public static /* synthetic */ void b(CustomSpinnerWithTitle customSpinnerWithTitle) {
C14957gcv.e(customSpinnerWithTitle, "");
LWm lWm = customSpinnerWithTitle.i;
if (lWm != null) {
lWm.bn_();
}
}
public static /* synthetic */ void d(CustomSpinnerWithTitle customSpinnerWithTitle, View view) {
C14957gcv.e(customSpinnerWithTitle, "");
View.OnClickListener onClickListener = customSpinnerWithTitle.q;
if (onClickListener != null) {
onClickListener.onClick(view);
}
}
public static /* synthetic */ void c(CustomSpinnerWithTitle customSpinnerWithTitle) {
C14957gcv.e(customSpinnerWithTitle, "");
customSpinnerWithTitle.e();
}
public final void setHintTextColor(int i) {
this.j = i;
((MYp) this.c.e()).d.setHintTextColor(nMh.getColor(getContext(), this.j));
}
public final void setOnCustomSpinnerWithTitleCompletion(LWm lWm, Sts sts) {
this.i = lWm;
this.g = sts;
}
public final void setMandatory(boolean z) {
this.a = z;
}
public final void setItemResId(int i) {
this.m = i;
}
public final void setIconListener(View.OnClickListener onClickListener) {
this.q = onClickListener;
}
static {
new IeS((byte) 0);
}
}