what-the-bank/sources/com/scb/phone/view/custom/ccrredemption/pointtopay/CustomDeltaSliderLongPresse...

543 lines
18 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.custom.ccrredemption.pointtopay;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import androidx.appcompat.widget.AppCompatSeekBar;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.scb.phone.R;
import com.scb.phone.view.custom.ccrredemption.pointtopay.CustomDeltaSliderLongPressed;
import java.math.BigDecimal;
import java.util.concurrent.TimeUnit;
import o.AbstractC13163fSk;
import o.AbstractC14961gcz;
import o.C13417fZt;
import o.C14866gag;
import o.C14957gcv;
import o.C6583cXR;
import o.InterfaceC14894gbR;
import o.fRR;
import o.fSJ;
import o.fSQ;
/* loaded from: classes5.dex */
public final class CustomDeltaSliderLongPressed extends RelativeLayout {
public int a;
@BindView
public AppCompatSeekBar acSbSlider;
public Sts b;
public int c;
public int d;
public fSJ e;
private boolean h;
@BindView
public ImageButton ibDecreaseButton;
@BindView
public ImageButton ibIncreaseButton;
private int j;
@BindView
public TextView tvMaxValueLabel;
@BindView
public TextView tvMinValueLabel;
@BindView
public TextView tvValueLabel;
/* loaded from: classes5.dex */
public interface Sts {
void a(double d);
void b(double d);
void d(double d);
}
private /* synthetic */ CustomDeltaSliderLongPressed(Context context, byte b) {
this(context, (AttributeSet) null);
}
public static final /* synthetic */ void a(CustomDeltaSliderLongPressed customDeltaSliderLongPressed) {
fSJ fsj = customDeltaSliderLongPressed.e;
if (fsj == null || fsj.isDisposed()) {
return;
}
fsj.dispose();
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public CustomDeltaSliderLongPressed(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
C14957gcv.e(context, "");
Object systemService = context.getSystemService("layout_inflater");
C14957gcv.d(systemService, "");
((LayoutInflater) systemService).inflate(R.layout.2131558991, (ViewGroup) this, true);
ButterKnife.c(this);
setBackgroundResource(R.drawable.bg_white_with_border);
}
public final void d() {
ImageButton imageButton = null;
if (this.d <= this.c) {
ImageButton imageButton2 = this.ibDecreaseButton;
if (imageButton2 == null) {
C14957gcv.a("");
imageButton2 = null;
}
if (imageButton2.isEnabled()) {
ImageButton imageButton3 = this.ibDecreaseButton;
if (imageButton3 == null) {
C14957gcv.a("");
imageButton3 = null;
}
imageButton3.setEnabled(false);
}
}
if (this.d >= this.a) {
ImageButton imageButton4 = this.ibIncreaseButton;
if (imageButton4 == null) {
C14957gcv.a("");
imageButton4 = null;
}
if (imageButton4.isEnabled()) {
ImageButton imageButton5 = this.ibIncreaseButton;
if (imageButton5 == null) {
C14957gcv.a("");
imageButton5 = null;
}
imageButton5.setEnabled(false);
}
}
if (this.d > this.c) {
ImageButton imageButton6 = this.ibDecreaseButton;
if (imageButton6 == null) {
C14957gcv.a("");
imageButton6 = null;
}
if (!imageButton6.isEnabled()) {
ImageButton imageButton7 = this.ibDecreaseButton;
if (imageButton7 == null) {
C14957gcv.a("");
imageButton7 = null;
}
imageButton7.setEnabled(true);
}
}
if (this.d < this.a) {
ImageButton imageButton8 = this.ibIncreaseButton;
if (imageButton8 == null) {
C14957gcv.a("");
imageButton8 = null;
}
if (imageButton8.isEnabled()) {
return;
}
ImageButton imageButton9 = this.ibIncreaseButton;
if (imageButton9 != null) {
imageButton = imageButton9;
} else {
C14957gcv.a("");
}
imageButton.setEnabled(true);
}
}
public final void e(int i) {
d(C6583cXR.e(i, this.c, this.a));
AppCompatSeekBar appCompatSeekBar = null;
if (this.c == this.a) {
AppCompatSeekBar appCompatSeekBar2 = this.acSbSlider;
if (appCompatSeekBar2 == null) {
C14957gcv.a("");
appCompatSeekBar2 = null;
}
appCompatSeekBar2.setEnabled(false);
AppCompatSeekBar appCompatSeekBar3 = this.acSbSlider;
if (appCompatSeekBar3 == null) {
C14957gcv.a("");
appCompatSeekBar3 = null;
}
AppCompatSeekBar appCompatSeekBar4 = this.acSbSlider;
if (appCompatSeekBar4 != null) {
appCompatSeekBar = appCompatSeekBar4;
} else {
C14957gcv.a("");
}
appCompatSeekBar3.setProgress(appCompatSeekBar.getMax());
return;
}
AppCompatSeekBar appCompatSeekBar5 = this.acSbSlider;
if (appCompatSeekBar5 == null) {
C14957gcv.a("");
appCompatSeekBar5 = null;
}
appCompatSeekBar5.setEnabled(true);
AppCompatSeekBar appCompatSeekBar6 = this.acSbSlider;
if (appCompatSeekBar6 != null) {
appCompatSeekBar = appCompatSeekBar6;
} else {
C14957gcv.a("");
}
double d = this.c;
appCompatSeekBar.setProgress((int) (((i - d) / (this.a - d)) * 100.0d));
}
/* loaded from: classes5.dex */
public static final class LWm implements SeekBar.OnSeekBarChangeListener {
private CustomDeltaSliderLongPressed a;
private Sts c;
public LWm(CustomDeltaSliderLongPressed customDeltaSliderLongPressed, Sts sts) {
this.a = customDeltaSliderLongPressed;
this.c = sts;
}
@Override // android.widget.SeekBar.OnSeekBarChangeListener
public final void onProgressChanged(SeekBar seekBar, int i, boolean z) {
C14957gcv.e(seekBar, "");
if (this.a.h) {
int i2 = this.a.c;
float f = i * ((this.a.a - this.a.c) / 100.0f);
if (!Float.isNaN(f)) {
int round = Math.round(f);
CustomDeltaSliderLongPressed customDeltaSliderLongPressed = this.a;
float f2 = (i2 + round) / customDeltaSliderLongPressed.j;
if (!Float.isNaN(f2)) {
int a = CustomDeltaSliderLongPressed.a(customDeltaSliderLongPressed, Math.round(f2) * this.a.j);
this.a.d(a);
this.c.b(a);
return;
}
throw new IllegalArgumentException("Cannot round NaN value.");
}
throw new IllegalArgumentException("Cannot round NaN value.");
}
}
@Override // android.widget.SeekBar.OnSeekBarChangeListener
public final void onStartTrackingTouch(SeekBar seekBar) {
C14957gcv.e(seekBar, "");
this.a.h = true;
}
@Override // android.widget.SeekBar.OnSeekBarChangeListener
public final void onStopTrackingTouch(SeekBar seekBar) {
C14957gcv.e(seekBar, "");
this.a.h = false;
this.c.a(this.a.d);
}
}
/* JADX INFO: Access modifiers changed from: private */
public final void d(int i) {
this.d = i;
TextView textView = this.tvValueLabel;
if (textView == null) {
C14957gcv.a("");
textView = null;
}
BigDecimal valueOf = BigDecimal.valueOf(i);
C14957gcv.c(valueOf, "");
textView.setText(C6583cXR.a(valueOf));
d();
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes5.dex */
public static final class RVV extends AbstractC14961gcz implements InterfaceC14894gbR<Long, C14866gag> {
private CustomDeltaSliderLongPressed b;
private int c;
@Override // o.InterfaceC14894gbR
public final /* synthetic */ C14866gag invoke(Long l) {
ImageButton imageButton = this.b.ibIncreaseButton;
Sts sts = null;
if (imageButton == null) {
C14957gcv.a("");
imageButton = null;
}
if (imageButton.isPressed()) {
CustomDeltaSliderLongPressed customDeltaSliderLongPressed = this.b;
customDeltaSliderLongPressed.e(customDeltaSliderLongPressed.d + this.c);
Sts sts2 = this.b.b;
if (sts2 == null) {
C14957gcv.a("");
} else {
sts = sts2;
}
sts.a(this.b.d);
} else {
CustomDeltaSliderLongPressed.a(this.b);
}
return C14866gag.c;
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
RVV(CustomDeltaSliderLongPressed customDeltaSliderLongPressed, int i) {
super(1);
this.b = customDeltaSliderLongPressed;
this.c = i;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes5.dex */
public static final class IeS extends AbstractC14961gcz implements InterfaceC14894gbR<Long, C14866gag> {
private CustomDeltaSliderLongPressed a;
private int d;
@Override // o.InterfaceC14894gbR
public final /* synthetic */ C14866gag invoke(Long l) {
ImageButton imageButton = this.a.ibDecreaseButton;
Sts sts = null;
if (imageButton == null) {
C14957gcv.a("");
imageButton = null;
}
if (imageButton.isPressed()) {
CustomDeltaSliderLongPressed customDeltaSliderLongPressed = this.a;
customDeltaSliderLongPressed.e(customDeltaSliderLongPressed.d - this.d);
Sts sts2 = this.a.b;
if (sts2 == null) {
C14957gcv.a("");
} else {
sts = sts2;
}
sts.a(this.a.d);
} else {
CustomDeltaSliderLongPressed.a(this.a);
}
return C14866gag.c;
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
IeS(CustomDeltaSliderLongPressed customDeltaSliderLongPressed, int i) {
super(1);
this.a = customDeltaSliderLongPressed;
this.d = i;
}
}
/* loaded from: classes5.dex */
public static final class HBt {
private HBt() {
}
public /* synthetic */ HBt(byte b) {
this();
}
}
public static /* synthetic */ void c(InterfaceC14894gbR interfaceC14894gbR, Object obj) {
C14957gcv.e(interfaceC14894gbR, "");
interfaceC14894gbR.invoke(obj);
}
public static /* synthetic */ boolean e(CustomDeltaSliderLongPressed customDeltaSliderLongPressed, int i) {
C14957gcv.e(customDeltaSliderLongPressed, "");
AbstractC13163fSk<Long> observeOn = AbstractC13163fSk.interval(50L, TimeUnit.MILLISECONDS, C13417fZt.c()).observeOn(fRR.e());
final IeS ieS = new IeS(customDeltaSliderLongPressed, i);
customDeltaSliderLongPressed.e = observeOn.subscribe(new fSQ(ieS) { // from class: o.eAY
private InterfaceC14894gbR b;
@Override // o.fSQ
public final void c(Object obj) {
CustomDeltaSliderLongPressed.c(this.b, obj);
}
{
this.b = ieS;
}
});
return false;
}
public static /* synthetic */ void d(InterfaceC14894gbR interfaceC14894gbR, Object obj) {
C14957gcv.e(interfaceC14894gbR, "");
interfaceC14894gbR.invoke(obj);
}
public static /* synthetic */ void c(CustomDeltaSliderLongPressed customDeltaSliderLongPressed, int i) {
C14957gcv.e(customDeltaSliderLongPressed, "");
customDeltaSliderLongPressed.e(customDeltaSliderLongPressed.d - i);
Sts sts = customDeltaSliderLongPressed.b;
if (sts == null) {
C14957gcv.a("");
sts = null;
}
sts.a(customDeltaSliderLongPressed.d);
}
public static /* synthetic */ void d(CustomDeltaSliderLongPressed customDeltaSliderLongPressed, int i) {
C14957gcv.e(customDeltaSliderLongPressed, "");
customDeltaSliderLongPressed.e(customDeltaSliderLongPressed.d + i);
Sts sts = customDeltaSliderLongPressed.b;
if (sts == null) {
C14957gcv.a("");
sts = null;
}
sts.a(customDeltaSliderLongPressed.d);
}
public static /* synthetic */ boolean b(CustomDeltaSliderLongPressed customDeltaSliderLongPressed, int i) {
C14957gcv.e(customDeltaSliderLongPressed, "");
AbstractC13163fSk<Long> observeOn = AbstractC13163fSk.interval(50L, TimeUnit.MILLISECONDS, C13417fZt.c()).observeOn(fRR.e());
final RVV rvv = new RVV(customDeltaSliderLongPressed, i);
customDeltaSliderLongPressed.e = observeOn.subscribe(new fSQ(rvv) { // from class: o.eBa
private InterfaceC14894gbR c;
@Override // o.fSQ
public final void c(Object obj) {
CustomDeltaSliderLongPressed.d(this.c, obj);
}
{
this.c = rvv;
}
});
return false;
}
public static final /* synthetic */ int a(CustomDeltaSliderLongPressed customDeltaSliderLongPressed, int i) {
int i2 = customDeltaSliderLongPressed.a;
if (i > i2) {
return i2;
}
int i3 = customDeltaSliderLongPressed.c;
return i < i3 ? i3 : i;
}
public final void setDelta(final int i) {
this.j = i;
ImageButton imageButton = this.ibIncreaseButton;
ImageButton imageButton2 = null;
if (imageButton == null) {
C14957gcv.a("");
imageButton = null;
}
imageButton.setOnLongClickListener(new View.OnLongClickListener(this, i) { // from class: o.eAS
private CustomDeltaSliderLongPressed b;
private int c;
@Override // android.view.View.OnLongClickListener
public final boolean onLongClick(View view) {
return CustomDeltaSliderLongPressed.b(this.b, this.c);
}
{
this.b = this;
this.c = i;
}
});
ImageButton imageButton3 = this.ibDecreaseButton;
if (imageButton3 == null) {
C14957gcv.a("");
imageButton3 = null;
}
imageButton3.setOnLongClickListener(new View.OnLongClickListener(this, i) { // from class: o.eAQ
private int a;
private CustomDeltaSliderLongPressed b;
@Override // android.view.View.OnLongClickListener
public final boolean onLongClick(View view) {
return CustomDeltaSliderLongPressed.e(this.b, this.a);
}
{
this.b = this;
this.a = i;
}
});
ImageButton imageButton4 = this.ibIncreaseButton;
if (imageButton4 == null) {
C14957gcv.a("");
imageButton4 = null;
}
imageButton4.setOnClickListener(new View.OnClickListener(this, i) { // from class: o.eAW
private CustomDeltaSliderLongPressed a;
private int c;
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
CustomDeltaSliderLongPressed.d(this.a, this.c);
}
{
this.a = this;
this.c = i;
}
});
ImageButton imageButton5 = this.ibDecreaseButton;
if (imageButton5 != null) {
imageButton2 = imageButton5;
} else {
C14957gcv.a("");
}
imageButton2.setOnClickListener(new View.OnClickListener(this, i) { // from class: o.eAZ
private CustomDeltaSliderLongPressed a;
private int e;
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
CustomDeltaSliderLongPressed.c(this.a, this.e);
}
{
this.a = this;
this.e = i;
}
});
}
public final void setTvValueLabel(TextView textView) {
C14957gcv.e(textView, "");
this.tvValueLabel = textView;
}
public final void setTvMinValueLabel(TextView textView) {
C14957gcv.e(textView, "");
this.tvMinValueLabel = textView;
}
public final void setTvMaxValueLabel(TextView textView) {
C14957gcv.e(textView, "");
this.tvMaxValueLabel = textView;
}
public final void setIbIncreaseButton(ImageButton imageButton) {
C14957gcv.e(imageButton, "");
this.ibIncreaseButton = imageButton;
}
public final void setIbDecreaseButton(ImageButton imageButton) {
C14957gcv.e(imageButton, "");
this.ibDecreaseButton = imageButton;
}
public final void setAcSbSlider(AppCompatSeekBar appCompatSeekBar) {
C14957gcv.e(appCompatSeekBar, "");
this.acSbSlider = appCompatSeekBar;
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public CustomDeltaSliderLongPressed(Context context) {
this(context, (byte) 0);
C14957gcv.e(context, "");
}
static {
new HBt((byte) 0);
}
}