what-the-bank/sources/com/scb/phone/view/custom/common/CustomTwoPicker.java

321 lines
10 KiB
Java

package com.scb.phone.view.custom.common;
import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.NumberPicker;
import android.widget.TextView;
import androidx.appcompat.widget.LinearLayoutCompat;
import com.scb.phone.R;
import java.util.ArrayList;
import java.util.Iterator;
import o.C10393eCt;
import o.C14957gcv;
import o.InterfaceC10336eBR;
import o.URz;
import o.eCC;
/* loaded from: classes5.dex */
public final class CustomTwoPicker extends LinearLayoutCompat implements NumberPicker.OnValueChangeListener {
private InterfaceC10336eBR a;
private ArrayList<NumberPicker> b;
private ArrayList<eCC> d;
private ArrayList<TextView> e;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public CustomTwoPicker(Context context) {
super(context);
C14957gcv.e(context, "");
this.d = new ArrayList<>();
this.b = new ArrayList<>();
this.e = new ArrayList<>();
c();
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public CustomTwoPicker(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
C14957gcv.e(context, "");
C14957gcv.e(attributeSet, "");
this.d = new ArrayList<>();
this.b = new ArrayList<>();
this.e = new ArrayList<>();
c();
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public CustomTwoPicker(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
C14957gcv.e(context, "");
C14957gcv.e(attributeSet, "");
this.d = new ArrayList<>();
this.b = new ArrayList<>();
this.e = new ArrayList<>();
c();
}
private final void c() {
setOrientation(0);
setGravity(17);
LayoutInflater.from(getContext()).inflate(R.layout.2131560256, this);
setPadding(getResources().getDimensionPixelOffset(R.dimen.f16782131165444), 0, getResources().getDimensionPixelOffset(R.dimen.f16782131165444), 0);
}
public static /* synthetic */ void setLoop$default(CustomTwoPicker customTwoPicker, boolean z, String str, int i, Object obj) {
if ((i & 2) != 0) {
str = "";
}
customTwoPicker.setLoop(z, str);
}
public final void setLoop(boolean z, String str) {
C14957gcv.e(str, "");
if (str.length() > 0) {
NumberPicker aps_ = aps_(str);
if (aps_ != null) {
aps_.setWrapSelectorWheel(z);
return;
}
return;
}
Iterator<T> it = this.b.iterator();
while (it.hasNext()) {
((NumberPicker) it.next()).setWrapSelectorWheel(z);
}
}
public static /* synthetic */ void setSelected$default(CustomTwoPicker customTwoPicker, int i, String str, int i2, Object obj) {
if ((i2 & 2) != 0) {
str = "";
}
customTwoPicker.setSelected(i, str);
}
public final void setSelected(int i, String str) {
C14957gcv.e(str, "");
if (i < 0) {
return;
}
if (str.length() > 0) {
NumberPicker aps_ = aps_(str);
if (aps_ != null) {
aps_.setValue(i);
return;
}
return;
}
Iterator<T> it = this.b.iterator();
while (it.hasNext()) {
((NumberPicker) it.next()).setValue(i);
}
}
public final void setMaxValue(int i, String str) {
NumberPicker aps_;
C14957gcv.e(str, "");
if (i >= 0 && (aps_ = aps_(str)) != null) {
aps_.setMaxValue(i);
}
}
public final void setMinValue(int i, String str) {
NumberPicker aps_;
C14957gcv.e(str, "");
if (i >= 0 && (aps_ = aps_(str)) != null) {
aps_.setMinValue(i);
}
}
public static /* synthetic */ void setEnable$default(CustomTwoPicker customTwoPicker, boolean z, String str, int i, Object obj) {
if ((i & 2) != 0) {
str = "";
}
customTwoPicker.setEnable(z, str);
}
public final void setEnable(boolean z, String str) {
Object obj;
C14957gcv.e(str, "");
if (str.length() != 0) {
NumberPicker aps_ = aps_(str);
if (aps_ != null) {
NumberPicker numberPicker = aps_;
numberPicker.setEnabled(z);
if (z) {
numberPicker.setAlpha(1.0f);
} else {
numberPicker.setAlpha(0.5f);
}
}
Iterator<T> it = this.e.iterator();
while (true) {
if (it.hasNext()) {
obj = it.next();
if (C14957gcv.b(((TextView) obj).getTag(), (Object) str)) {
break;
}
} else {
obj = null;
break;
}
}
TextView textView = (TextView) obj;
if (textView != null) {
TextView textView2 = textView;
textView2.setEnabled(z);
if (z) {
textView2.setAlpha(1.0f);
return;
} else {
textView2.setAlpha(0.5f);
return;
}
}
return;
}
for (TextView textView3 : this.e) {
textView3.setEnabled(z);
if (z) {
textView3.setAlpha(1.0f);
} else {
textView3.setAlpha(0.5f);
}
}
for (NumberPicker numberPicker2 : this.b) {
numberPicker2.setEnabled(z);
if (z) {
numberPicker2.setAlpha(1.0f);
} else {
numberPicker2.setAlpha(0.5f);
}
}
}
@Override // android.widget.NumberPicker.OnValueChangeListener
public final void onValueChange(NumberPicker numberPicker, int i, int i2) {
Object obj;
C14957gcv.e(numberPicker, "");
Iterator<T> it = this.d.iterator();
while (true) {
if (!it.hasNext()) {
obj = null;
break;
} else {
obj = it.next();
if (C14957gcv.b(((eCC) obj).d, numberPicker.getTag())) {
break;
}
}
}
eCC ecc = (eCC) obj;
if (ecc != null) {
if (this.d.indexOf(ecc) == 0) {
InterfaceC10336eBR interfaceC10336eBR = this.a;
if (interfaceC10336eBR != null) {
interfaceC10336eBR.b(new C10393eCt(ecc.d, ecc.c[i2], i2));
return;
}
return;
}
InterfaceC10336eBR interfaceC10336eBR2 = this.a;
if (interfaceC10336eBR2 != null) {
interfaceC10336eBR2.e(new C10393eCt(ecc.d, ecc.c[i2], i2));
}
}
}
private final NumberPicker aps_(String str) {
Object obj;
Iterator<T> it = this.b.iterator();
while (true) {
if (!it.hasNext()) {
obj = null;
break;
}
obj = it.next();
if (C14957gcv.b(((NumberPicker) obj).getTag(), (Object) str)) {
break;
}
}
return (NumberPicker) obj;
}
/* loaded from: classes5.dex */
public static final class IeS {
private IeS() {
}
public /* synthetic */ IeS(byte b) {
this();
}
}
public final void c(eCC ecc, eCC ecc2) {
C14957gcv.e(ecc, "");
removeAllViews();
this.b.clear();
this.d.clear();
this.e.clear();
this.d.add(ecc);
if (ecc2 != null) {
this.d.add(ecc2);
}
LinearLayoutCompat.RVV rvv = new LinearLayoutCompat.RVV(0, -2, 1.0f);
LinearLayoutCompat.RVV rvv2 = new LinearLayoutCompat.RVV(-2, -2);
for (eCC ecc3 : this.d) {
LinearLayout linearLayout = new LinearLayout(getContext());
linearLayout.setLayoutParams(rvv);
linearLayout.setGravity(17);
NumberPicker numberPicker = new NumberPicker(getContext());
String[] strArr = ecc3.c;
int length = strArr.length;
for (int i = 0; i < length; i++) {
String str = strArr[i];
if (str.length() > 10 && str.length() >= 3) {
String substring = str.substring(0, 7);
C14957gcv.c((Object) substring, "");
StringBuilder sb = new StringBuilder();
sb.append(substring);
sb.append("...");
str = sb.toString();
}
strArr[i] = str;
}
numberPicker.setDisplayedValues(strArr);
numberPicker.setMaxValue(ecc3.c.length - 1);
numberPicker.setWrapSelectorWheel(false);
numberPicker.setTag(ecc3.d);
LinearLayoutCompat.RVV rvv3 = rvv2;
numberPicker.setLayoutParams(rvv3);
numberPicker.setDescendantFocusability(393216);
numberPicker.setOnValueChangedListener(this);
linearLayout.addView(numberPicker);
this.b.add(numberPicker);
if (ecc3.a.length() > 0) {
TextView textView = new TextView(getContext());
textView.setText(ecc3.a);
textView.setTag(ecc3.d);
textView.setMaxLines(1);
textView.setEllipsize(TextUtils.TruncateAt.END);
textView.setLayoutParams(rvv3);
textView.setGravity(1);
URz.we_(textView, R.style.f55752132017832);
linearLayout.addView(textView);
this.e.add(textView);
}
addView(linearLayout);
}
}
public final void setOnSelectedLister(InterfaceC10336eBR interfaceC10336eBR) {
C14957gcv.e(interfaceC10336eBR, "");
this.a = interfaceC10336eBR;
}
static {
new IeS((byte) 0);
}
}