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

165 lines
5.9 KiB
Java

package com.scb.phone.view.custom.common;
import android.content.Context;
import android.os.CountDownTimer;
import android.util.AttributeSet;
import com.scb.phone.view.custom.common.CustomDeltaInputPressed;
import java.math.BigDecimal;
/* loaded from: classes5.dex */
public class CustomDeltaInputPressed extends CustomDeltaInput {
private boolean a;
private CountDownTimer b;
private int d;
private int f;
public CustomDeltaInputPressed(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.f = 0;
this.d = 50;
this.a = true;
}
public CustomDeltaInputPressed(Context context) {
super(context);
this.f = 0;
this.d = 50;
this.a = true;
}
/* renamed from: com.scb.phone.view.custom.common.CustomDeltaInputPressed$5, reason: invalid class name */
/* loaded from: classes5.dex */
public class AnonymousClass5 extends CountDownTimer {
public final CustomDeltaInputPressed c;
private double e;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
AnonymousClass5(CustomDeltaInputPressed customDeltaInputPressed, double d) {
super(5000L, 10L);
this.c = customDeltaInputPressed;
this.e = d;
}
@Override // android.os.CountDownTimer
public final void onTick(long j) {
if (this.c.increaseButton.isPressed()) {
CustomDeltaInputPressed customDeltaInputPressed = this.c;
final double d = this.e;
CustomDeltaInputPressed.a(customDeltaInputPressed, new Runnable(this, d) { // from class: o.eBA
private double a;
private CustomDeltaInputPressed.AnonymousClass5 b;
@Override // java.lang.Runnable
public final void run() {
CustomDeltaInputPressed.AnonymousClass5 anonymousClass5 = this.b;
CustomDeltaInputPressed.b(anonymousClass5.c, this.a);
}
{
this.b = this;
this.a = d;
}
});
} else if (this.c.decreaseButton.isPressed()) {
CustomDeltaInputPressed customDeltaInputPressed2 = this.c;
final double d2 = this.e;
CustomDeltaInputPressed.a(customDeltaInputPressed2, new Runnable(this, d2) { // from class: o.eBB
private double a;
private CustomDeltaInputPressed.AnonymousClass5 e;
@Override // java.lang.Runnable
public final void run() {
CustomDeltaInputPressed.AnonymousClass5 anonymousClass5 = this.e;
CustomDeltaInputPressed.a(anonymousClass5.c, this.a);
}
{
this.e = this;
this.a = d2;
}
});
} else {
this.c.f = 0;
this.c.d = 50;
this.c.a = true;
}
}
@Override // android.os.CountDownTimer
public final void onFinish() {
start();
}
}
@Override // android.view.ViewGroup, android.view.View
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
CountDownTimer countDownTimer = this.b;
if (countDownTimer != null) {
countDownTimer.cancel();
}
}
static /* synthetic */ void a(CustomDeltaInputPressed customDeltaInputPressed, Runnable runnable) {
int i;
if (customDeltaInputPressed.a) {
runnable.run();
customDeltaInputPressed.a = false;
return;
}
int i2 = customDeltaInputPressed.f + 1;
customDeltaInputPressed.f = i2;
if (i2 >= customDeltaInputPressed.d) {
runnable.run();
int i3 = customDeltaInputPressed.d;
if (i3 <= 6) {
if (i3 == 6) {
i = 5;
}
customDeltaInputPressed.f = 0;
}
i = i3 - 10;
customDeltaInputPressed.d = i;
customDeltaInputPressed.f = 0;
}
}
public static /* synthetic */ void a(CustomDeltaInputPressed customDeltaInputPressed, double d) {
double doubleValue;
customDeltaInputPressed.errorMessage.setVisibility(8);
if (customDeltaInputPressed.c > customDeltaInputPressed.b()) {
doubleValue = customDeltaInputPressed.b();
} else {
doubleValue = BigDecimal.valueOf(customDeltaInputPressed.c).subtract(BigDecimal.valueOf(d)).doubleValue();
}
customDeltaInputPressed.e(doubleValue);
if (customDeltaInputPressed.e != null) {
customDeltaInputPressed.e.h();
}
customDeltaInputPressed.inputValue.requestFocus();
}
public static /* synthetic */ void b(CustomDeltaInputPressed customDeltaInputPressed, double d) {
double doubleValue;
customDeltaInputPressed.errorMessage.setVisibility(8);
if (customDeltaInputPressed.c < customDeltaInputPressed.d()) {
doubleValue = customDeltaInputPressed.d();
} else {
doubleValue = BigDecimal.valueOf(customDeltaInputPressed.c).add(BigDecimal.valueOf(d)).doubleValue();
}
customDeltaInputPressed.e(doubleValue);
if (customDeltaInputPressed.e != null) {
customDeltaInputPressed.e.j();
}
customDeltaInputPressed.inputValue.requestFocus();
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // com.scb.phone.view.custom.common.CustomDeltaInput
public final void b(double d) {
AnonymousClass5 anonymousClass5 = new AnonymousClass5(this, d);
this.b = anonymousClass5;
anonymousClass5.start();
}
}