248 lines
7.4 KiB
Java
248 lines
7.4 KiB
Java
package com.scb.phone.view.custom.debitcard;
|
|
|
|
import android.content.Context;
|
|
import android.os.Handler;
|
|
import android.util.AttributeSet;
|
|
import android.view.LayoutInflater;
|
|
import android.view.ViewGroup;
|
|
import android.widget.ImageView;
|
|
import android.widget.LinearLayout;
|
|
import butterknife.BindView;
|
|
import butterknife.ButterKnife;
|
|
import com.scb.phone.R;
|
|
import com.scb.phone.view.custom.debitcard.CustomPinWithMaxInput;
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import o.C14881gav;
|
|
import o.C14957gcv;
|
|
import o.InterfaceC10428eDs;
|
|
import o.InterfaceC10433eDx;
|
|
|
|
/* loaded from: classes5.dex */
|
|
public final class CustomPinWithMaxInput extends LinearLayout implements InterfaceC10428eDs {
|
|
private InterfaceC10433eDx a;
|
|
private ArrayList<ImageView> b;
|
|
private int c;
|
|
private final Handler d;
|
|
private final StringBuilder e;
|
|
|
|
@BindView
|
|
public ImageView imageInput1;
|
|
|
|
@BindView
|
|
public ImageView imageInput2;
|
|
|
|
@BindView
|
|
public ImageView imageInput3;
|
|
|
|
@BindView
|
|
public ImageView imageInput4;
|
|
|
|
@BindView
|
|
public ImageView imageInput5;
|
|
|
|
@BindView
|
|
public ImageView imageInput6;
|
|
|
|
private /* synthetic */ CustomPinWithMaxInput(Context context, AttributeSet attributeSet, int i, byte b) {
|
|
this(context, (i & 2) != 0 ? null : attributeSet, 0);
|
|
}
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
public CustomPinWithMaxInput(Context context, AttributeSet attributeSet, int i) {
|
|
super(context, attributeSet, i);
|
|
C14957gcv.e(context, "");
|
|
this.e = new StringBuilder();
|
|
this.d = new Handler();
|
|
this.c = 6;
|
|
LayoutInflater.from(context).inflate(R.layout.2131559291, (ViewGroup) this, true);
|
|
ButterKnife.c(this);
|
|
ImageView[] imageViewArr = new ImageView[6];
|
|
ImageView imageView = this.imageInput1;
|
|
ImageView imageView2 = null;
|
|
if (imageView == null) {
|
|
C14957gcv.a("");
|
|
imageView = null;
|
|
}
|
|
imageViewArr[0] = imageView;
|
|
ImageView imageView3 = this.imageInput2;
|
|
if (imageView3 == null) {
|
|
C14957gcv.a("");
|
|
imageView3 = null;
|
|
}
|
|
imageViewArr[1] = imageView3;
|
|
ImageView imageView4 = this.imageInput3;
|
|
if (imageView4 == null) {
|
|
C14957gcv.a("");
|
|
imageView4 = null;
|
|
}
|
|
imageViewArr[2] = imageView4;
|
|
ImageView imageView5 = this.imageInput4;
|
|
if (imageView5 == null) {
|
|
C14957gcv.a("");
|
|
imageView5 = null;
|
|
}
|
|
imageViewArr[3] = imageView5;
|
|
ImageView imageView6 = this.imageInput5;
|
|
if (imageView6 == null) {
|
|
C14957gcv.a("");
|
|
imageView6 = null;
|
|
}
|
|
imageViewArr[4] = imageView6;
|
|
ImageView imageView7 = this.imageInput6;
|
|
if (imageView7 != null) {
|
|
imageView2 = imageView7;
|
|
} else {
|
|
C14957gcv.a("");
|
|
}
|
|
imageViewArr[5] = imageView2;
|
|
this.b = C14881gav.c(imageViewArr);
|
|
}
|
|
|
|
/* loaded from: classes5.dex */
|
|
public static final class RVV {
|
|
private RVV() {
|
|
}
|
|
|
|
public /* synthetic */ RVV(byte b) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
public final void a() {
|
|
StringBuilder sb = this.e;
|
|
sb.delete(0, sb.length());
|
|
ArrayList<ImageView> arrayList = this.b;
|
|
if (arrayList != null) {
|
|
Iterator<T> it = arrayList.iterator();
|
|
while (it.hasNext()) {
|
|
((ImageView) it.next()).setImageResource(R.drawable.shape_pin_empty);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // o.InterfaceC10428eDs
|
|
public final void d(char c) {
|
|
InterfaceC10433eDx interfaceC10433eDx;
|
|
if (this.e.length() >= this.c) {
|
|
return;
|
|
}
|
|
this.e.append(c);
|
|
ArrayList<ImageView> arrayList = this.b;
|
|
if (arrayList != null) {
|
|
arrayList.get(this.e.length() - 1).setImageResource(R.drawable.shape_pin_filled);
|
|
}
|
|
if (this.e.length() == 1 && (interfaceC10433eDx = this.a) != null) {
|
|
interfaceC10433eDx.S_();
|
|
}
|
|
if (this.e.length() != this.c || this.a == null) {
|
|
return;
|
|
}
|
|
this.d.post(new Runnable(this) { // from class: o.eCH
|
|
private CustomPinWithMaxInput d;
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
CustomPinWithMaxInput.a(this.d);
|
|
}
|
|
|
|
{
|
|
this.d = this;
|
|
}
|
|
});
|
|
}
|
|
|
|
@Override // o.InterfaceC10428eDs
|
|
public final void g() {
|
|
InterfaceC10433eDx interfaceC10433eDx;
|
|
if (this.e.length() <= 0) {
|
|
return;
|
|
}
|
|
int length = this.e.length() - 1;
|
|
this.e.deleteCharAt(length);
|
|
ArrayList<ImageView> arrayList = this.b;
|
|
if (arrayList != null) {
|
|
arrayList.get(length).setImageResource(R.drawable.shape_pin_empty);
|
|
}
|
|
if (this.e.length() != this.c - 1 || (interfaceC10433eDx = this.a) == null) {
|
|
return;
|
|
}
|
|
interfaceC10433eDx.T_();
|
|
}
|
|
|
|
public final void setMaximumInput(int i) {
|
|
this.c = i;
|
|
ArrayList<ImageView> arrayList = this.b;
|
|
if (arrayList != null) {
|
|
int size = arrayList.size();
|
|
for (int i2 = 0; i2 < size; i2++) {
|
|
if (i2 < this.c) {
|
|
arrayList.get(i2).setVisibility(0);
|
|
} else {
|
|
arrayList.get(i2).setVisibility(8);
|
|
}
|
|
}
|
|
}
|
|
invalidate();
|
|
}
|
|
|
|
public static /* synthetic */ void a(CustomPinWithMaxInput customPinWithMaxInput) {
|
|
C14957gcv.e(customPinWithMaxInput, "");
|
|
InterfaceC10433eDx interfaceC10433eDx = customPinWithMaxInput.a;
|
|
if (interfaceC10433eDx != null) {
|
|
interfaceC10433eDx.o_(customPinWithMaxInput.e.toString());
|
|
}
|
|
}
|
|
|
|
public final void setPinInputListener(InterfaceC10433eDx interfaceC10433eDx) {
|
|
C14957gcv.e(interfaceC10433eDx, "");
|
|
this.a = interfaceC10433eDx;
|
|
}
|
|
|
|
public final void setImageInput6(ImageView imageView) {
|
|
C14957gcv.e(imageView, "");
|
|
this.imageInput6 = imageView;
|
|
}
|
|
|
|
public final void setImageInput5(ImageView imageView) {
|
|
C14957gcv.e(imageView, "");
|
|
this.imageInput5 = imageView;
|
|
}
|
|
|
|
public final void setImageInput4(ImageView imageView) {
|
|
C14957gcv.e(imageView, "");
|
|
this.imageInput4 = imageView;
|
|
}
|
|
|
|
public final void setImageInput3(ImageView imageView) {
|
|
C14957gcv.e(imageView, "");
|
|
this.imageInput3 = imageView;
|
|
}
|
|
|
|
public final void setImageInput2(ImageView imageView) {
|
|
C14957gcv.e(imageView, "");
|
|
this.imageInput2 = imageView;
|
|
}
|
|
|
|
public final void setImageInput1(ImageView imageView) {
|
|
C14957gcv.e(imageView, "");
|
|
this.imageInput1 = imageView;
|
|
}
|
|
|
|
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
|
|
public CustomPinWithMaxInput(Context context, AttributeSet attributeSet) {
|
|
this(context, attributeSet, 4, (byte) 0);
|
|
C14957gcv.e(context, "");
|
|
}
|
|
|
|
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
|
|
public CustomPinWithMaxInput(Context context) {
|
|
this(context, null, 6, (byte) 0);
|
|
C14957gcv.e(context, "");
|
|
}
|
|
|
|
static {
|
|
new RVV((byte) 0);
|
|
}
|
|
}
|