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 ErrDlgFragmentForSupport extends DialogFragment { private Dialog a = null; private DialogInterface.OnCancelListener b = null; public static ErrDlgFragmentForSupport 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 ErrDlgFragmentForSupport newInstance(Dialog dialog, DialogInterface.OnCancelListener onCancelListener) { Preconditions.checkNotNull(dialog, "Dialog cannot be null!"); ErrDlgFragmentForSupport errDlgFragmentForSupport = new ErrDlgFragmentForSupport(); errDlgFragmentForSupport.a = dialog; dialog.setOnCancelListener(null); errDlgFragmentForSupport.a.setOnDismissListener(null); errDlgFragmentForSupport.b = onCancelListener; return errDlgFragmentForSupport; } @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); } }