what-the-bank/sources/com/scb/phone/view/fragment/chequemanagement/activatecheque/ActivateChequeInputFragment...

264 lines
9.2 KiB
Java

package com.scb.phone.view.fragment.chequemanagement.activatecheque;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.InputFilter;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
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.chequemanagement.activatecheque.ActivateChequeReviewActivity;
import com.scb.phone.view.custom.common.ScbEditText;
import com.scb.phone.view.custom.common.ScbTextInputLayout;
import com.scb.phone.view.fragment.chequemanagement.activatecheque.ActivateChequeInputFragment;
import com.scb.phone.view.fragment.transferandpay.AccountSourceSelectFragment;
import o.AbstractC13482fbE;
import o.C0531Iw;
import o.C1171Xc;
import o.C1189Xo;
import o.C16500oqI;
import o.C3445axg;
import o.InterfaceC12866fJj;
import o.InterfaceC13391fZD;
import o.InterfaceC6617cYF;
import o.NdG;
import o.WW;
import o.YE;
import o.ZI;
import o.fJJ;
import o.nMh;
/* loaded from: classes5.dex */
public class ActivateChequeInputFragment extends Hilt_ActivateChequeInputFragment implements InterfaceC6617cYF.HBt, InterfaceC12866fJj, AccountSourceSelectFragment.Sts {
@BindView
Button btnActivateChequeReview;
private String c;
@BindView
ScbEditText editText;
@InterfaceC13391fZD
public C3445axg presenter;
@BindView
LinearLayout rootErrorNoAccount;
@BindView
RelativeLayout rootView;
@BindView
ScbTextInputLayout scbTextInputLayout;
@BindView
TextView tvErrorNoAccountDetail;
@BindView
TextView tvErrorNoAccountTitle;
private String d = "";
private TextWatcher h = new fJJ(this) { // from class: com.scb.phone.view.fragment.chequemanagement.activatecheque.ActivateChequeInputFragment.1
private ActivateChequeInputFragment d;
{
this.d = this;
}
@Override // o.fJJ, android.text.TextWatcher
public final void afterTextChanged(Editable editable) {
this.d.scbTextInputLayout.setErrorEnabled(false);
this.d.d(editable.toString());
}
};
private TextView.OnEditorActionListener i = new TextView.OnEditorActionListener(this) { // from class: o.eMF
private ActivateChequeInputFragment a;
@Override // android.widget.TextView.OnEditorActionListener
public final boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
return ActivateChequeInputFragment.a(this.a, i);
}
{
this.a = this;
}
};
@Override // o.InterfaceC12866fJj
public final void a(C0531Iw c0531Iw) {
}
@Override // com.scb.phone.view.fragment.transferandpay.AccountSourceSelectFragment.Sts
public final void e_(boolean z) {
}
@Override // o.InterfaceC12866fJj
public final void t_(String str) {
}
public static ActivateChequeInputFragment a(int i) {
ActivateChequeInputFragment activateChequeInputFragment = new ActivateChequeInputFragment();
Bundle bundle = new Bundle();
bundle.putInt("EXTRA_SOURCE_SIZE", i);
activateChequeInputFragment.setArguments(bundle);
return activateChequeInputFragment;
}
@Override // androidx.fragment.app.Fragment
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
View inflate = layoutInflater.inflate(R.layout.2131559444, viewGroup, false);
ButterKnife.c(this, inflate);
this.editText.setOnEditorActionListener(this.i);
this.editText.addTextChangedListener(this.h);
this.editText.setOnFocusChangeListener(new View.OnFocusChangeListener(this) { // from class: o.eMD
private ActivateChequeInputFragment c;
@Override // android.view.View.OnFocusChangeListener
public final void onFocusChange(View view, boolean z) {
ActivateChequeInputFragment.a(this.c, z);
}
{
this.c = this;
}
});
this.editText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(8)});
this.editText.setOnPasteListener(new ScbEditText.HBt());
this.btnActivateChequeReview.setEnabled(false);
this.presenter.e((C3445axg) this);
v("activatechq_input");
return inflate;
}
@Override // androidx.fragment.app.Fragment
public void onViewCreated(View view, Bundle bundle) {
super.onViewCreated(view, bundle);
int i = getArguments() != null ? getArguments().getInt("EXTRA_SOURCE_SIZE", 0) : 0;
C3445axg c3445axg = this.presenter;
if (i > 0) {
ZI.IeS ieS = new ZI.IeS() { // from class: o.axn
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6617cYF.HBt) obj).e();
}
};
if (c3445axg.f != 0) {
ieS.e(c3445axg.f);
return;
}
return;
}
ZI.IeS ieS2 = new ZI.IeS() { // from class: o.axj
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6617cYF.HBt) obj).c();
}
};
if (c3445axg.f != 0) {
ieS2.e(c3445axg.f);
}
}
@Override // o.InterfaceC6617cYF.IeS
public final void c() {
String string = getString(R.string.error_issued_cheque_no_account);
String string2 = getString(R.string.error_issued_activate_cheque_no_account_detail);
this.tvErrorNoAccountTitle.setText(string);
this.tvErrorNoAccountDetail.setText(string2);
this.rootErrorNoAccount.setVisibility(0);
}
@Override // o.InterfaceC6617cYF.IeS
public final void e() {
C1171Xc.IeS ieS = new C1171Xc.IeS(YE.ACTIVATE_ORDER_CHEQUE_FUNCTION);
C1171Xc c1171Xc = ieS.c;
c1171Xc.a = false;
c1171Xc.b = true;
c1171Xc.j = true;
c1171Xc.g = true;
ieS.c.j = false;
ieS.c.g = false;
ieS.c.b = false;
C1171Xc c1171Xc2 = ieS.c;
AbstractC13482fbE a = getChildFragmentManager().a();
a.b(R.id.fragment_account_source_select, AccountSourceSelectFragment.b(c1171Xc2), null, 2);
a.b();
}
@OnClick
public void onReviewButtonClick() {
String obj = this.editText.getText().toString();
this.editText.setBackgroundDrawable(nMh.getDrawable(getContext(), R.drawable.shape_gray_rounded_rectangle));
C3445axg c3445axg = this.presenter;
String str = this.c;
c3445axg.d.d(new NdG(str, obj));
C16500oqI c16500oqI = c3445axg.d;
c16500oqI.d(c16500oqI.i, new C3445axg.HBt(c3445axg, str, obj));
}
@Override // o.InterfaceC6617cYF.HBt
public final void a(C1189Xo c1189Xo) {
Intent intent = new Intent(getContext(), (Class<?>) ActivateChequeReviewActivity.class);
c1189Xo.X = this.c;
intent.putExtra("com.scb.phone.EXTRA_REVIEW", c1189Xo);
startActivity(intent);
}
@Override // o.InterfaceC12866fJj
public final void bp_() {
((BaseActivity) getActivity()).aN_();
}
@Override // o.InterfaceC12866fJj
public final void f() {
((BaseActivity) getActivity()).aN_();
}
@Override // o.InterfaceC12866fJj
public final void d(String str) {
this.d = str;
this.editText.setBackgroundDrawable(nMh.getDrawable(getContext(), R.drawable.shape_gray_rounded_rectangle));
this.btnActivateChequeReview.setEnabled(str.length() == 8 && !TextUtils.isEmpty(this.c));
}
public static /* synthetic */ void a(ActivateChequeInputFragment activateChequeInputFragment, boolean z) {
if (z || activateChequeInputFragment.d.length() == 8) {
activateChequeInputFragment.editText.setBackgroundDrawable(nMh.getDrawable(activateChequeInputFragment.getContext(), R.drawable.shape_gray_rounded_rectangle));
activateChequeInputFragment.scbTextInputLayout.setErrorEnabled(false);
} else {
activateChequeInputFragment.editText.setBackgroundDrawable(nMh.getDrawable(activateChequeInputFragment.getContext(), R.drawable.shape_red_reounded_reactangle_border));
activateChequeInputFragment.scbTextInputLayout.setErrorEnabled(true);
}
}
public static /* synthetic */ boolean a(ActivateChequeInputFragment activateChequeInputFragment, int i) {
if (i == 5) {
((BaseActivity) activateChequeInputFragment.getActivity()).aN_();
activateChequeInputFragment.editText.getText();
return false;
}
if (i != 6) {
return false;
}
((BaseActivity) activateChequeInputFragment.getActivity()).aN_();
return false;
}
@Override // com.scb.phone.view.fragment.transferandpay.AccountSourceSelectFragment.Sts
public final void a(WW ww) {
if (ww != null) {
this.c = ww.s;
}
}
}