package com.scb.phone.view.fragment.transferandpay; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.text.Editable; import android.text.InputFilter; import android.text.SpannableString; import android.text.Spanned; import android.text.SpannedString; import android.text.TextUtils; import android.text.TextWatcher; import android.util.Base64; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import com.scb.phone.R; import com.scb.phone.view.adapter.transferandpay.EditFavouriteAdapter; import com.scb.phone.view.custom.common.CustomDialog; import com.scb.phone.view.custom.common.CustomInputDialog; import com.scb.phone.view.fragment.transferandpay.EditFavouriteFragment; import java.nio.charset.StandardCharsets; import java.util.List; import o.AbstractC1181Xh; import o.C0693Mj; import o.C10457eEr; import o.C15715hv; import o.C6583cXR; import o.InterfaceC13391fZD; import o.InterfaceC9010dbe; import o.ZI; import o.cMB; import o.eBM; import o.fHU; import o.gjJ; /* loaded from: classes5.dex */ public class EditFavouriteFragment extends Hilt_EditFavouriteFragment implements InterfaceC9010dbe.CeN, fHU { private static byte f = 6; private static int g = 0; private static int h = 1; private String c; private CustomInputDialog d; @InterfaceC13391fZD public cMB editFavouritePresenter; @BindView protected ImageView favouriteAddIcon; @BindView protected TextView favouriteEmptySuggestion; @BindView protected TextView favouriteEmptySuggestionTitle; @BindView protected TextView favouriteEmptySuggestionWithImage; @BindView View mError; @BindView protected LinearLayout mFavouriteEmpty; @BindView RecyclerView mRecyclerView; private void m(String str, Object[] objArr) { byte[] decode = Base64.decode(str, 0); byte[] bArr = new byte[decode.length]; for (int i = 0; i < decode.length; i++) { bArr[i] = (byte) (decode[(decode.length - i) - 1] ^ f); } objArr[0] = new String(bArr, StandardCharsets.UTF_8); } public static EditFavouriteFragment e(String str) { Bundle bundle = new Bundle(); EditFavouriteFragment editFavouriteFragment = new EditFavouriteFragment(); bundle.putString("com.scb.phone.EXTRA_EDIT_FAVOURITE_TAG", str); editFavouriteFragment.setArguments(bundle); return editFavouriteFragment; } /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Type inference failed for: r2v10, types: [android.text.SpannableString, android.text.Spannable] */ @Override // androidx.fragment.app.Fragment public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { int i; int i2 = 2 % 2; int i3 = h + 17; g = i3 % 128; int i4 = i3 % 2; View inflate = layoutInflater.inflate(R.layout.2131559630, viewGroup, false); ButterKnife.c(this, inflate); this.editFavouritePresenter.e((cMB) this); String string = getArguments().getString("com.scb.phone.EXTRA_EDIT_FAVOURITE_TAG"); this.c = string; TextView textView = this.favouriteEmptySuggestionTitle; if ("TRANSFER".equals(string)) { int i5 = g + 55; h = i5 % 128; if (i5 % 2 == 0) { int i6 = C15715hv.tOB.favorite_suggestion_title_transfer; throw null; } i = C15715hv.tOB.favorite_suggestion_title_transfer; } else { i = "BILLPAYMENT".equals(string) ? C15715hv.tOB.favorite_is_empty : "TOPUP".equals(string) ? C15715hv.tOB.favorite_is_empty : "REMITTANCE".equals(string) ? C15715hv.tOB.favorite_is_empty : 0; } Context context = textView.getContext(); String string2 = context.getString(i); if (string2.startsWith(",*,)")) { int i7 = g + 85; h = i7 % 128; int i8 = i7 % 2; Object[] objArr = new Object[1]; m(string2.substring(4), objArr); string2 = ((String) objArr[0]).intern(); CharSequence text = context.getText(i); if (text instanceof Spanned) { ?? spannableString = new SpannableString(string2); TextUtils.copySpansFrom((SpannedString) text, 0, string2.length(), Object.class, spannableString, 0); string2 = spannableString; } } textView.setText(string2); cMB cmb = this.editFavouritePresenter; final String str = this.c; ZI.IeS ieS = new ZI.IeS(str) { // from class: o.cMx private String d; @Override // o.ZI.IeS public final void e(Object obj) { cMB.a(this.d, (InterfaceC9010dbe.CeN) obj); } { this.d = str; } }; if (cmb.f != null) { int i9 = g + 71; h = i9 % 128; int i10 = i9 % 2; ieS.e(cmb.f); } return inflate; } @Override // androidx.fragment.app.Fragment public void onResume() { super.onResume(); this.editFavouritePresenter.e(this.c); j(); } @Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment public void onDestroy() { this.editFavouritePresenter.w_(); super.onDestroy(); } @Override // o.InterfaceC9010dbe.Heg public final void d(List list) { getContext(); this.mRecyclerView.setLayoutManager(new LinearLayoutManager(1, false)); this.mRecyclerView.setAdapter(new EditFavouriteAdapter(getContext(), this, list)); this.mRecyclerView.setVisibility(0); this.mFavouriteEmpty.setVisibility(8); } @Override // o.InterfaceC9010dbe.Heg public final void e() { this.mRecyclerView.setVisibility(8); this.mError.setVisibility(0); } @Override // o.InterfaceC9010dbe.Heg public final void a() { this.mRecyclerView.setVisibility(8); this.mFavouriteEmpty.setVisibility(0); } @OnClick public void onErrorViewClicked() { this.mError.setVisibility(8); this.editFavouritePresenter.e(this.c); } @Override // o.fHU public final void c(final int i, String str) { CustomInputDialog b = CustomInputDialog.b(getContext()); this.d = b; b.mEditTextView.setFilters(new InputFilter[]{new InputFilter.LengthFilter(20)}); this.d.mEditTextView.addTextChangedListener(new TextWatcher(this) { // from class: com.scb.phone.view.fragment.transferandpay.EditFavouriteFragment.3 private EditFavouriteFragment d; @Override // android.text.TextWatcher public final void beforeTextChanged(CharSequence charSequence, int i2, int i3, int i4) { } @Override // android.text.TextWatcher public final void onTextChanged(CharSequence charSequence, int i2, int i3, int i4) { } { this.d = this; } @Override // android.text.TextWatcher public final void afterTextChanged(Editable editable) { this.d.d.mErrorTextView.setVisibility(8); } }); this.d.c(); CustomInputDialog customInputDialog = this.d; String string = getString(R.string.edit_favourite_name); if (string != null) { customInputDialog.mTitleTextView.setVisibility(0); customInputDialog.mTitleTextView.setText(string); } this.d.setCanceledOnTouchOutside(false); this.d.c(str); this.d.apc_(R.string.cancel, new DialogInterface.OnClickListener() { // from class: o.fDm @Override // android.content.DialogInterface.OnClickListener public final void onClick(DialogInterface dialogInterface, int i2) { dialogInterface.dismiss(); } }); CustomInputDialog customInputDialog2 = this.d; String string2 = getString(R.string.edit_favourite); DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener(this, i) { // from class: o.fDk private EditFavouriteFragment b; private int e; @Override // android.content.DialogInterface.OnClickListener public final void onClick(DialogInterface dialogInterface, int i2) { EditFavouriteFragment.c(this.b, this.e); } { this.b = this; this.e = i; } }; if (string2 != null) { customInputDialog2.mPositiveButton.setText(string2); customInputDialog2.mPositiveButton.setOnClickListener(new eBM(customInputDialog2, onClickListener, false)); } customInputDialog2.show(); } private void b(String str, String str2, final int i) { CustomDialog b = CustomDialog.b(getContext()); if (gjJ.a(str)) { b.mTitleTextView.setVisibility(0); b.mTitleTextView.setText(str); } if (gjJ.a(str2)) { b.mTextTextView.setVisibility(0); b.mTextTextView.setText(str2); } b.aoU_(getString(R.string.fav_del_positive), new DialogInterface.OnClickListener(this, i) { // from class: o.fDn private EditFavouriteFragment b; private int c; @Override // android.content.DialogInterface.OnClickListener public final void onClick(DialogInterface dialogInterface, int i2) { this.b.editFavouritePresenter.e(this.c); } { this.b = this; this.c = i; } }).aoO_(getString(R.string.fav_del_negative), new DialogInterface.OnClickListener() { // from class: o.fDj @Override // android.content.DialogInterface.OnClickListener public final void onClick(DialogInterface dialogInterface, int i2) { dialogInterface.dismiss(); } }).show(); } @Override // o.InterfaceC9010dbe.CeN public final void c(int i) { b(getString(R.string.confirm_delete_favorite_top_up), getString(R.string.confirm_delete_top_up_description), i); } @Override // o.InterfaceC9010dbe.CeN public final void a(int i) { b(getString(R.string.confirm_delete_favorite_transfer), getString(R.string.confirm_delete_transfer_description), i); } @Override // o.InterfaceC9010dbe.CeN public final void e(int i) { b(getString(R.string.confirm_delete_favorite_payment), getString(R.string.confirm_delete_bill_payment_description), i); } @Override // o.InterfaceC9010dbe.CeN public final void c() { CustomInputDialog customInputDialog = this.d; if (customInputDialog != null) { customInputDialog.dismiss(); this.editFavouritePresenter.e(this.c); j(); } } @Override // o.InterfaceC9010dbe.CeN public final void d() { this.mRecyclerView.setVisibility(8); this.editFavouritePresenter.e(this.c); j(); } /* JADX WARN: Code restructure failed: missing block: B:10:0x005f, code lost: if ((r11 instanceof android.text.Spanned) != false) goto L11; */ /* JADX WARN: Code restructure failed: missing block: B:6:0x0049, code lost: if ((r11 instanceof android.text.Spanned) != false) goto L11; */ /* JADX WARN: Code restructure failed: missing block: B:7:0x007a, code lost: r11 = com.scb.phone.view.fragment.transferandpay.EditFavouriteFragment.h + 63; com.scb.phone.view.fragment.transferandpay.EditFavouriteFragment.g = r11 % 128; r11 = r11 % 2; */ /* JADX WARN: Code restructure failed: missing block: B:8:0x0061, code lost: r0 = new android.text.SpannableString(r3); r11 = (android.text.SpannableString) r0; android.text.TextUtils.copySpansFrom((android.text.SpannedString) r11, 0, r3.length(), java.lang.Object.class, r0, 0); r3 = r0; */ /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Type inference failed for: r0v1, types: [android.text.SpannableString, android.text.Spannable] */ @Override // o.InterfaceC9010dbe.CeN /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final void d(int r11) { /* r10 = this; r0 = 2 int r1 = r0 % r0 android.widget.TextView r1 = r10.favouriteEmptySuggestionWithImage r2 = 8 r1.setVisibility(r2) android.widget.ImageView r1 = r10.favouriteAddIcon r1.setVisibility(r2) android.widget.TextView r1 = r10.favouriteEmptySuggestion android.content.Context r2 = r1.getContext() java.lang.String r3 = r2.getString(r11) java.lang.String r4 = ",*,)" boolean r4 = r3.startsWith(r4) if (r4 == 0) goto L83 int r4 = com.scb.phone.view.fragment.transferandpay.EditFavouriteFragment.g int r4 = r4 + 23 int r5 = r4 % 128 com.scb.phone.view.fragment.transferandpay.EditFavouriteFragment.h = r5 int r4 = r4 % r0 r5 = 1 r6 = 4 r7 = 0 java.lang.String r3 = r3.substring(r6) if (r4 != 0) goto L4c java.lang.Object[] r4 = new java.lang.Object[r5] r10.m(r3, r4) r3 = r4[r7] java.lang.String r3 = (java.lang.String) r3 java.lang.String r3 = r3.intern() java.lang.CharSequence r11 = r2.getText(r11) boolean r2 = r11 instanceof android.text.Spanned r4 = 15 int r4 = r4 / r7 if (r2 == 0) goto L7a goto L61 L4c: java.lang.Object[] r4 = new java.lang.Object[r5] r10.m(r3, r4) r3 = r4[r7] java.lang.String r3 = (java.lang.String) r3 java.lang.String r3 = r3.intern() java.lang.CharSequence r11 = r2.getText(r11) boolean r2 = r11 instanceof android.text.Spanned if (r2 == 0) goto L7a L61: android.text.SpannableString r0 = new android.text.SpannableString r0.(r3) r4 = r11 android.text.SpannedString r4 = (android.text.SpannedString) r4 r5 = 0 int r6 = r3.length() java.lang.Class r7 = java.lang.Object.class r11 = r0 android.text.SpannableString r11 = (android.text.SpannableString) r11 r9 = 0 r8 = r0 android.text.TextUtils.copySpansFrom(r4, r5, r6, r7, r8, r9) r3 = r0 goto L83 L7a: int r11 = com.scb.phone.view.fragment.transferandpay.EditFavouriteFragment.h int r11 = r11 + 63 int r2 = r11 % 128 com.scb.phone.view.fragment.transferandpay.EditFavouriteFragment.g = r2 int r11 = r11 % r0 L83: r1.setText(r3) return */ throw new UnsupportedOperationException("Method not decompiled: com.scb.phone.view.fragment.transferandpay.EditFavouriteFragment.d(int):void"); } @Override // o.InterfaceC9010dbe.CeN public final void b() { this.favouriteEmptySuggestionWithImage.setVisibility(0); this.favouriteAddIcon.setVisibility(0); this.favouriteEmptySuggestion.setText(R.string.favorite_add_suggestion_transfer_start); this.favouriteEmptySuggestionWithImage.setText(R.string.favorite_add_suggestion_transfer_end); } private void j() { Intent intent = new Intent("com.scb.phone/BROADCAST_EDIT_FAVORITE_REFRESH"); intent.putExtra("com.scb.phone.EXTRA_EDIT_FAVOURITE_TITLE", this.c); C10457eEr.aqd_(this, intent); C10457eEr.aqd_(this, new Intent("com.scb.phone/BROADCAST_ADD_TILE_TO_ROOT")); } public static /* synthetic */ void c(EditFavouriteFragment editFavouriteFragment, int i) { if (String.valueOf(editFavouriteFragment.d.mEditTextView.getText()) != null) { if (String.valueOf(editFavouriteFragment.d.mEditTextView.getText()).length() > 0) { if (((Boolean) C6583cXR.c(new Object[]{String.valueOf(editFavouriteFragment.d.mEditTextView.getText())}, -1032102340, 1032102340, (int) System.currentTimeMillis())).booleanValue()) { editFavouriteFragment.editFavouritePresenter.e(i, String.valueOf(editFavouriteFragment.d.mEditTextView.getText())); return; } CustomInputDialog customInputDialog = editFavouriteFragment.d; String string = editFavouriteFragment.getString(R.string.favorite_invalid_character); customInputDialog.mErrorTextView.setVisibility(0); customInputDialog.mErrorTextView.setText(string); return; } CustomInputDialog customInputDialog2 = editFavouriteFragment.d; String string2 = editFavouriteFragment.getString(R.string.edit_favourite_empty); customInputDialog2.mErrorTextView.setVisibility(0); customInputDialog2.mErrorTextView.setText(string2); } } @Override // o.InterfaceC9010dbe.CeN public final void a(C0693Mj c0693Mj) { String str; CustomInputDialog customInputDialog = this.d; if (customInputDialog == null) { return; } if (c0693Mj.c.length() > 0) { str = c0693Mj.c; } else { str = c0693Mj.d; } customInputDialog.mErrorTextView.setVisibility(0); customInputDialog.mErrorTextView.setText(str); } @Override // o.fHU public final void b(final int i) { cMB cmb = this.editFavouritePresenter; final String str = this.c; ZI.IeS ieS = new ZI.IeS(str, i) { // from class: o.cMy private String c; private int d; @Override // o.ZI.IeS public final void e(Object obj) { cMB.d(this.c, this.d, (InterfaceC9010dbe.CeN) obj); } { this.c = str; this.d = i; } }; if (cmb.f != 0) { ieS.e(cmb.f); } } }