Skip to main content
Version: 8.8.x

bfgutils.bfgAlertUtils Class

Provides methods for showing common alerts. More...

Static Public Member Functions

static void fixFontSize (@NonNull final Activity activity, @NonNull final AlertDialog dialog)
 Sets the font size to a default DP value for the alert's message and buttons. More...
 
static void fixFontSize (@NonNull final Activity activity, @NonNull final androidx.appcompat.app.AlertDialog dialog)
 Sets the font size to a default DP value for the alert's message and buttons. More...
 
static void showCustomAlert (@Nullable final String title, @NonNull final String message, @Nullable final DialogInterface.OnClickListener listener)
 Shows a customizable alert dialog with an OK button. More...
 
static void showCustomAlert (@Nullable final String title, @NonNull final String message, @Nullable final DialogInterface.OnClickListener listener, @Nullable final Activity activity)
 Shows a customizable alert dialog with an OK button. More...
 
static void showGenericErrorAlert (@Nullable final String title, @Nullable final DialogInterface.OnClickListener listener)
 Shows an alert dialog with a customizable title and OK button that indicates an error has occurred. More...
 
static void showGenericErrorAlert (@Nullable final String title, @Nullable final DialogInterface.OnClickListener listener, @Nullable Activity activity)
 Shows an alert dialog with a customizable title and OK button that indicates an error has occurred. More...
 
static void showWithFixedSizeText (@NonNull final Activity activity, @NonNull final AlertDialog dialog)
 Shows the AlertDialog and sets the font size to a default DP value for the alert's message and buttons. More...
 
static void showWithFixedSizeText (@NonNull final Activity activity, @NonNull final androidx.appcompat.app.AlertDialog dialog)
 Shows the AlertDialog and sets the font size to a default DP value for the alert's message and buttons. More...
 

Detailed Description

Provides methods for showing common alerts.
Since
6.4

Member Function Documentation

◆ fixFontSize() [1/2]

static void com.bigfishgames.bfglib.bfgutils.bfgAlertUtils.fixFontSize (@NonNull final Activity activity,
@NonNull final AlertDialog dialog 
)
inlinestatic
Sets the font size to a default DP value for the alert's message and buttons. This prevents them from being scaled by the system font size set by the use in the accessibility settings. This method should be called from the UI thread.
Parameters
activityActivity hosting the dialog.
dialogAlertDialog to modify.
Since
6.8

◆ fixFontSize() [2/2]

static void com.bigfishgames.bfglib.bfgutils.bfgAlertUtils.fixFontSize (@NonNull final Activity activity,
@NonNull final androidx.appcompat.app.AlertDialog dialog 
)
inlinestatic
Sets the font size to a default DP value for the alert's message and buttons. This prevents them from being scaled by the system font size set by the use in the accessibility settings. This method should be called from the UI thread.
Parameters
activityActivity hosting the dialog.
dialogAlertDialog to modify.
Since
6.8

◆ showCustomAlert() [1/2]

static void com.bigfishgames.bfglib.bfgutils.bfgAlertUtils.showCustomAlert (@Nullable final String title,
@NonNull final String message,
@Nullable final DialogInterface.OnClickListener listener 
)
inlinestatic
Shows a customizable alert dialog with an OK button. If this method is called from a non-UI thread, it will queue the alert display on the UI thread and immediately return.
Parameters
titleOptional title. A null value will remove the title from the dialog.
messageText to display in the dialog body.
listenerOptional listener for the OK buttons onClick event.

◆ showCustomAlert() [2/2]

static void com.bigfishgames.bfglib.bfgutils.bfgAlertUtils.showCustomAlert (@Nullable final String title,
@NonNull final String message,
@Nullable final DialogInterface.OnClickListener listener,
@Nullable final Activity activity 
)
inlinestatic
Shows a customizable alert dialog with an OK button. If this method is called from a non-UI thread, it will queue the alert display on the UI thread and immediately return.
Parameters
titleOptional title. A null value will remove the title from the dialog.
messageText to display in the dialog body.
listenerOptional listener for the OK buttons onClick event.
activityOptional non-bfgActivity to display the error dialog over

◆ showGenericErrorAlert() [1/2]

static void com.bigfishgames.bfglib.bfgutils.bfgAlertUtils.showGenericErrorAlert (@Nullable final String title,
@Nullable final DialogInterface.OnClickListener listener 
)
inlinestatic
Shows an alert dialog with a customizable title and OK button that indicates an error has occurred.
Parameters
titleOptional title. A null value will remove the title from the dialog.
listenerOptional listener for the OK buttons onClick event.

◆ showGenericErrorAlert() [2/2]

static void com.bigfishgames.bfglib.bfgutils.bfgAlertUtils.showGenericErrorAlert (@Nullable final String title,
@Nullable final DialogInterface.OnClickListener listener,
@Nullable Activity activity 
)
inlinestatic
Shows an alert dialog with a customizable title and OK button that indicates an error has occurred. This version allows you to specify a non-bfgActivity to show the alert
Parameters
titleOptional title. A null value will remove the title from the dialog.
listenerOptional listener for the OK buttons onClick event.
activityOptional activity to show the dialog over (will default to the top bfgActivity)

◆ showWithFixedSizeText() [1/2]

static void com.bigfishgames.bfglib.bfgutils.bfgAlertUtils.showWithFixedSizeText (@NonNull final Activity activity,
@NonNull final AlertDialog dialog 
)
inlinestatic
Shows the AlertDialog and sets the font size to a default DP value for the alert's message and buttons. This prevents them from being scaled by the system font size set by the use in the accessibility settings. This method should be called from the UI thread.
Parameters
activityActivity hosting the dialog.
dialogAlertDialog to modify.
Since
6.8

◆ showWithFixedSizeText() [2/2]

static void com.bigfishgames.bfglib.bfgutils.bfgAlertUtils.showWithFixedSizeText (@NonNull final Activity activity,
@NonNull final androidx.appcompat.app.AlertDialog dialog 
)
inlinestatic
Shows the AlertDialog and sets the font size to a default DP value for the alert's message and buttons. This prevents them from being scaled by the system font size set by the use in the accessibility settings. This method should be called from the UI thread.
Parameters
activityActivity hosting the dialog.
dialogAlertDialog to modify.
Since
6.8