what-the-bank/sources/com/scb/phone/view/fragment/transferandpay/topuptab/TopUpBillerSelectedFragment...

558 lines
22 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.fragment.transferandpay.topuptab;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.text.InputFilter;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.LinearLayout;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.scb.phone.R;
import com.scb.phone.view.activity.BaseActivity;
import com.scb.phone.view.activity.scheduledtransaction.ScheduleLandingActivity;
import com.scb.phone.view.activity.transferandpay.topup.TopUpActivity;
import com.scb.phone.view.activity.transferandpay.topup.TopUpReviewActivity;
import com.scb.phone.view.custom.common.AmountEditText;
import com.scb.phone.view.custom.common.CustomScheduleView;
import com.scb.phone.view.fragment.transferandpay.BaseTargetSelectedFragment;
import com.scb.phone.view.fragment.transferandpay.topuptab.TopUpBillerSelectedFragment;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.List;
import o.C1168Xb;
import o.C1189Xo;
import o.C1225Yk;
import o.C1226Yl;
import o.C12525ezp;
import o.C13080fQ;
import o.C15602gz;
import o.C6583cXR;
import o.EnumC8951daY;
import o.InterfaceC12851fIz;
import o.InterfaceC13391fZD;
import o.InterfaceC9010dbe;
import o.NZv;
import o.VN;
import o.WW;
import o.XAP;
import o.ZI;
import o.cUF;
import o.cXG;
import o.fLM;
import o.gjJ;
import o.nMh;
import o.pug;
import o.tLY;
/* loaded from: classes5.dex */
public class TopUpBillerSelectedFragment extends Hilt_TopUpBillerSelectedFragment implements InterfaceC9010dbe.ufv, InterfaceC12851fIz {
@BindView
protected CustomScheduleView customScheduleView;
private double d;
@BindView
protected LinearLayout noteLayout;
/* renamed from: o, reason: collision with root package name */
private String f8082o;
private C12525ezp p;
private String q;
@BindView
protected LinearLayout scheduleLinearLayout;
private VN t;
@InterfaceC13391fZD
public cUF topUpBillerSelectedPresenter;
private boolean r = false;
private String n = "";
@Override // com.scb.phone.view.fragment.transferandpay.AccountSourceSelectFragment.Sts
public final void e_(boolean z) {
}
public static TopUpBillerSelectedFragment c(C1226Yl c1226Yl, WW ww, String str, String str2) {
Bundle bundle = new Bundle();
bundle.putParcelable("com.scb.phone.EXTRA_TOP_DISPLAY", c1226Yl);
bundle.putParcelable("com.scb.phone.EXTRA_AVAILABLE_AMOUNT", ww);
bundle.putString("source", str);
bundle.putString("subtype", str2);
TopUpBillerSelectedFragment topUpBillerSelectedFragment = new TopUpBillerSelectedFragment();
topUpBillerSelectedFragment.setArguments(bundle);
return topUpBillerSelectedFragment;
}
@Override // com.scb.phone.view.fragment.transferandpay.BaseTargetSelectedFragment, androidx.fragment.app.Fragment
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
byte b = 0;
View inflate = layoutInflater.inflate(R.layout.2131559464, viewGroup, false);
ButterKnife.c(this, inflate);
((BaseTargetSelectedFragment) this).g = "com.scb.phone/BROADCAST_TOP_UP_BACK_STEP";
this.topUpBillerSelectedPresenter.e((cUF) this);
this.h = (C1226Yl) getArguments().getParcelable("com.scb.phone.EXTRA_TOP_DISPLAY");
if (getActivity() != null && getActivity().getIntent() != null) {
this.topUpBillerSelectedPresenter.e = getActivity().getIntent().getBooleanExtra("EXTRA_BILL_PAYMENT_IS_PREDICTIVE", false);
}
final cUF cuf = this.topUpBillerSelectedPresenter;
final C1226Yl c1226Yl = this.h;
cuf.d = c1226Yl;
if (cuf.f != 0 && c1226Yl != null) {
if (!c1226Yl.b && !cuf.e) {
ZI.IeS ieS = new ZI.IeS(c1226Yl) { // from class: o.cUB
private C1226Yl b;
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC9010dbe.ufv) obj).c(this.b);
}
{
this.b = c1226Yl;
}
};
if (cuf.f != 0) {
ieS.e(cuf.f);
}
} else {
ZI.IeS ieS2 = new ZI.IeS(c1226Yl) { // from class: o.cUE
private C1226Yl e;
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC9010dbe.ufv) obj).a(this.e);
}
{
this.e = c1226Yl;
}
};
if (cuf.f != 0) {
ieS2.e(cuf.f);
}
}
if (c1226Yl.r == XAP.TYPE_RANGE) {
String valueOf = String.valueOf(c1226Yl.m);
if (cuf.f != 0) {
cuf.f.v();
}
cuf.c.a(valueOf);
tLY tly = cuf.c;
tly.d(tly.i, new cUF.RVV(cuf, b));
} else {
String valueOf2 = String.valueOf(c1226Yl.m);
if (cuf.f != 0) {
cuf.f.v();
}
cuf.c.d(valueOf2);
tLY tly2 = cuf.c;
tly2.d(tly2.i, new cUF.IeS(cuf, b));
}
ZI.IeS ieS3 = new ZI.IeS(cuf, c1226Yl) { // from class: o.cUH
private cUF a;
private C1226Yl d;
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC9010dbe.ufv) obj).e(this.a.i.n(this.d.k));
}
{
this.a = cuf;
this.d = c1226Yl;
}
};
if (cuf.f != 0) {
ieS3.e(cuf.f);
}
}
this.f8082o = Q();
this.q = O();
if ("PREPAID".equalsIgnoreCase(this.h.s)) {
c("topup_input", new pug("source", this.f8082o), new pug("subtype", "prepaid_card"));
} else {
ArrayList arrayList = new ArrayList();
arrayList.add(new pug("source", this.f8082o));
if (this.q != null) {
arrayList.add(new pug("subtype", this.q));
}
c("topup_input", (pug[]) arrayList.toArray(new pug[arrayList.size()]));
}
super.onCreateView(layoutInflater, viewGroup, bundle);
this.mAmountValue.setOnAmountChangeListener(new AmountEditText.RVV(this) { // from class: com.scb.phone.view.fragment.transferandpay.topuptab.TopUpBillerSelectedFragment.1
private TopUpBillerSelectedFragment e;
@Override // com.scb.phone.view.custom.common.AmountEditText.RVV
public final void b(double d) {
}
{
this.e = this;
}
@Override // com.scb.phone.view.custom.common.AmountEditText.RVV
public final void a() {
this.e.aN_();
}
});
WW ww = (WW) getArguments().getParcelable("com.scb.phone.EXTRA_AVAILABLE_AMOUNT");
if (ww != null && ww != null) {
((BaseTargetSelectedFragment) this).j = ww.s;
((BaseTargetSelectedFragment) this).c = ww.d;
g();
}
this.customScheduleView.setOnEditClickListener(this);
return inflate;
}
@Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment
public void onDestroy() {
if (this.l != null && !this.l.isDisposed()) {
this.l.dispose();
}
cUF cuf = this.topUpBillerSelectedPresenter;
if (cuf != null) {
cuf.w_();
}
super.onDestroy();
}
@Override // o.InterfaceC9010dbe.ufv
public final void c(C1226Yl c1226Yl) {
b(c1226Yl);
this.mReferenceTextView1.setText(c1226Yl.t);
this.mReferenceEditText1.setHint(c1226Yl.n);
this.mReferenceEditText1.setInputType(3);
this.mAmountInputLayout.setHintEnabled(false);
this.mButton.setButtonEnabled(false);
this.mButton.setText(getString(R.string.review));
if (c1226Yl.a) {
this.mCustomTransferAndPayBiller.mBackButton.setVisibility(8);
if (!TextUtils.isEmpty(c1226Yl.q)) {
this.mReferenceEditText1.setText(c1226Yl.q);
}
}
if ("PREPAID".equalsIgnoreCase(c1226Yl.s)) {
boolean z = (getActivity() instanceof TopUpActivity) && ((TopUpActivity) getActivity()).k;
if (z) {
this.mReferenceEditText1.setText(c1226Yl.j);
}
this.mAmountValue.setHint(c1226Yl.f8469o);
this.mReferenceEditText1.setEnabled(!z);
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) this.mReferenceTextView2.getLayoutParams();
((ViewGroup.MarginLayoutParams) layoutParams).topMargin = 8;
this.mReferenceTextView2.setLayoutParams(layoutParams);
this.mReferenceTextView2.setTextSize(2, 16.0f);
this.mReferenceTextView2.setTextColor(nMh.getColor(getContext(), R.color.f13582131100866));
this.mReferenceTextView2.setText(getResources().getString(R.string.prepaid_top_up_validate_input_account_no));
this.mReferenceEditText1.setFilters(new InputFilter[]{new InputFilter.LengthFilter(16)});
this.mReferenceEditText1.setOnFocusChangeListener(new View.OnFocusChangeListener(this) { // from class: o.fGI
private TopUpBillerSelectedFragment d;
@Override // android.view.View.OnFocusChangeListener
public final void onFocusChange(View view, boolean z2) {
TopUpBillerSelectedFragment.a(this.d, view, z2);
}
{
this.d = this;
}
});
}
}
@Override // o.InterfaceC9010dbe.ufv
public final void a(C1226Yl c1226Yl) {
c(c1226Yl);
this.mReferenceEditText1.setEnabled(false);
this.mReferenceEditText1.setText(c1226Yl.q);
this.mCustomTransferAndPayBiller.mBackButton.setVisibility(8);
this.n = c1226Yl.i;
}
@Override // o.InterfaceC9010dbe.ufv
public final void c(C1225Yk c1225Yk) {
d(c1225Yk);
String str = this.topUpBillerSelectedPresenter.d.h;
if (!C6583cXR.q(str)) {
this.mAmountValue.setText(str);
}
if (this.topUpBillerSelectedPresenter.d.l) {
this.mAmountInputLayout.setHintEnabled(false);
this.mAmountValue.setEnabled(C6583cXR.q(str));
}
}
@Override // o.InterfaceC9010dbe.ufv
public final void d(List<Integer> list) {
this.mRecyclerView.setVisibility(0);
this.r = true;
this.mReferenceEditText1.setImeOptions(6);
getContext();
this.mRecyclerView.setLayoutManager(new LinearLayoutManager(0, false));
this.p = new C12525ezp(list, ((BaseTargetSelectedFragment) this).c);
this.mRecyclerView.setAdapter(this.p);
g();
C1226Yl c1226Yl = this.topUpBillerSelectedPresenter.d;
if (!c1226Yl.a || TextUtils.isEmpty(c1226Yl.h)) {
return;
}
C12525ezp c12525ezp = this.p;
c12525ezp.b = c12525ezp.e.indexOf(Integer.valueOf(C6583cXR.c(c1226Yl.h).intValue()));
c12525ezp.notifyDataSetChanged();
}
@Override // o.InterfaceC9010dbe.ufv
public final void b(List<Integer> list) {
d(list);
C12525ezp c12525ezp = this.p;
c12525ezp.b = c12525ezp.e.indexOf(Integer.valueOf(C6583cXR.c(this.topUpBillerSelectedPresenter.d.h).intValue()));
c12525ezp.notifyDataSetChanged();
}
@Override // o.InterfaceC9010dbe.ufv
public final void d(C1189Xo c1189Xo, boolean z) {
c1189Xo.X = ((BaseTargetSelectedFragment) this).j;
C1189Xo a = c1189Xo.a(C6583cXR.b(((BaseTargetSelectedFragment) this).j, z));
a.S = ((BaseTargetSelectedFragment) this).j;
a.Q = C6583cXR.VS_(getContext(), R.drawable.bankicon_scb);
a.t = this.mReferenceEditText1.getText().toString();
C1168Xb.LWm lWm = new C1168Xb.LWm();
lWm.b = C6583cXR.c(NumberFormat.getCurrencyInstance()).format(this.d);
a.j = new C1168Xb(lWm, (byte) 0);
a.z = this.n;
a.aH = this.noteEditText.mNoteEditText.getText().toString();
a.at = this.t;
if ("PREPAID".equalsIgnoreCase(this.h.s) && (getActivity() instanceof TopUpActivity) && ((TopUpActivity) getActivity()).k) {
c1189Xo.F = true;
}
i(c1189Xo);
}
/* JADX INFO: Access modifiers changed from: protected */
/* JADX WARN: Multi-variable type inference failed */
@OnClick
public void onAdditionalInfoButtonClicked() {
C12525ezp c12525ezp;
int i;
cUF cuf = this.topUpBillerSelectedPresenter;
String trim = this.noteEditText.mNoteEditText.getText().toString().trim();
if (cuf.f != 0) {
if (!TextUtils.isEmpty(trim) && !((Boolean) C6583cXR.c(new Object[]{trim}, -1032102340, 1032102340, (int) System.currentTimeMillis())).booleanValue()) {
ZI.IeS ieS = new ZI.IeS() { // from class: o.cUC
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC9010dbe.ufv) obj).a();
}
};
if (cuf.f != 0) {
ieS.e(cuf.f);
return;
}
return;
}
if (this.topUpBillerSelectedPresenter.b) {
return;
}
if ((this.mAmountValue.getText() == null && ((i = (c12525ezp = this.p).b) < 0 || c12525ezp.getItemViewType(i) == 2 || c12525ezp.b == -1)) || this.mReferenceEditText1.getText() == null || ((BaseTargetSelectedFragment) this).j == null) {
return;
}
this.d = (this.r ? this.p.e() : C6583cXR.c(this.mAmountValue.getText().toString())).doubleValue();
String obj = this.mReferenceEditText1.getText().toString();
if ("PREPAID".equalsIgnoreCase(this.h.s) && (getActivity() instanceof TopUpActivity) && ((TopUpActivity) getActivity()).k) {
obj = this.h.q;
}
cUF cuf2 = this.topUpBillerSelectedPresenter;
String str = ((BaseTargetSelectedFragment) this).j;
double d = this.d;
VN vn = this.t;
String obj2 = this.noteEditText.mNoteEditText.getText().toString();
if (cuf2.f != 0) {
String trim2 = obj2.trim();
ZI.IeS ieS2 = new ZI.IeS() { // from class: o.cUD
@Override // o.ZI.IeS
public final void e(Object obj3) {
((InterfaceC9010dbe.ufv) obj3).y();
}
};
if (cuf2.f != 0) {
ieS2.e(cuf2.f);
}
cuf2.b = true;
C13080fQ c = C13080fQ.c();
c.e = str;
c.g = obj;
c.c = C15602gz.e(d);
c.a = "TOPUP";
c.b = cuf2.d.m.intValue();
c.h = vn != null ? new NZv(vn.c, cXG.a(vn.b), cXG.a(vn.d), vn.e) : null;
c.i = cuf2.d.p;
boolean b = gjJ.b((CharSequence) trim2);
V v = trim2;
if (b) {
v = 0;
}
c.d.b = v;
cuf2.c.b(c);
tLY tly = cuf2.c;
tly.d(tly.i, new cUF.LWm(cuf2, (byte) 0));
}
}
}
@Override // com.scb.phone.view.fragment.transferandpay.BaseTargetSelectedFragment
public final boolean F() {
int i;
if (!this.r) {
return super.F();
}
C12525ezp c12525ezp = this.p;
return (c12525ezp == null || (i = c12525ezp.b) < 0 || c12525ezp.getItemViewType(i) == 2 || c12525ezp.b < 0 || ((BaseTargetSelectedFragment) this).j == null || ((BaseTargetSelectedFragment) this).j.isEmpty()) ? false : true;
}
@Override // com.scb.phone.view.fragment.transferandpay.BaseTargetSelectedFragment
public final void i(C1189Xo c1189Xo) {
Intent intent = new Intent(getActivity(), (Class<?>) TopUpReviewActivity.class);
intent.putExtra("source", this.f8082o);
intent.putExtra("subtype", this.q);
if ("PREPAID".equalsIgnoreCase(this.h.s)) {
intent.putExtra("subtype", "prepaid_card");
}
intent.putExtra("com.scb.phone.EXTRA_REVIEW", c1189Xo);
startActivity(intent);
ar_();
}
@Override // o.InterfaceC9010dbe.ufv
public final void e(String str) {
this.mRemainingLimit.setVisibility(0);
this.mRemainingLimit.setText(str);
}
@Override // o.InterfaceC9010dbe.ufv
public final void a() {
this.noteEditText.d();
}
@Override // o.InterfaceC12851fIz
public final void r() {
startActivityForResult(new Intent(getActivity(), (Class<?>) ScheduleLandingActivity.class), 100);
}
@Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment
public void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
if (i == 100) {
if (i2 == -1) {
this.t = (VN) intent.getParcelableExtra("SCHEDULE_DETAIL");
if (this.noteLayout.getVisibility() == 0) {
this.noteLayout.setVisibility(8);
if (!this.noteEditText.mNoteEditText.getText().toString().isEmpty()) {
FragmentActivity activity = getActivity();
String string = getString(R.string.topup_input_010);
EnumC8951daY enumC8951daY = EnumC8951daY.ERROR;
if (getActivity() != null) {
BaseActivity.a(new Object[]{(BaseActivity) getActivity(), activity, Integer.valueOf(R.id.fragment_container_top_up), string, enumC8951daY}, 855668825, -855668822, R.id.fragment_container_top_up);
}
this.noteEditText.mNoteEditText.setText("");
}
}
this.customScheduleView.setScheduleView(this.t, true);
} else if (i2 == 1) {
this.customScheduleView.d();
this.noteLayout.setVisibility(0);
this.t = null;
}
g();
}
}
private void g() {
C12525ezp c12525ezp = this.p;
if (c12525ezp != null) {
c12525ezp.a(((BaseTargetSelectedFragment) this).c, this.scheduleLinearLayout.getVisibility() == 0);
}
}
@Override // com.scb.phone.view.fragment.BaseFragment, android.content.DialogInterface.OnDismissListener
public void onDismiss(DialogInterface dialogInterface) {
super.onDismiss(dialogInterface);
this.topUpBillerSelectedPresenter.b = false;
}
public static /* synthetic */ void a(TopUpBillerSelectedFragment topUpBillerSelectedFragment, View view, boolean z) {
if (!z) {
topUpBillerSelectedFragment.mReferenceTextView2.setVisibility(((EditText) view).getText().toString().length() < 16 ? 0 : 8);
} else {
topUpBillerSelectedFragment.mReferenceTextView2.setVisibility(8);
}
}
public static /* synthetic */ void a(TopUpBillerSelectedFragment topUpBillerSelectedFragment, String str, boolean z) {
if (z) {
topUpBillerSelectedFragment.mAmountInputLayout.setHintEnabled(false);
topUpBillerSelectedFragment.mAmountValue.setHint("");
if (topUpBillerSelectedFragment.getActivity() == null || !topUpBillerSelectedFragment.isAdded()) {
return;
}
((BaseActivity) topUpBillerSelectedFragment.getActivity()).ag();
return;
}
if (C6583cXR.q(topUpBillerSelectedFragment.mAmountValue.getText().toString())) {
topUpBillerSelectedFragment.mAmountInputLayout.setHintEnabled(true);
topUpBillerSelectedFragment.mAmountValue.setText("");
topUpBillerSelectedFragment.mAmountValue.setHint(str);
}
}
@Override // com.scb.phone.view.fragment.transferandpay.BaseTargetSelectedFragment
public final void b(WW ww) {
if (ww != null) {
((BaseTargetSelectedFragment) this).j = ww.s;
((BaseTargetSelectedFragment) this).c = ww.d;
g();
}
}
@Override // o.InterfaceC9010dbe.ufv
public final void d(C1225Yk c1225Yk) {
this.r = false;
final String str = c1225Yk.d;
this.mAmountInputLayout.setVisibility(0);
this.mDivider.setVisibility(0);
this.mAmountValue.setHint(str);
this.mAmountValue.setCustomHint(str, this.mAmountInputLayout);
this.mAmountValue.setOnFocusChangeListener(new View.OnFocusChangeListener(this, str) { // from class: o.fGM
private String a;
private TopUpBillerSelectedFragment d;
@Override // android.view.View.OnFocusChangeListener
public final void onFocusChange(View view, boolean z) {
TopUpBillerSelectedFragment.a(this.d, this.a, z);
}
{
this.d = this;
this.a = str;
}
});
C1226Yl c1226Yl = this.topUpBillerSelectedPresenter.d;
if (c1226Yl.a && !C6583cXR.q(c1226Yl.h)) {
this.mAmountValue.setText(c1226Yl.h);
}
this.mAmountValue.setCurrencyFormattingTextWatcher(new fLM(this.mAmountValue, this.mAmountInputLayout, c1225Yk.b.doubleValue(), c1225Yk.c.doubleValue(), getResources().getString(R.string.error_limit), getResources().getString(R.string.not_enough_funds_on_selected_account)));
fLM flm = this.mAmountValue.a;
if (flm != null) {
flm.a(Double.MAX_VALUE);
}
}
}