what-the-bank/sources/com/scb/phone/view/fragment/ccrredemption/ecoupon/ECouponQuantityFragment.java

721 lines
23 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.fragment.ccrredemption.ecoupon;
import android.content.Context;
import android.graphics.PorterDuff;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.scb.phone.R;
import com.scb.phone.view.activity.ccrredemption.ecoupon.ECouponCommonActivity;
import com.scb.phone.view.custom.common.AmountEditText;
import com.scb.phone.view.custom.common.CustomDeltaInput;
import java.math.BigDecimal;
import o.C0367Fb;
import o.C0463Hc;
import o.C0489Ht;
import o.C0491Hv;
import o.C14930gcM;
import o.C14957gcv;
import o.C3181asf;
import o.C3186ask;
import o.C6583cXR;
import o.InterfaceC13391fZD;
import o.InterfaceC9040dcH;
import o.ZI;
import o.nMh;
/* loaded from: classes5.dex */
public final class ECouponQuantityFragment extends Hilt_ECouponQuantityFragment implements InterfaceC9040dcH.HBt, CustomDeltaInput.HBt, CustomDeltaInput.Sts, AmountEditText.Sts, TextView.OnEditorActionListener, View.OnFocusChangeListener, CustomDeltaInput.RVV, CustomDeltaInput.LWm, View.OnClickListener {
public static final RVV c = new RVV(0);
@BindView
public AmountEditText customInputValue;
private C0367Fb d;
private C0463Hc f;
private C0491Hv g;
private C0489Ht i;
@BindView
public CustomDeltaInput inputQuantity;
private String j;
@InterfaceC13391fZD
public C3181asf presenter;
@BindView
public Button redeemButton;
@BindView
public TextView tvPoint;
@BindView
public TextView txtMaximumQuota;
@BindView
public TextView txtPointAndUnit;
/* loaded from: classes5.dex */
public static final class RVV {
private RVV() {
}
public /* synthetic */ RVV(byte b) {
this();
}
}
@Override // androidx.fragment.app.Fragment
public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
C14957gcv.e(layoutInflater, "");
return layoutInflater.inflate(R.layout.2131559582, viewGroup, false);
}
@Override // androidx.fragment.app.Fragment
public final void onViewCreated(View view, Bundle bundle) {
C14957gcv.e(view, "");
super.onViewCreated(view, bundle);
ButterKnife.c(this, view);
C3181asf c3181asf = this.presenter;
final C3181asf c3181asf2 = null;
if (c3181asf == null) {
C14957gcv.a("");
c3181asf = null;
}
c3181asf.e((C3181asf) this);
C3181asf c3181asf3 = this.presenter;
if (c3181asf3 == null) {
C14957gcv.a("");
c3181asf3 = null;
}
String str = this.j;
if (str == null) {
C14957gcv.a("");
str = null;
}
C0463Hc c0463Hc = this.f;
if (c0463Hc == null) {
C14957gcv.a("");
c0463Hc = null;
}
C0489Ht c0489Ht = this.i;
if (c0489Ht == null) {
C14957gcv.a("");
c0489Ht = null;
}
C0491Hv c0491Hv = this.g;
if (c0491Hv == null) {
C14957gcv.a("");
c0491Hv = null;
}
C14957gcv.e(str, "");
C14957gcv.e(c0463Hc, "");
C14957gcv.e(c0489Ht, "");
C14957gcv.e(c0491Hv, "");
c3181asf3.c = str;
c3181asf3.e = c0489Ht;
c3181asf3.d = c0491Hv;
c3181asf3.b = c0463Hc;
C3181asf c3181asf4 = this.presenter;
if (c3181asf4 != null) {
c3181asf2 = c3181asf4;
} else {
C14957gcv.a("");
}
ZI.IeS ieS = new ZI.IeS(c3181asf2) { // from class: o.asd
private C3181asf b;
@Override // o.ZI.IeS
public final void e(Object obj) {
C3181asf.a(this.b, (InterfaceC9040dcH.HBt) obj);
}
{
this.b = c3181asf2;
}
};
if (c3181asf2.f != 0) {
ieS.e(c3181asf2.f);
}
}
@Override // androidx.fragment.app.Fragment
public final void onCreate(Bundle bundle) {
super.onCreate(bundle);
Bundle arguments = getArguments();
if (arguments != null) {
C0367Fb c0367Fb = (C0367Fb) arguments.getParcelable("EXTRA_CREDIT_CARD_DISPLAY_KEY");
if (c0367Fb != null) {
C14957gcv.c(c0367Fb, "");
this.d = c0367Fb;
}
C0463Hc c0463Hc = (C0463Hc) arguments.getParcelable("EXTRA_PRODUCT_DISPLAY_MODEL_KEY");
if (c0463Hc != null) {
C14957gcv.c(c0463Hc, "");
this.f = c0463Hc;
}
C0489Ht c0489Ht = (C0489Ht) arguments.getParcelable("EXTRA_E_COUPON_QUOTA_LIMIT_KEY");
if (c0489Ht != null) {
C14957gcv.c(c0489Ht, "");
this.i = c0489Ht;
}
C0491Hv c0491Hv = (C0491Hv) arguments.getParcelable("EXTRA_E_COUPON_QUANTITY_KEY");
if (c0491Hv != null) {
C14957gcv.c(c0491Hv, "");
this.g = c0491Hv;
}
C0367Fb c0367Fb2 = this.d;
if (c0367Fb2 == null) {
C14957gcv.a("");
c0367Fb2 = null;
}
String str = c0367Fb2.ab;
C14957gcv.c((Object) str, "");
this.j = str;
}
}
@Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment
public final void onDestroy() {
C3181asf c3181asf = this.presenter;
if (c3181asf == null) {
C14957gcv.a("");
c3181asf = null;
}
c3181asf.w_();
super.onDestroy();
}
@Override // o.InterfaceC9040dcH.HBt
public final void aQ_() {
CustomDeltaInput customDeltaInput = this.inputQuantity;
C0491Hv c0491Hv = null;
if (customDeltaInput == null) {
C14957gcv.a("");
customDeltaInput = null;
}
customDeltaInput.setOnValueChangedListener(this);
customDeltaInput.setOnIncrementChangeListener(this);
customDeltaInput.setOnKeyboardDoneListener(this);
customDeltaInput.inputValue.setOnPasteListener(this);
customDeltaInput.inputValue.setOnEditorActionListener(this);
customDeltaInput.inputValue.setOnFocusChangeListener(this);
customDeltaInput.setOnDismissKeyboardListener(this);
customDeltaInput.setOnClickInputAmountListener(this);
C0491Hv c0491Hv2 = this.g;
if (c0491Hv2 == null) {
C14957gcv.a("");
c0491Hv2 = null;
}
customDeltaInput.setDelta(c0491Hv2.c);
C0491Hv c0491Hv3 = this.g;
if (c0491Hv3 == null) {
C14957gcv.a("");
c0491Hv3 = null;
}
customDeltaInput.setMinValue(c0491Hv3.e);
C0491Hv c0491Hv4 = this.g;
if (c0491Hv4 == null) {
C14957gcv.a("");
c0491Hv4 = null;
}
customDeltaInput.setMaxValue(c0491Hv4.a);
C0491Hv c0491Hv5 = this.g;
if (c0491Hv5 == null) {
C14957gcv.a("");
} else {
c0491Hv = c0491Hv5;
}
customDeltaInput.setActualValue(c0491Hv.d);
customDeltaInput.container.setBackgroundResource(R.color.f14042131100912);
customDeltaInput.inputValue.setCursorVisible(false);
}
@Override // o.InterfaceC9040dcH.HBt
public final void d(String str) {
C14957gcv.e(str, "");
C0489Ht c0489Ht = this.i;
TextView textView = null;
if (c0489Ht == null) {
C14957gcv.a("");
c0489Ht = null;
}
int i = c0489Ht.d;
int i2 = c0489Ht.e;
if (c0489Ht.c && i2 > i) {
TextView textView2 = this.txtMaximumQuota;
if (textView2 != null) {
textView = textView2;
} else {
C14957gcv.a("");
}
String string = getString(R.string.e_coupon_quantity_maximum_quota_limit, str);
C14957gcv.c((Object) string, "");
textView.setText(string);
return;
}
TextView textView3 = this.txtMaximumQuota;
if (textView3 != null) {
textView = textView3;
} else {
C14957gcv.a("");
}
BigDecimal valueOf = BigDecimal.valueOf(c0489Ht.e);
C14957gcv.c(valueOf, "");
String a = C6583cXR.a(valueOf);
C14957gcv.c((Object) a, "");
String string2 = getString(R.string.e_coupon_quantity_maximum_quota_no_limit, a);
C14957gcv.c((Object) string2, "");
textView.setText(string2);
}
@Override // o.InterfaceC9040dcH.HBt
public final void d(boolean z) {
Button button = this.redeemButton;
if (button == null) {
C14957gcv.a("");
button = null;
}
button.setEnabled(z);
}
@Override // o.InterfaceC9040dcH.HBt
public final void c() {
Context context = getContext();
if (context != null) {
ECouponCommonActivity.IeS ieS = ECouponCommonActivity.b;
C0367Fb c0367Fb = this.d;
C0491Hv c0491Hv = null;
if (c0367Fb == null) {
C14957gcv.a("");
c0367Fb = null;
}
C0463Hc c0463Hc = this.f;
if (c0463Hc == null) {
C14957gcv.a("");
c0463Hc = null;
}
C0489Ht c0489Ht = this.i;
if (c0489Ht == null) {
C14957gcv.a("");
c0489Ht = null;
}
C0491Hv c0491Hv2 = this.g;
if (c0491Hv2 == null) {
C14957gcv.a("");
} else {
c0491Hv = c0491Hv2;
}
context.startActivity(ECouponCommonActivity.IeS.ZJ_(context, c0367Fb, c0463Hc, c0489Ht, c0491Hv));
}
}
@Override // com.scb.phone.view.custom.common.CustomDeltaInput.HBt
public final void c(double d, boolean z) {
C3181asf c3181asf = this.presenter;
if (c3181asf == null) {
C14957gcv.a("");
c3181asf = null;
}
final C14930gcM.HBt hBt = new C14930gcM.HBt();
hBt.d = d;
if (String.valueOf((int) d).length() > 4) {
String substring = String.valueOf(d).substring(0, 4);
C14957gcv.c((Object) substring, "");
hBt.d = Double.parseDouble(substring);
ZI.IeS ieS = new ZI.IeS(hBt) { // from class: o.asg
private C14930gcM.HBt b;
@Override // o.ZI.IeS
public final void e(Object obj) {
C3181asf.d(this.b, (InterfaceC9040dcH.HBt) obj);
}
{
this.b = hBt;
}
};
if (c3181asf.f != 0) {
ieS.e(c3181asf.f);
return;
}
return;
}
c3181asf.e(hBt.d);
}
@Override // o.InterfaceC9040dcH.HBt
public final void e(double d) {
CustomDeltaInput customDeltaInput = this.inputQuantity;
C3181asf c3181asf = null;
if (customDeltaInput == null) {
C14957gcv.a("");
customDeltaInput = null;
}
customDeltaInput.setActualValueUI(d);
CustomDeltaInput customDeltaInput2 = this.inputQuantity;
if (customDeltaInput2 == null) {
C14957gcv.a("");
customDeltaInput2 = null;
}
customDeltaInput2.setActualValueOnly(d);
C3181asf c3181asf2 = this.presenter;
if (c3181asf2 != null) {
c3181asf = c3181asf2;
} else {
C14957gcv.a("");
}
c3181asf.e(d);
}
@Override // com.scb.phone.view.custom.common.CustomDeltaInput.Sts
public final void j() {
n();
}
@Override // com.scb.phone.view.custom.common.CustomDeltaInput.Sts
public final void h() {
n();
}
private final void n() {
C3181asf c3181asf = this.presenter;
CustomDeltaInput customDeltaInput = null;
if (c3181asf == null) {
C14957gcv.a("");
c3181asf = null;
}
CustomDeltaInput customDeltaInput2 = this.inputQuantity;
if (customDeltaInput2 == null) {
C14957gcv.a("");
customDeltaInput2 = null;
}
c3181asf.e(customDeltaInput2.c);
CustomDeltaInput customDeltaInput3 = this.inputQuantity;
if (customDeltaInput3 != null) {
customDeltaInput = customDeltaInput3;
} else {
C14957gcv.a("");
}
customDeltaInput.inputValue.setCursorVisible(false);
}
@Override // com.scb.phone.view.custom.common.AmountEditText.Sts
public final boolean c(AmountEditText amountEditText, String str) {
C14957gcv.e(amountEditText, "");
C14957gcv.e(str, "");
String h = C6583cXR.h(str);
CustomDeltaInput customDeltaInput = this.inputQuantity;
if (customDeltaInput == null) {
C14957gcv.a("");
customDeltaInput = null;
}
Double c2 = C6583cXR.c(h);
C14957gcv.c(c2, "");
customDeltaInput.setActualValue(c2.doubleValue());
n();
return true;
}
@Override // android.widget.TextView.OnEditorActionListener
public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if (i != 6) {
return false;
}
C3181asf c3181asf = this.presenter;
if (c3181asf == null) {
C14957gcv.a("");
c3181asf = null;
}
C3186ask c3186ask = new C3186ask();
if (c3181asf.f == 0) {
return true;
}
c3186ask.e(c3181asf.f);
return true;
}
@Override // android.view.View.OnFocusChangeListener
public final void onFocusChange(View view, boolean z) {
if (z) {
return;
}
C3181asf c3181asf = this.presenter;
if (c3181asf == null) {
C14957gcv.a("");
c3181asf = null;
}
C3186ask c3186ask = new C3186ask();
if (c3181asf.f != 0) {
c3186ask.e(c3181asf.f);
}
}
@Override // com.scb.phone.view.custom.common.CustomDeltaInput.RVV
public final void aP_() {
C3181asf c3181asf = this.presenter;
if (c3181asf == null) {
C14957gcv.a("");
c3181asf = null;
}
C3186ask c3186ask = new C3186ask();
if (c3181asf.f != 0) {
c3186ask.e(c3181asf.f);
}
}
@Override // com.scb.phone.view.custom.common.CustomDeltaInput.LWm
public final void b() {
C3181asf c3181asf = this.presenter;
if (c3181asf == null) {
C14957gcv.a("");
c3181asf = null;
}
C3186ask c3186ask = new C3186ask();
if (c3181asf.f != 0) {
c3186ask.e(c3181asf.f);
}
}
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
CustomDeltaInput customDeltaInput = this.inputQuantity;
if (customDeltaInput == null) {
C14957gcv.a("");
customDeltaInput = null;
}
customDeltaInput.inputValue.setCursorVisible(true);
}
@Override // o.InterfaceC9040dcH.HBt
public final void c(double d) {
C0491Hv c0491Hv = this.g;
CustomDeltaInput customDeltaInput = null;
if (c0491Hv == null) {
C14957gcv.a("");
c0491Hv = null;
}
c0491Hv.a = d;
CustomDeltaInput customDeltaInput2 = this.inputQuantity;
if (customDeltaInput2 != null) {
customDeltaInput = customDeltaInput2;
} else {
C14957gcv.a("");
}
customDeltaInput.setMaxValue(d);
}
@Override // o.InterfaceC9040dcH.HBt
public final void aR_() {
CustomDeltaInput customDeltaInput = this.inputQuantity;
if (customDeltaInput == null) {
C14957gcv.a("");
customDeltaInput = null;
}
customDeltaInput.setErrorMessage(getResources().getString(R.string.e_coupon_insufficient_points));
f();
}
@Override // o.InterfaceC9040dcH.HBt
public final void g() {
CustomDeltaInput customDeltaInput = this.inputQuantity;
if (customDeltaInput == null) {
C14957gcv.a("");
customDeltaInput = null;
}
customDeltaInput.setErrorMessage(getResources().getString(R.string.e_coupon_not_enough));
f();
}
@Override // o.InterfaceC9040dcH.HBt
public final void aS_() {
CustomDeltaInput customDeltaInput = this.inputQuantity;
if (customDeltaInput == null) {
C14957gcv.a("");
customDeltaInput = null;
}
customDeltaInput.setErrorMessage(getResources().getString(R.string.e_coupon_over_quota));
f();
}
@Override // o.InterfaceC9040dcH.HBt
public final void d(int i) {
TextView textView = this.tvPoint;
if (textView == null) {
C14957gcv.a("");
textView = null;
}
BigDecimal valueOf = BigDecimal.valueOf(i);
C14957gcv.c(valueOf, "");
String a = C6583cXR.a(valueOf);
C14957gcv.c((Object) a, "");
textView.setText(a);
}
@Override // o.InterfaceC9040dcH.HBt
public final void i() {
C0463Hc c0463Hc = this.f;
TextView textView = null;
if (c0463Hc == null) {
C14957gcv.a("");
c0463Hc = null;
}
C14957gcv.c(c0463Hc.q, "");
BigDecimal valueOf = BigDecimal.valueOf(r0.intValue());
C14957gcv.c(valueOf, "");
String a = C6583cXR.a(valueOf);
C14957gcv.c((Object) a, "");
C0491Hv c0491Hv = this.g;
if (c0491Hv == null) {
C14957gcv.a("");
c0491Hv = null;
}
String a2 = C6583cXR.a(new BigDecimal(String.valueOf(c0491Hv.d)));
C14957gcv.c((Object) a2, "");
TextView textView2 = this.txtPointAndUnit;
if (textView2 != null) {
textView = textView2;
} else {
C14957gcv.a("");
}
String string = getString(R.string.e_coupon_quantity_total_points_calculate, a, a2);
C14957gcv.c((Object) string, "");
textView.setText(string);
}
@Override // o.InterfaceC9040dcH.HBt
public final void e() {
aN_();
CustomDeltaInput customDeltaInput = this.inputQuantity;
CustomDeltaInput customDeltaInput2 = null;
if (customDeltaInput == null) {
C14957gcv.a("");
customDeltaInput = null;
}
customDeltaInput.inputValue.clearFocus();
CustomDeltaInput customDeltaInput3 = this.inputQuantity;
if (customDeltaInput3 == null) {
C14957gcv.a("");
customDeltaInput3 = null;
}
customDeltaInput3.inputValue.setCursorVisible(false);
CustomDeltaInput customDeltaInput4 = this.inputQuantity;
if (customDeltaInput4 == null) {
C14957gcv.a("");
customDeltaInput4 = null;
}
if (TextUtils.isEmpty(customDeltaInput4.inputValue.toString())) {
CustomDeltaInput customDeltaInput5 = this.inputQuantity;
if (customDeltaInput5 == null) {
C14957gcv.a("");
customDeltaInput5 = null;
}
customDeltaInput5.setActualValue(0.0d);
}
CustomDeltaInput customDeltaInput6 = this.inputQuantity;
if (customDeltaInput6 == null) {
C14957gcv.a("");
customDeltaInput6 = null;
}
CustomDeltaInput customDeltaInput7 = this.inputQuantity;
if (customDeltaInput7 == null) {
C14957gcv.a("");
customDeltaInput7 = null;
}
customDeltaInput6.setActualValueOnly(customDeltaInput7.c);
CustomDeltaInput customDeltaInput8 = this.inputQuantity;
if (customDeltaInput8 == null) {
C14957gcv.a("");
customDeltaInput8 = null;
}
CustomDeltaInput customDeltaInput9 = this.inputQuantity;
if (customDeltaInput9 == null) {
C14957gcv.a("");
customDeltaInput9 = null;
}
customDeltaInput8.setActualValueUI(customDeltaInput9.c);
C3181asf c3181asf = this.presenter;
if (c3181asf == null) {
C14957gcv.a("");
c3181asf = null;
}
CustomDeltaInput customDeltaInput10 = this.inputQuantity;
if (customDeltaInput10 != null) {
customDeltaInput2 = customDeltaInput10;
} else {
C14957gcv.a("");
}
c3181asf.e(customDeltaInput2.c);
}
@Override // o.InterfaceC9040dcH.HBt
public final void a() {
v("ecoupon_quantity");
}
private final void f() {
CustomDeltaInput customDeltaInput = this.inputQuantity;
AmountEditText amountEditText = null;
if (customDeltaInput == null) {
C14957gcv.a("");
customDeltaInput = null;
}
customDeltaInput.errorMessage.setVisibility(0);
Context context = getContext();
if (context != null) {
AmountEditText amountEditText2 = this.customInputValue;
if (amountEditText2 != null) {
amountEditText = amountEditText2;
} else {
C14957gcv.a("");
}
amountEditText.getBackground().mutate().setColorFilter(nMh.getColor(context, R.color.f13582131100866), PorterDuff.Mode.SRC_ATOP);
}
}
@OnClick
public final void onNextClick() {
C3181asf c3181asf = this.presenter;
if (c3181asf == null) {
C14957gcv.a("");
c3181asf = null;
}
ZI.IeS ieS = new ZI.IeS() { // from class: o.asi
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC9040dcH.HBt) obj).c();
}
};
if (c3181asf.f != 0) {
ieS.e(c3181asf.f);
}
}
@Override // o.InterfaceC9040dcH.HBt
public final void d() {
CustomDeltaInput customDeltaInput = this.inputQuantity;
AmountEditText amountEditText = null;
if (customDeltaInput == null) {
C14957gcv.a("");
customDeltaInput = null;
}
customDeltaInput.errorMessage.setVisibility(8);
if (getContext() != null) {
AmountEditText amountEditText2 = this.customInputValue;
if (amountEditText2 != null) {
amountEditText = amountEditText2;
} else {
C14957gcv.a("");
}
amountEditText.getBackground().mutate().clearColorFilter();
}
}
}