package com.scb.phone.view.fragment.transferandpay; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.text.Editable; import android.text.InputFilter; import android.text.TextUtils; import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import com.google.android.material.textfield.TextInputLayout; import com.scb.phone.R; import com.scb.phone.view.custom.common.AmountEditText; import com.scb.phone.view.custom.common.CustomInputDialog; import com.scb.phone.view.custom.common.DefaultButton; import com.scb.phone.view.fragment.BaseFragment; import com.scb.phone.view.fragment.transferandpay.AddFavoriteTransferInputFragment; import o.AbstractC1237Yr; import o.C0693Mj; import o.C10083dw; import o.C10457eEr; import o.C12891fKc; import o.C6180cLO; import o.C6583cXR; import o.InterfaceC13391fZD; import o.InterfaceC9010dbe; import o.YA; import o.YF; import o.ZGL; import o.eBM; import o.iRl; import o.nMh; import o.qhK; import o.yGw; /* loaded from: classes5.dex */ public class AddFavoriteTransferInputFragment extends Hilt_AddFavoriteTransferInputFragment implements InterfaceC9010dbe.RVV { @BindView protected DefaultButton buttonAddFavorite; private double c; String d; @BindView protected EditText editAccountNumber; @BindView protected AmountEditText editAmount; @BindView protected ImageView editImageView; private String f; private Drawable h; private AbstractC1237Yr i; @BindView protected ImageView imageIcon; @BindView TextInputLayout inputLayout; private CustomInputDialog j; @InterfaceC13391fZD public C6180cLO presenter; @BindView protected TextView remainingLimit; @BindView protected TextView remainingLimitError; @BindView protected LinearLayout remainingLimitLinearLayout; @BindView protected TextView textAccountNumber; @BindView protected TextView textRemainingLimit; @BindView protected TextView textTitle; @BindView protected ViewGroup viewGroupAccountNumber; public static AddFavoriteTransferInputFragment b(AbstractC1237Yr abstractC1237Yr, String str, ZGL zgl, double d) { Bundle bundle = new Bundle(); bundle.putParcelable("com.scb.phone.EXTRA_TRANSFER_TARGET_DATA", abstractC1237Yr); bundle.putString("com.scb.phone.EXTRA_ACCOUNT_NUMBER", str); bundle.putSerializable("com.scb.phone.EXTRA_ACCOUNT_TYPE", zgl); bundle.putDouble("com.scb.phone.EXTRA_ACCOUNT_BALANCE", d); AddFavoriteTransferInputFragment addFavoriteTransferInputFragment = new AddFavoriteTransferInputFragment(); addFavoriteTransferInputFragment.setArguments(bundle); return addFavoriteTransferInputFragment; } @Override // androidx.fragment.app.Fragment public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { View inflate = layoutInflater.inflate(R.layout.2131559449, viewGroup, false); ButterKnife.c(this, inflate); this.editAmount.setOnPasteListener(new AmountEditText.HBt()); this.presenter.e((C6180cLO) this); this.h = nMh.getDrawable(getContext(), R.drawable.bankicon_place_holder); Bundle arguments = getArguments(); this.i = (AbstractC1237Yr) arguments.getParcelable("com.scb.phone.EXTRA_TRANSFER_TARGET_DATA"); this.d = arguments.getString("com.scb.phone.EXTRA_ACCOUNT_NUMBER"); AbstractC1237Yr abstractC1237Yr = this.i; this.i = abstractC1237Yr; this.buttonAddFavorite.setButtonEnabled(false); this.textTitle.setText(abstractC1237Yr.i); String str = abstractC1237Yr.b; this.textAccountNumber.setText(str); this.buttonAddFavorite.setButtonEnabled(!TextUtils.isEmpty(str)); if (abstractC1237Yr instanceof YA) { this.f = abstractC1237Yr.c; boolean z = !TextUtils.isEmpty(str); this.textAccountNumber.setVisibility(z ? 0 : 8); this.viewGroupAccountNumber.setVisibility(z ? 8 : 0); } else if (abstractC1237Yr instanceof YF) { this.f = ((YF) abstractC1237Yr).d; this.textAccountNumber.setVisibility(TextUtils.isEmpty(str) ? 8 : 0); this.viewGroupAccountNumber.setVisibility(8); this.buttonAddFavorite.setButtonEnabled(true); } Context context = getContext(); C12891fKc.azg_(context, this.h, this.imageIcon, abstractC1237Yr.e, context.getResources().getDimensionPixelOffset(R.dimen.f15222131165286), nMh.getColor(context, R.color.f3412131099849)); this.editAccountNumber.addTextChangedListener(new TextWatcher(this) { // from class: com.scb.phone.view.fragment.transferandpay.AddFavoriteTransferInputFragment.3 private AddFavoriteTransferInputFragment d; @Override // android.text.TextWatcher public final void afterTextChanged(Editable editable) { } @Override // android.text.TextWatcher public final void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } { this.d = this; } @Override // android.text.TextWatcher public final void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { AddFavoriteTransferInputFragment.b(this.d, charSequence.length() != 0); this.d.f = charSequence.toString(); } }); this.editAmount.setOnAmountChangeListener(new AmountEditText.RVV(this) { // from class: com.scb.phone.view.fragment.transferandpay.AddFavoriteTransferInputFragment.1 private AddFavoriteTransferInputFragment c; { this.c = this; } @Override // com.scb.phone.view.custom.common.AmountEditText.RVV public final void b(double d) { this.c.c = d; } @Override // com.scb.phone.view.custom.common.AmountEditText.RVV public final void a() { this.c.aN_(); } }); this.editAmount.setHandleDismissKeyboard(new AmountEditText.LWm(this) { // from class: o.fCc private AddFavoriteTransferInputFragment e; @Override // com.scb.phone.view.custom.common.AmountEditText.LWm public final void d() { this.e.aN_(); } { this.e = this; } }); C6180cLO c6180cLO = this.presenter; qhK qhk = this.i.h; if (c6180cLO.f != 0) { c6180cLO.f.v(); } c6180cLO.b.d(); yGw ygw = c6180cLO.b; ygw.d(ygw.i, new C6180cLO.Sts(c6180cLO, qhk)); return inflate; } @OnClick public void navigateBack() { C10457eEr.aqd_(this, new Intent("com.scb.phone/BROADCAST_TRANSFER_BACK_STEP")); } @OnClick public void addFavorite() { CustomInputDialog b = CustomInputDialog.b(getContext()); this.j = b; String string = getString(R.string.add_to_favorite); if (string != null) { b.mTitleTextView.setVisibility(0); b.mTitleTextView.setText(string); } this.j.mEditTextView.setHint(R.string.enter_a_nickname); this.j.mEditTextView.addTextChangedListener(new TextWatcher(this) { // from class: com.scb.phone.view.fragment.transferandpay.AddFavoriteTransferInputFragment.5 private AddFavoriteTransferInputFragment e; @Override // android.text.TextWatcher public final void afterTextChanged(Editable editable) { } @Override // android.text.TextWatcher public final void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } { this.e = this; } @Override // android.text.TextWatcher public final void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { if (((Boolean) C6583cXR.c(new Object[]{String.valueOf(this.e.j.mEditTextView.getText())}, -1032102340, 1032102340, (int) System.currentTimeMillis())).booleanValue()) { this.e.j.mErrorTextView.setVisibility(8); this.e.j.mPositiveButton.setEnabled(true); return; } CustomInputDialog customInputDialog = this.e.j; String string2 = this.e.getString(R.string.favorite_invalid_character); customInputDialog.mErrorTextView.setVisibility(0); customInputDialog.mErrorTextView.setText(string2); this.e.j.mPositiveButton.setEnabled(false); } }); this.j.mEditTextView.setFilters(new InputFilter[]{new InputFilter.LengthFilter(20)}); this.j.setCanceledOnTouchOutside(false); this.j.mEditTextView.setVisibility(0); this.j.apc_(R.string.cancel, new DialogInterface.OnClickListener() { // from class: o.fCg @Override // android.content.DialogInterface.OnClickListener public final void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }); CustomInputDialog customInputDialog = this.j; String string2 = getString(R.string.done); DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener(this) { // from class: o.fCe private AddFavoriteTransferInputFragment d; @Override // android.content.DialogInterface.OnClickListener public final void onClick(DialogInterface dialogInterface, int i) { AddFavoriteTransferInputFragment.a(this.d); } { this.d = this; } }; if (string2 != null) { customInputDialog.mPositiveButton.setText(string2); customInputDialog.mPositiveButton.setOnClickListener(new eBM(customInputDialog, onClickListener, false)); } if (!isAdded() || getContext() == null) { return; } this.j.show(); } @Override // o.InterfaceC9010dbe.RVV public final void c() { c(false); } private void c(boolean z) { this.remainingLimitLinearLayout.setVisibility(z ? 0 : 8); this.remainingLimitError.setVisibility(z ? 8 : 0); this.textRemainingLimit.setVisibility(z ? 0 : 8); this.remainingLimit.setVisibility(z ? 0 : 8); } @Override // o.InterfaceC9010dbe.RVV public final void c(String str) { c(true); this.textRemainingLimit.setText(R.string.transfer_limit); this.remainingLimit.setText(str); } @Override // o.InterfaceC9010dbe.RVV public final void d(C0693Mj c0693Mj) { CustomInputDialog customInputDialog = this.j; if (customInputDialog != null) { customInputDialog.dismiss(); } e(c0693Mj); } @Override // o.InterfaceC9010dbe.RVV public final void b() { CustomInputDialog customInputDialog = this.j; if (customInputDialog != null) { customInputDialog.dismiss(); } Intent intent = new Intent(); intent.putExtra("com.scb.phone.EXTRA_EDIT_FAVOURITE_TAG", "TRANSFER"); getActivity().setResult(-1, intent); getActivity().finish(); } @Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment public void onDestroy() { this.presenter.w_(); if (((BaseFragment) this).b != null && !((BaseFragment) this).b.isDisposed()) { ((BaseFragment) this).b.dispose(); } CustomInputDialog customInputDialog = this.j; if (customInputDialog != null) { customInputDialog.dismiss(); this.j = null; } super.onDestroy(); } public static /* synthetic */ void a(AddFavoriteTransferInputFragment addFavoriteTransferInputFragment) { String str; if (String.valueOf(addFavoriteTransferInputFragment.j.mEditTextView.getText()) != null) { if (!((Boolean) C6583cXR.c(new Object[]{String.valueOf(addFavoriteTransferInputFragment.j.mEditTextView.getText())}, -1032102340, 1032102340, (int) System.currentTimeMillis())).booleanValue()) { CustomInputDialog customInputDialog = addFavoriteTransferInputFragment.j; String string = addFavoriteTransferInputFragment.getString(R.string.favorite_invalid_character); customInputDialog.mErrorTextView.setVisibility(0); customInputDialog.mErrorTextView.setText(string); return; } C6180cLO c6180cLO = addFavoriteTransferInputFragment.presenter; AbstractC1237Yr abstractC1237Yr = addFavoriteTransferInputFragment.i; String str2 = addFavoriteTransferInputFragment.d; String str3 = addFavoriteTransferInputFragment.f; double d = addFavoriteTransferInputFragment.c; String valueOf = String.valueOf(addFavoriteTransferInputFragment.j.mEditTextView.getText()); if ("TRANSFER".equals("TRANSFER")) { C10083dw c = C10083dw.c(); c.A = "TRANSFER"; c.J = abstractC1237Yr.h.name(); c.z = str2; c.B = str3; c.G = null; c.F = null; c.D = d; c.E = valueOf; if (qhK.PROMPTPAY.equals(abstractC1237Yr.h)) { str = ((YF) abstractC1237Yr).j.name(); } else { str = ((YA) abstractC1237Yr).d; } c.H = str; if (c6180cLO.f != 0) { c6180cLO.f.y(); } c6180cLO.c.a(c); iRl irl = c6180cLO.c; irl.d(irl.i, new C6180cLO.RVV(c6180cLO, c.E)); } } } static /* synthetic */ void b(AddFavoriteTransferInputFragment addFavoriteTransferInputFragment, boolean z) { addFavoriteTransferInputFragment.buttonAddFavorite.setButtonEnabled(z); } }