package com.huawei.hms.common; import android.app.Dialog; import android.app.DialogFragment; import android.app.FragmentManager; import android.content.DialogInterface; import android.os.Bundle; import com.huawei.hms.common.internal.Preconditions; /* loaded from: classes2.dex */ public class ErrorDialogFragment extends DialogFragment { private Dialog a = null; private DialogInterface.OnCancelListener b = null; public static ErrorDialogFragment newInstance(Dialog dialog) { return newInstance(dialog, null); } @Override // android.app.DialogFragment public void show(FragmentManager fragmentManager, String str) { Preconditions.checkNotNull(fragmentManager, "FragmentManager cannot be null!"); super.show(fragmentManager, str); } public static ErrorDialogFragment newInstance(Dialog dialog, DialogInterface.OnCancelListener onCancelListener) { Preconditions.checkNotNull(dialog, "Dialog cannot be null!"); ErrorDialogFragment errorDialogFragment = new ErrorDialogFragment(); errorDialogFragment.a = dialog; dialog.setOnCancelListener(null); errorDialogFragment.a.setOnDismissListener(null); if (onCancelListener != null) { errorDialogFragment.b = onCancelListener; } return errorDialogFragment; } @Override // android.app.DialogFragment, android.content.DialogInterface.OnCancelListener public void onCancel(DialogInterface dialogInterface) { DialogInterface.OnCancelListener onCancelListener = this.b; if (onCancelListener != null) { onCancelListener.onCancel(dialogInterface); } } @Override // android.app.DialogFragment public Dialog onCreateDialog(Bundle bundle) { if (this.a == null) { setShowsDialog(false); } return this.a; } @Override // android.app.DialogFragment, android.app.Fragment public void onCreate(Bundle bundle) { super.onCreate(bundle); } }