java.lang.Object
com.thecoderscorner.menu.mgr.DialogManager
- Direct Known Subclasses:
EmptyDialogManager
Dialog Manager provides the capability to work with dialogs, to present them, change the values of them and also
to update them from a remote command arriving. This includes being able to deal with activation from a remote.
Usually, for local or remote activities this class is extended and the dialogDidChange method is implemented to update
the UI accordingly and optionally, the buttonWasPressed method may need to be overridden.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected MenuButtonTypeprotected MenuButtonTypeprotected Function<MenuButtonType,Boolean> protected final Objectprotected Stringprotected DialogModeprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidThis can be overridden if needed, it will be called whenever a button is pressed.protected abstract voidthis should be overridden to update the UI, it signifies that the dialog has changedgetButtonType(int btnNum) the button type for a given button number - 0 or 1voidRemove the dialog from displaybooleanvoidActually shows the dialog with the buttons providedprotected StringvoidUpdate the dialog from an incoming remote command, checking first if the command is a dialog event, and then updating all the fields and calling dialogDidChange.withDelegate(DialogShowMode mode, Function<MenuButtonType, Boolean> delegate) Using builder syntax you can show dialog using the with commands this sets the delegate and modewithMessage(String message, boolean silent) Using builder syntax you can show dialog using the with commands this sets the messageUsing builder syntax you can show dialog using the with commands, this sets the title
-
Field Details
-
lock
-
mode
-
title
-
message
-
button1
-
button2
-
delegate
-
-
Constructor Details
-
DialogManager
public DialogManager()
-
-
Method Details
-
isDialogVisible
public boolean isDialogVisible()- Returns:
- true if the dialog is on display, otherwise false
-
withTitle
Using builder syntax you can show dialog using the with commands, this sets the title- Parameters:
title- the new titlesilent- if an update should be triggered- Returns:
- itself for chaining
-
withMessage
Using builder syntax you can show dialog using the with commands this sets the message- Parameters:
message- the message fieldsilent- if an update should be triggered- Returns:
- itself for chaining
-
hideDialog
public void hideDialog()Remove the dialog from display -
getDialogShowMode
- Returns:
- the mode in which the dialog is being shown
-
getButtonType
the button type for a given button number - 0 or 1- Parameters:
btnNum- the button number- Returns:
- the button type
-
dialogDidChange
protected abstract void dialogDidChange()this should be overridden to update the UI, it signifies that the dialog has changed
-