package com.scb.phone.view.fragment; import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.util.Base64; import android.view.MenuItem; import android.view.ViewGroup; import android.widget.TextView; import androidx.appcompat.widget.Toolbar; import androidx.core.widget.NestedScrollView; import androidx.fragment.app.FragmentActivity; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import butterknife.BindView; import butterknife.Unbinder; import com.huawei.hms.support.api.entity.common.CommonConstant; import com.scb.phone.AndroidApplication; import com.scb.phone.R; import com.scb.phone.view.activity.BaseActivity; import com.scb.phone.view.activity.HomeActivity; import com.scb.phone.view.activity.PreLoadCheckActivity; import com.scb.phone.view.activity.demo.ntb.NTBLandingActivity; import com.scb.phone.view.activity.prelogin.PinLoginActivity; import com.scb.phone.view.activity.splash.SplashActivity; import com.scb.phone.view.custom.common.CustomDialog; import com.scb.phone.view.custom.common.FullScreenProgressDialog; import com.scb.phone.view.fragment.BaseFragment; import com.scb.phone.view.fragment.etb.BreadcrumbFragment; import com.scb.phone.view.fragment.notification.NotificationFragment; import com.scb.phone.view.fragment.transferandpay.BaseTargetSelectedFragment; import com.scb.phone.view.fragment.transferandpay.billpaymenttab.ebilltabsfragment.EBillSelectedFragment; import io.flutter.plugin.platform.PlatformPlugin; import io.github.inflationx.calligraphy3.TypefaceUtils; import java.nio.charset.StandardCharsets; import o.C0690Mh; import o.C0693Mj; import o.C0916Rm; import o.C10457eEr; import o.C12914fKz; import o.C12931fLi; import o.C13396fZU; import o.C14957gcv; import o.EnumC8951daY; import o.InterfaceC13391fZD; import o.InterfaceC6638cYp; import o.InterfaceC9663dnz; import o.JjC; import o.fSJ; import o.gjJ; import o.guQ; import o.nMh; import o.pug; import o.pwE; /* loaded from: classes5.dex */ public abstract class BaseFragment extends Hilt_BaseFragment implements InterfaceC6638cYp, DialogInterface.OnDismissListener { private static int f = 0; private static int h = 1; private static byte i = 6; public Unbinder a; public fSJ b; private pwE c; private CustomDialog d; public Dialog e; private Intent j = null; @BindView public TextView mActionBarTitle; @BindView public ViewGroup mProgress; @BindView public SwipeRefreshLayout mSwipeRefreshLayout; @BindView public Toolbar mToolbar; @InterfaceC13391fZD public SharedPreferences sharedPreferences; @FunctionalInterface /* loaded from: classes5.dex */ public interface HBt { void c(Context context); } public void aJ_() { } private void ax(String str, Object[] objArr) { byte[] decode = Base64.decode(str, 0); byte[] bArr = new byte[decode.length]; for (int i2 = 0; i2 < decode.length; i2++) { bArr[i2] = (byte) (decode[(decode.length - i2) - 1] ^ i); } objArr[0] = new String(bArr, StandardCharsets.UTF_8); } @Override // androidx.fragment.app.Fragment public void onDestroyView() { Dialog dialog = this.e; if (dialog != null && dialog.isShowing()) { this.e.dismiss(); this.e = null; } CustomDialog customDialog = this.d; if (customDialog != null && customDialog.isShowing()) { this.d.dismiss(); this.d = null; } super.onDestroyView(); Unbinder unbinder = this.a; if (unbinder != null) { unbinder.a(); } } @Override // androidx.fragment.app.Fragment public void onDestroy() { fSJ fsj = this.b; if (fsj != null && !fsj.isDisposed()) { this.b.dispose(); } CustomDialog customDialog = this.d; if (customDialog != null && customDialog.isShowing()) { this.d.dismiss(); } super.onDestroy(); } @Override // androidx.fragment.app.Fragment public boolean onOptionsItemSelected(MenuItem menuItem) { if (getActivity() != null && menuItem.getItemId() == 16908332) { getActivity().onBackPressed(); return true; } return super.onOptionsItemSelected(menuItem); } @Override // o.InterfaceC6638cYp public void v() { ViewGroup viewGroup = this.mProgress; if (viewGroup != null) { viewGroup.setVisibility(0); } else if (getActivity() != null) { ((BaseActivity) getActivity()).v(); } } @Override // o.InterfaceC6638cYp public void aq_() { ViewGroup viewGroup = this.mProgress; if (viewGroup != null) { viewGroup.setVisibility(8); } else if (getActivity() instanceof BaseActivity) { ((BaseActivity) getActivity()).aq_(); } } public final void aAz_(Activity activity, String str, EnumC8951daY enumC8951daY) { if (getActivity() != null) { BaseActivity.a(new Object[]{(BaseActivity) getActivity(), activity, Integer.valueOf(R.id.root_view), str, enumC8951daY}, 855668825, -855668822, R.id.root_view); } } /* JADX INFO: Access modifiers changed from: protected */ public final void ah() { C0693Mj c0693Mj = new C0693Mj(); c0693Mj.d = getString(R.string.no_connection_title); c0693Mj.c = getString(R.string.no_connection_msg); C0690Mh c0690Mh = new C0690Mh(); c0690Mh.e = C0690Mh.IeS.JUST_DISMISS; c0690Mh.b = getString(R.string.ok); c0693Mj.e = c0690Mh; e(c0693Mj); } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: com.scb.phone.view.fragment.BaseFragment$2, reason: invalid class name */ /* loaded from: classes5.dex */ public static /* synthetic */ class AnonymousClass2 { static final int[] d; static { int[] iArr = new int[C0690Mh.IeS.values().length]; d = iArr; try { iArr[C0690Mh.IeS.NAVIGATE_BACK.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { d[C0690Mh.IeS.ON_BACK_PRESS.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { d[C0690Mh.IeS.CUSTOM.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } try { d[C0690Mh.IeS.LOGOUT.ordinal()] = 4; } catch (NoSuchFieldError unused4) { } try { d[C0690Mh.IeS.RESTART_APP.ordinal()] = 5; } catch (NoSuchFieldError unused5) { } try { d[C0690Mh.IeS.WIPE_CONFIG.ordinal()] = 6; } catch (NoSuchFieldError unused6) { } try { d[C0690Mh.IeS.EXIT_APP.ordinal()] = 7; } catch (NoSuchFieldError unused7) { } try { d[C0690Mh.IeS.UPDATE_APP.ordinal()] = 8; } catch (NoSuchFieldError unused8) { } } } private void e(C0690Mh c0690Mh) { switch (AnonymousClass2.d[c0690Mh.e.ordinal()]) { case 1: if (this instanceof BaseTargetSelectedFragment) { ((BaseTargetSelectedFragment) this).aT_(); return; } if (this instanceof EBillSelectedFragment) { InterfaceC9663dnz.RVV rvv = ((EBillSelectedFragment) this).c; if (rvv == null) { C14957gcv.a(""); rvv = null; } rvv.c(); return; } if ((this instanceof NotificationFragment) || (this instanceof BreadcrumbFragment)) { if (getActivity() != null) { ((BaseActivity) getActivity()).h(false); getActivity().onBackPressed(); return; } return; } FragmentActivity activity = getActivity(); if (activity != null) { activity.finish(); return; } return; case 2: getActivity().onBackPressed(); return; case 3: c0690Mh.d.run(); return; case 4: case 5: case 6: if (getActivity() instanceof PreLoadCheckActivity) { ((PreLoadCheckActivity) getActivity()).l(true); return; } return; case 7: if (getActivity() instanceof PreLoadCheckActivity) { PreLoadCheckActivity preLoadCheckActivity = (PreLoadCheckActivity) getActivity(); PreLoadCheckActivity.f(new Object[]{preLoadCheckActivity}, 1645559999, -1645559954, System.identityHashCode(preLoadCheckActivity)); return; } return; case 8: SplashActivity.b(new Object[]{requireContext()}, 1199803597, -1199803588, (int) System.currentTimeMillis()); try { c0690Mh.c = this.sharedPreferences.getString("SCB_STORE_URL", ""); startActivity(new Intent(CommonConstant.ACTION.HWID_SCHEME_URL, Uri.parse(c0690Mh.c))); return; } catch (Exception e) { guQ.e(e); return; } default: return; } } @Override // o.InterfaceC6638cYp public final void aN_() { if (getActivity() == null || !isAdded()) { return; } ((BaseActivity) getActivity()).aN_(); } @Override // o.InterfaceC6638cYp public void u() { SwipeRefreshLayout swipeRefreshLayout = this.mSwipeRefreshLayout; if (swipeRefreshLayout != null) { swipeRefreshLayout.setRefreshing(false); } else if (getContext() != null) { C10457eEr.aqd_(this, new Intent("com.scb.phone/BROADCAST_HIDE_SWIPE_REFRESH")); } } public void aa() { if (getActivity() instanceof BaseActivity) { BaseActivity baseActivity = (BaseActivity) getActivity(); Toolbar toolbar = this.mToolbar; if (toolbar == null) { baseActivity.Z(); return; } baseActivity.setSupportActionBar(toolbar); pwE supportActionBar = baseActivity.getSupportActionBar(); this.c = supportActionBar; if (supportActionBar != null) { supportActionBar.d(""); this.c.d(false); } TextView textView = this.mActionBarTitle; if (textView != null) { textView.setTextSize(2, getResources().getDimensionPixelSize(R.dimen.f15032131165267) / getResources().getDisplayMetrics().density); this.mActionBarTitle.setTypeface(TypefaceUtils.load(getActivity().getAssets(), "fonts/db_heavent_medium.ttf")); } Drawable mutate = nMh.getDrawable(baseActivity, R.drawable.ic_arrow_back_white_24dp).mutate(); TextView textView2 = this.mActionBarTitle; if (textView2 != null) { mutate.setColorFilter(textView2.getCurrentTextColor(), PorterDuff.Mode.SRC_ATOP); this.c.dO_(mutate); } } } public void u(String str) { TextView textView = this.mActionBarTitle; if (textView != null) { textView.setText(str); return; } if (getActivity() != null) { BaseActivity baseActivity = (BaseActivity) getActivity(); TextView textView2 = baseActivity.h; if (textView2 != null) { textView2.setText(str); return; } TextView textView3 = baseActivity.mActionBarTitle; if (textView3 != null) { textView3.setText(str); } } } public final void Y() { pwE supportActionBar; pwE pwe = this.c; if (pwe != null) { pwe.d(true); } else { if (!(getActivity() instanceof BaseActivity) || (supportActionBar = ((BaseActivity) getActivity()).getSupportActionBar()) == null) { return; } supportActionBar.d(true); } } public final void X() { pwE supportActionBar; pwE pwe = this.c; if (pwe != null) { pwe.d(false); } else { if (!(getActivity() instanceof BaseActivity) || (supportActionBar = ((BaseActivity) getActivity()).getSupportActionBar()) == null) { return; } supportActionBar.d(false); } } public final void Z() { BaseActivity baseActivity = getActivity() instanceof BaseActivity ? (BaseActivity) getActivity() : null; if (baseActivity != null) { if (this.mToolbar != null) { baseActivity.getWindow().getDecorView().setSystemUiVisibility(PlatformPlugin.DEFAULT_SYSTEM_UI); this.mToolbar.getLayoutParams().height += ((Integer) C12914fKz.e(new Object[]{getContext()}, 27586478, -27586464, (int) System.currentTimeMillis())).intValue(); this.mToolbar.setPadding(0, ((Integer) C12914fKz.e(new Object[]{getContext()}, 27586478, -27586464, (int) System.currentTimeMillis())).intValue(), 0, 0); return; } baseActivity.aa(); } } /* JADX INFO: Access modifiers changed from: protected */ public final void ab() { SwipeRefreshLayout swipeRefreshLayout = this.mSwipeRefreshLayout; if (swipeRefreshLayout != null) { swipeRefreshLayout.setColorSchemeColors(nMh.getColor(getContext(), R.color.f13682131100876)); this.mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.Sts(this) { // from class: o.eEt private BaseFragment e; @Override // androidx.swiperefreshlayout.widget.SwipeRefreshLayout.Sts public final void e() { C10457eEr.aqd_(this.e, new Intent("com.scb.phone/BROADCAST_SWIPE_REFRESH")); } { this.e = this; } }); } } @Override // o.InterfaceC6638cYp public final void d(C0916Rm c0916Rm) { FragmentActivity activity = getActivity(); if (activity == null || activity.isFinishing()) { return; } if (this.e == null) { FullScreenProgressDialog fullScreenProgressDialog = new FullScreenProgressDialog(activity); fullScreenProgressDialog.title.setText(c0916Rm.b); fullScreenProgressDialog.description.setText(c0916Rm.a); this.e = fullScreenProgressDialog; } this.e.show(); } @Override // o.InterfaceC6638cYp public final void ar_() { Dialog dialog = this.e; if (dialog == null || !dialog.isShowing()) { return; } this.e.dismiss(); this.e = null; } public String W() { if (getActivity() instanceof BaseActivity) { return ((BaseActivity) getActivity()).B_(); } return null; } public final void k(boolean z) { Intent intent = new Intent(getContext(), (Class) HomeActivity.class); intent.putExtra("com.scb.phone.EXTRA_NEED_RELOAD", z); intent.addFlags(268468224); startActivity(intent); } public void aH_() { Intent intent = new Intent(getContext(), (Class) NTBLandingActivity.class); intent.addFlags(268468224); startActivity(intent); } public final void V() { Intent intent = new Intent(getContext(), (Class) HomeActivity.class); intent.putExtra("com.scb.phone.EXTRA_NEED_RELOAD", false); intent.putExtra("com.scb.phone.EXTRA_NEW_INSTANCE_LAYOUT", R.id.account_summary_tab); intent.addFlags(603979776); intent.putExtra("com.scb.phone.EXTRA_NEW_INSTANCE_REFRESH", true); startActivity(intent); } /* JADX INFO: Access modifiers changed from: protected */ public final void U() { Intent intent = new Intent(getContext(), (Class) HomeActivity.class); intent.putExtra("com.scb.phone.EXTRA_NEW_INSTANCE_REFRESH", true); intent.putExtra("com.scb.phone.EXTRA_NEW_INSTANCE_LAYOUT", R.id.account_summary_tab); intent.addFlags(603979776); startActivity(intent); } @Override // androidx.fragment.app.Fragment public void startActivity(Intent intent) { if (!((Boolean) C12914fKz.e(new Object[]{getContext()}, -54286131, 54286144, (int) System.currentTimeMillis())).booleanValue() && ((Boolean) C12914fKz.e(new Object[]{intent, getContext()}, -1761691613, 1761691614, (int) System.currentTimeMillis())).booleanValue()) { ah(); } else { aql_(intent, -1, false); } } @Override // androidx.fragment.app.Fragment public void startActivityForResult(Intent intent, int i2) { if (!((Boolean) C12914fKz.e(new Object[]{getContext()}, -54286131, 54286144, (int) System.currentTimeMillis())).booleanValue() && ((Boolean) C12914fKz.e(new Object[]{intent, getContext()}, -1761691613, 1761691614, (int) System.currentTimeMillis())).booleanValue()) { ah(); } else { aql_(intent, i2, true); } } private void aql_(Intent intent, int i2, boolean z) { if (getActivity() instanceof BaseActivity) { BaseActivity baseActivity = (BaseActivity) getActivity(); boolean z2 = baseActivity.X() && !baseActivity.z_(); if (C12931fLi.aAx_(intent) && !z2) { this.j = intent; super.startActivityForResult((Intent) PinLoginActivity.c(new Object[]{getContext()}, -1569431463, 1569431470, (int) System.currentTimeMillis()), 7134); baseActivity.ae(); return; } else if (z) { super.startActivityForResult(intent, i2); return; } else { super.startActivity(intent); return; } } super.startActivity(intent); } public final void T() { if (getActivity() instanceof BaseActivity) { BaseActivity baseActivity = (BaseActivity) getActivity(); if (baseActivity.getApplication() instanceof AndroidApplication) { ((AndroidApplication) baseActivity.getApplication()).b(false); } } } public final void v(String str) { if (getActivity() != null) { ((BaseActivity) getActivity()).scbAnalytics.c(str); } } public final void c(String str, pug... pugVarArr) { if (getActivity() != null) { ((BaseActivity) getActivity()).scbAnalytics.e(str, pugVarArr); } } public final void g(C13396fZU c13396fZU) { if (getActivity() != null) { c13396fZU.e.c(((BaseActivity) getActivity()).scbAnalytics, c13396fZU.d); } } public String Q() { if (getArguments() == null || getArguments().getString("source") == null) { return (!(getActivity() instanceof BaseActivity) || ((BaseActivity) getActivity()).h("source", "") == null) ? "" : ((BaseActivity) getActivity()).h("source", ""); } return getArguments().getString("source"); } public final String O() { if (getArguments() == null || getArguments().getString("subtype") == null) { return (!(getActivity() instanceof BaseActivity) || ((BaseActivity) getActivity()).h("subtype", "") == null) ? "" : ((BaseActivity) getActivity()).h("subtype", ""); } return getArguments().getString("subtype"); } @Override // androidx.fragment.app.Fragment public void onSaveInstanceState(Bundle bundle) { super.onSaveInstanceState(bundle); bundle.putParcelable("OUTSTATE_POST_LOGIN_INTENT", this.j); } @Override // androidx.fragment.app.Fragment public void onActivityCreated(Bundle bundle) { super.onActivityCreated(bundle); if (bundle != null) { this.j = (Intent) bundle.getParcelable("OUTSTATE_POST_LOGIN_INTENT"); } } @Override // o.InterfaceC6638cYp public final void x() { if (getActivity() != null) { ((BaseActivity) getActivity()).x(); } } @Override // o.InterfaceC6638cYp public final void j(String str) { if (getActivity() != null) { ((BaseActivity) getActivity()).j(str); } } @Override // o.InterfaceC6638cYp public final void i(String str) { Dialog dialog = this.e; if (dialog != null && dialog.isShowing()) { this.e.dismiss(); this.e = null; } if (getActivity() != null) { BaseActivity.a(new Object[]{(BaseActivity) getActivity(), str}, 285582399, -285582397, ((Context) Class.forName("android.app.ActivityThread").getMethod("currentApplication", new Class[0]).invoke(null, null)).getApplicationContext().getPackageName().codePointAt(6) + 690529881); } } public final void ac() { int i2 = 2 % 2; int i3 = f + 89; h = i3 % 128; int i4 = i3 % 2; if (getContext() != null) { int i5 = h + 1; f = i5 % 128; if (i5 % 2 != 0) { getContext().getString(R.string.no_connection_msg).startsWith(",*,)"); throw null; } String string = getContext().getString(R.string.no_connection_msg); if (string.startsWith(",*,)")) { Object[] objArr = new Object[1]; ax(string.substring(4), objArr); string = ((String) objArr[0]).intern(); } Dialog dialog = this.e; if (dialog != null && dialog.isShowing()) { this.e.dismiss(); this.e = null; int i6 = h + 39; f = i6 % 128; int i7 = i6 % 2; } if (getActivity() != null) { BaseActivity.a(new Object[]{(BaseActivity) getActivity(), string}, 285582399, -285582397, ((Context) Class.forName("android.app.ActivityThread").getMethod("currentApplication", new Class[0]).invoke(null, null)).getApplicationContext().getPackageName().codePointAt(6) + 690529881); } } } public void aI_() { SplashActivity.b(new Object[]{getActivity()}, 1199803597, -1199803588, (int) System.currentTimeMillis()); } public static /* synthetic */ void c(BaseFragment baseFragment, NestedScrollView nestedScrollView, int i2, int i3) { if (i2 < i3 || nestedScrollView == null || nestedScrollView.getChildAt(0) == null || i2 < (nestedScrollView.getChildAt(0).getMeasuredHeight() - nestedScrollView.getMeasuredHeight()) - 250) { return; } baseFragment.aJ_(); } public static /* synthetic */ void aqi_(BaseFragment baseFragment, C0690Mh c0690Mh, DialogInterface dialogInterface) { dialogInterface.dismiss(); baseFragment.e(c0690Mh); } public static /* synthetic */ void aqj_(BaseFragment baseFragment, C0690Mh c0690Mh, DialogInterface dialogInterface) { dialogInterface.dismiss(); baseFragment.e(c0690Mh); } @Override // androidx.fragment.app.Fragment public void onActivityResult(int i2, int i3, Intent intent) { Intent intent2; if (getActivity() instanceof BaseActivity) { PreLoadCheckActivity.f(new Object[]{(BaseActivity) getActivity(), true}, -219813183, 219813183, ((Context) Class.forName("android.app.ActivityThread").getMethod("currentApplication", new Class[0]).invoke(null, null)).getApplicationContext().getApplicationInfo().targetSdkVersion + 1196153088); } if (i2 != 7134) { super.onActivityResult(i2, i3, intent); return; } if (i3 == -1 && (intent2 = this.j) != null) { startActivity(intent2); this.j = null; } else if (getActivity() instanceof HomeActivity) { if (i3 == -1) { k(false); } else { super.onActivityResult(i2, i3, intent); } } } @Override // android.content.DialogInterface.OnDismissListener public void onDismiss(DialogInterface dialogInterface) { if (getActivity() instanceof BaseActivity) { ((BaseActivity) getActivity()).h(false); } } @Override // o.InterfaceC6638cYp public void e(C0693Mj c0693Mj) { if (((getActivity() instanceof BaseActivity) && ((BaseActivity) getActivity()).f) || c0693Mj == null || getContext() == null) { return; } if (c0693Mj == null || c0693Mj.d == null || !c0693Mj.d.contains("SKIP_BASE_ERROR_DIALOG")) { CustomDialog customDialog = this.d; if (customDialog != null && customDialog.isShowing()) { this.d.dismiss(); this.d = null; } if (getActivity() instanceof BaseActivity) { ((BaseActivity) getActivity()).h(true); } CustomDialog b = CustomDialog.b(getContext()); String str = c0693Mj.d; if (gjJ.a(str)) { b.mTitleTextView.setVisibility(0); b.mTitleTextView.setText(str); } String str2 = c0693Mj.c; if (gjJ.a(str2)) { b.mTextTextView.setVisibility(0); b.mTextTextView.setText(str2); } this.d = b; b.setOnDismissListener(this); final C0690Mh c0690Mh = c0693Mj.e; if (c0690Mh != null) { this.d.aoU_(c0690Mh.b, new DialogInterface.OnClickListener(this, c0690Mh) { // from class: o.eEu private BaseFragment c; private C0690Mh e; @Override // android.content.DialogInterface.OnClickListener public final void onClick(DialogInterface dialogInterface, int i2) { BaseFragment.aqj_(this.c, this.e, dialogInterface); } { this.c = this; this.e = c0690Mh; } }); } final C0690Mh c0690Mh2 = c0693Mj.b; if (c0690Mh2 != null) { this.d.aoO_(c0690Mh2.b, new DialogInterface.OnClickListener(this, c0690Mh2) { // from class: o.eEB private BaseFragment a; private C0690Mh c; @Override // android.content.DialogInterface.OnClickListener public final void onClick(DialogInterface dialogInterface, int i2) { BaseFragment.aqi_(this.a, this.c, dialogInterface); } { this.a = this; this.c = c0690Mh2; } }); } this.d.setCancelable(false); this.d.show(); if (getActivity() instanceof BaseActivity) { ((BaseActivity) getActivity()).g(c0693Mj); } } } @Override // o.InterfaceC6638cYp public final void y() { d(new C0916Rm()); } }