what-the-bank/sources/com/scb/phone/view/fragment/BaseDialogFragment.java

382 lines
13 KiB
Java

package com.scb.phone.view.fragment;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentActivity;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import butterknife.BindView;
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.prelogin.PinLoginActivity;
import com.scb.phone.view.custom.common.CustomDialog;
import com.scb.phone.view.custom.common.FullScreenProgressDialog;
import com.scb.phone.view.fragment.BaseDialogFragment;
import o.C0690Mh;
import o.C0693Mj;
import o.C0916Rm;
import o.C10457eEr;
import o.C12914fKz;
import o.C12931fLi;
import o.InterfaceC6638cYp;
import o.fSJ;
import o.gjJ;
/* loaded from: classes5.dex */
public abstract class BaseDialogFragment extends DialogFragment implements InterfaceC6638cYp {
private Intent a = null;
private Dialog c;
private CustomDialog d;
private fSJ e;
@BindView
protected TextView mActionBarTitle;
@BindView
protected ViewGroup mProgress;
@BindView
protected SwipeRefreshLayout mSwipeRefreshLayout;
@BindView
protected Toolbar mToolbar;
@Override // androidx.fragment.app.Fragment
public void onDestroy() {
CustomDialog customDialog = this.d;
if (customDialog != null && customDialog.isShowing()) {
this.d.dismiss();
}
super.onDestroy();
}
@Override // o.InterfaceC6638cYp
public final void v() {
ViewGroup viewGroup = this.mProgress;
if (viewGroup != null) {
viewGroup.setVisibility(0);
} else if (getActivity() != null) {
((BaseActivity) getActivity()).v();
}
}
@Override // o.InterfaceC6638cYp
public final void aq_() {
ViewGroup viewGroup = this.mProgress;
if (viewGroup != null) {
viewGroup.setVisibility(8);
} else if (getActivity() != null) {
((BaseActivity) getActivity()).aq_();
}
}
private void a() {
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.BaseDialogFragment$3, reason: invalid class name */
/* loaded from: classes5.dex */
public static /* synthetic */ class AnonymousClass3 {
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) {
}
}
}
private void c(C0690Mh c0690Mh) {
switch (AnonymousClass3.d[c0690Mh.e.ordinal()]) {
case 1:
FragmentActivity activity = getActivity();
if (activity != null) {
activity.finish();
return;
}
return;
case 2:
getActivity().onBackPressed();
return;
case 3:
c0690Mh.d.run();
return;
case 4:
e(true);
return;
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;
default:
return;
}
}
@Override // o.InterfaceC6638cYp
public final void aN_() {
if (getActivity() == null || !isAdded()) {
return;
}
((BaseActivity) getActivity()).aN_();
}
@Override // o.InterfaceC6638cYp
public final void u() {
SwipeRefreshLayout swipeRefreshLayout = this.mSwipeRefreshLayout;
if (swipeRefreshLayout != null) {
swipeRefreshLayout.setRefreshing(false);
} else {
C10457eEr.aqc_(this, new Intent("com.scb.phone/BROADCAST_HIDE_SWIPE_REFRESH"));
}
}
@Override // o.InterfaceC6638cYp
public final void d(C0916Rm c0916Rm) {
FragmentActivity activity = getActivity();
if (activity == null || activity.isFinishing()) {
return;
}
if (this.c == null) {
FullScreenProgressDialog fullScreenProgressDialog = new FullScreenProgressDialog(activity);
fullScreenProgressDialog.title.setText(c0916Rm.b);
fullScreenProgressDialog.description.setText(c0916Rm.a);
this.c = fullScreenProgressDialog;
}
this.c.show();
}
@Override // o.InterfaceC6638cYp
public final void ar_() {
Dialog dialog = this.c;
if (dialog == null || !dialog.isShowing()) {
return;
}
this.c.dismiss();
this.c = null;
}
private void e(boolean z) {
Intent intent = new Intent(getContext(), (Class<?>) HomeActivity.class);
intent.putExtra("com.scb.phone.EXTRA_NEED_RELOAD", z);
intent.addFlags(268468224);
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()) {
a();
} else {
aqh_(intent, -1, false);
}
}
@Override // androidx.fragment.app.Fragment
public void startActivityForResult(Intent intent, int i) {
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()) {
a();
} else {
aqh_(intent, i, true);
}
}
private void aqh_(Intent intent, int i, boolean z) {
if (getActivity() instanceof BaseActivity) {
BaseActivity baseActivity = (BaseActivity) getActivity();
boolean z2 = baseActivity.X() && !baseActivity.z_();
if (C12931fLi.aAx_(intent) && !z2) {
this.a = intent;
super.startActivityForResult(new Intent(getActivity(), (Class<?>) PinLoginActivity.class), 7134);
baseActivity.ae();
} else if (z) {
super.startActivityForResult(intent, i);
} else {
super.startActivity(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) {
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 static /* synthetic */ void aqf_(BaseDialogFragment baseDialogFragment, C0690Mh c0690Mh, DialogInterface dialogInterface) {
dialogInterface.dismiss();
baseDialogFragment.dismiss();
baseDialogFragment.c(c0690Mh);
}
public static /* synthetic */ void aqg_(BaseDialogFragment baseDialogFragment, C0690Mh c0690Mh, DialogInterface dialogInterface) {
dialogInterface.dismiss();
baseDialogFragment.dismiss();
baseDialogFragment.c(c0690Mh);
}
@Override // androidx.fragment.app.Fragment
public void onActivityResult(int i, int i2, 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 (i != 7134) {
super.onActivityResult(i, i2, intent);
return;
}
if (i2 == -1 && (intent2 = this.a) != null) {
startActivity(intent2);
this.a = null;
} else if (getActivity() instanceof HomeActivity) {
e(false);
}
}
@Override // androidx.fragment.app.DialogFragment, android.content.DialogInterface.OnDismissListener
public void onDismiss(DialogInterface dialogInterface) {
if (getActivity() instanceof BaseActivity) {
((BaseActivity) getActivity()).h(false);
}
}
@Override // o.InterfaceC6638cYp
public final void e(C0693Mj c0693Mj) {
if (((getActivity() instanceof BaseActivity) && ((BaseActivity) getActivity()).f) || c0693Mj == null || getContext() == null) {
return;
}
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.eEs
private C0690Mh b;
private BaseDialogFragment c;
@Override // android.content.DialogInterface.OnClickListener
public final void onClick(DialogInterface dialogInterface, int i) {
BaseDialogFragment.aqg_(this.c, this.b, dialogInterface);
}
{
this.c = this;
this.b = c0690Mh;
}
});
}
C0690Mh c0690Mh2 = c0693Mj.b;
if (c0690Mh2 != null) {
this.d.aoO_(c0690Mh2.b, new DialogInterface.OnClickListener(this, c0690Mh) { // from class: o.eEw
private BaseDialogFragment a;
private C0690Mh b;
@Override // android.content.DialogInterface.OnClickListener
public final void onClick(DialogInterface dialogInterface, int i) {
BaseDialogFragment.aqf_(this.a, this.b, dialogInterface);
}
{
this.a = this;
this.b = c0690Mh;
}
});
}
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());
}
}