Public Member Functions | |
boolean | isDialogVisible () |
void | updateStateFromCommand (MenuCommand cmd) |
DialogManager | withTitle (String title, boolean silent) |
DialogManager | withMessage (String message, boolean silent) |
DialogManager | withDelegate (DialogShowMode mode, Function< MenuButtonType, Boolean > delegate) |
void | showDialogWithButtons (MenuButtonType b1, MenuButtonType b2) |
void | hideDialog () |
DialogShowMode | getDialogShowMode () |
MenuButtonType | getButtonType (int btnNum) |
Protected Member Functions | |
String | toPrintableText (MenuButtonType type) |
abstract void | dialogDidChange () |
void | buttonWasPressed (MenuButtonType btn) |
Protected Attributes | |
final Object | lock = new Object() |
DialogMode | mode = DialogMode.HIDE |
String | title = "" |
String | message = "" |
MenuButtonType | button1 = MenuButtonType.NONE |
MenuButtonType | button2 = MenuButtonType.NONE |
Function< MenuButtonType, Boolean > | delegate |
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.
|
protected |
This can be overridden if needed, it will be called whenever a button is pressed.
btn | the button type |
|
abstractprotected |
this should be overridden to update the UI, it signifies that the dialog has changed
Reimplemented in com.thecoderscorner.menu.mgr.EmptyDialogManager.
MenuButtonType com.thecoderscorner.menu.mgr.DialogManager.getButtonType | ( | int | btnNum | ) |
the button type for a given button number - 0 or 1
btnNum | the button number |
DialogShowMode com.thecoderscorner.menu.mgr.DialogManager.getDialogShowMode | ( | ) |
void com.thecoderscorner.menu.mgr.DialogManager.hideDialog | ( | ) |
Remove the dialog from display
boolean com.thecoderscorner.menu.mgr.DialogManager.isDialogVisible | ( | ) |
void com.thecoderscorner.menu.mgr.DialogManager.showDialogWithButtons | ( | MenuButtonType | b1, |
MenuButtonType | b2 | ||
) |
Actually shows the dialog with the buttons provided
b1 | one of the button types |
b2 | one of the button types |
void com.thecoderscorner.menu.mgr.DialogManager.updateStateFromCommand | ( | MenuCommand | cmd | ) |
Update 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.
cmd | the command |
DialogManager com.thecoderscorner.menu.mgr.DialogManager.withDelegate | ( | DialogShowMode | mode, |
Function< MenuButtonType, Boolean > | delegate | ||
) |
Using builder syntax you can show dialog using the with commands this sets the delegate and mode
mode | the mode in which the dialog should show, regular, or locally |
delegate | the delegate to call on a button being pressed |
DialogManager com.thecoderscorner.menu.mgr.DialogManager.withMessage | ( | String | message, |
boolean | silent | ||
) |
Using builder syntax you can show dialog using the with commands this sets the message
message | the message field |
silent | if an update should be triggered |
DialogManager com.thecoderscorner.menu.mgr.DialogManager.withTitle | ( | String | title, |
boolean | silent | ||
) |
Using builder syntax you can show dialog using the with commands, this sets the title
title | the new title |
silent | if an update should be triggered |