Overview
UgiUiUtil is a collection of static UI utilities for showing alert dialogs.
It is used by UgiDefaultConfigurationUi to show UI for configuration
Static Public Member Functions | |
static int | getThemeColorToUse () |
Color for the currently active UgiUiActivity. More... | |
static int | getTextColorOnThemeColorToUse () |
Color for the currently active UgiUiActivity. More... | |
static int | getButtonColorToUse () |
Color for the currently active UgiUiActivity. More... | |
static int | getButtonPressedColorToUse () |
Color for the currently active UgiUiActivity. More... | |
static int | getTextColorOnBackgroundToUse () |
Color for the currently active UgiUiActivity. More... | |
static View | traverseSubviews (View v, TraverseSubviewsCallback callback) |
Traverse all subviews of the given view. More... | |
static Activity | getParentActivity (View view) |
Get the parent activity for a view. More... | |
static int | lightenColor (int color, double degree) |
Make a color lighter. More... | |
static int | darkenColor (int color, double degree) |
Make a color darker. More... | |
static double | getColorLuminance (int color) |
Get the perceived luminance of a color. More... | |
static String | colorToString (int color) |
Get a string description of a color (mostl;y for debugging) More... | |
static int | modifyColorToBeSufficientlyDarkForText (int textColor, int backgroundColor) |
Modify a color to be sufficiently dark (or light) to appear on the given background color. More... | |
static boolean | getUseUGrokItStyleAlerts () |
Get whether U Grok It style alert dialogs are being used. More... | |
static void | setUseUGrokItStyleAlerts (boolean b) |
Set whether U Grok It style alert dialogs should be used. More... | |
static Object | showCustomAlert (Context context, String title, View view, boolean cancelable, boolean showCloseButton, Runnable closeCompletion) |
Show an alert with a custom view More... | |
static void | hideUI (Object o) |
Dismiss a UI component shown with one of the showXXX methods More... | |
static void | updateAlertTitle (Object o, String title) |
Update the title in an alert dialog More... | |
static void | updateAlert (Object o, String message) |
Update the message in an alert dialog More... | |
static Object | showOkNeutralCancel (Context context, String title, String message, String okButtonTitle, String neutralButtonTitle, String cancelButtonTitle, final Runnable completion, final Runnable neutralCompletion, final Runnable cancelCompletion) |
Show an alert dialog with ok, neutral and cancel buttons More... | |
static Object | showOkCancel (Context context, String title, String message, String okButtonTitle, String cancelButtonTitle, final Runnable completion, final Runnable cancelCompletion) |
Show an alert dialog with ok and cancel buttons More... | |
static Object | showOk (Context context, String title, String message, String okButtonTitle, final Runnable completion) |
Show an alert dialog with an ok button More... | |
static Object | showOk (Context context, String title, String message) |
Show an alert dialog with an ok button More... | |
static Object | showCancel (Context context, String title, String message, final Runnable completion) |
Show an alert dialog with a cancel button More... | |
static Object | showChoices (final Context context, final String[] choices, int initialSelectedIndex, final String title, String message, String actionButtonTitle, boolean canCancel, final ShowChoicesCompletion actionCompletion, final ShowChoicesConfirmationCompletion confirmationCompletion, final Runnable cancelCompletion) |
Show UI to choose from a list of choices More... | |
static Object | showMenu (final Context context, String title, final Runnable cancelCompletion, final MenuTitleAndHandler... items) |
Display a menu More... | |
static void | showToast (final Context context, String title, String message, double interval) |
Show a "toast" (a temporary message) More... | |
static void | showToast (final Context context, String title, String message) |
Show a "toast" (a temporary message) for the default time More... | |
static Object | showTextInput (Context context, String title, String message, String actionButtonTitle, String initialText, int inputType, String switchText, boolean switchInitialValue, final ShowTextInputCompletion actionCompletion, final Runnable cancelCompletion, final ShowTextInputShouldEnableForTextCompletion shouldEnableForTextCompletion) |
Input a text string from the user More... | |
static void | showWaiting (Context context, String message, final Runnable cancelCompletion) |
Show "waiting" alert dialog, call completion if cancelled More... | |
static void | showWaiting (Context context, String message) |
Show "waiting" alert dialog without cancel More... | |
static void | hideWaiting () |
Hide "waiting" alert dialog | |
static void | updateWaiting (String message) |
Update the message in the waiting dialog. More... | |
static boolean | isWaitingShown () |
See if the waiting alert is shown. More... | |
static void | stopInventoryWithCompletionShowWaiting (Context context, final UgiInventory.StopInventoryCompletion completion) |
Stop running inventory, showing a waiting dialog. More... | |
static void | stopInventoryWithShownAlert (final Context context, final Object alert, final Runnable completion) |
Stop running inventory, showing a waiting alert if the given alert is dismissed before inventory stops. More... | |
static void | startDisconnectedAlert (final Context context, final Runnable cancelCompletion) |
Start showing a "disconnected, please connect your grokker" dialog if appropriate. More... | |
static void | stopDisconnectedAlert () |
Stop showing disconnected dialog. More... | |
static boolean | isDisconnectedAlertActive () |
See if the disconnected alert is active. More... | |
static Object | showInventoryError (Context context, int result) |
Show an alert if there was an inventory error. More... | |
static Object | showInventoryError (Context context, int result, Runnable completion) |
Show an alert if there was an inventory error. More... | |
static String | getTagAccessErrorMessage (UgiInventory.TagAccessReturnValues result) |
Get the error message for a tag access return value. More... | |
static String | getInventoryErrorMessage (int result) |
Get the error message for an inventory result. More... | |
static String | getBarcodeScanErrorMessage () |
Get the appropriate error message if barcode scan failed. More... | |
static Object | showBarcodeError (Context context, Runnable completion) |
Show an alert with a message after barcode scan failed. More... | |
static Object | showVersionAlert (Context context, String title, final boolean showExtraInfo) |
Show an alert with version information More... | |
static String | getStringWithDeviceName (String s) |
Substitute the device name for "PD20" in a string. More... | |
Classes | |
class | MenuTitleAndHandler |
Information for a menu item. More... | |
interface | ShowChoicesCompletion |
Completion for showChoices() More... | |
interface | ShowChoicesConfirmationCompletion |
Completion for showChoices() More... | |
interface | ShowTextInputCompletion |
Completion for showTextInput() More... | |
interface | ShowTextInputShouldEnableForTextCompletion |
Completion for showTextInput() More... | |
interface | TraverseSubviewsCallback |
Callback type used by traverseSubviews. More... | |
Static Public Attributes | |
static final int | NULL_COLOR = Color.argb(0x45, 0x12, 0x23, 0x34) |
Color to use for "no color". | |
static final int | UI_COLOR = Color.rgb(0x44, 0x6b, 0xcd) |
Ugi defaults. | |
static final int | DEFAULT_THEME_COLOR = UI_COLOR |
Default color (a constant) | |
static final int | DEFAULT_TEXT_COLOR_ON_THEME_COLOR = Color.WHITE |
Default color (a constant) | |
static final int | DEFAULT_BUTTON_COLOR = UI_COLOR |
Default color (a constant) | |
static final int | DEFAULT_BUTTON_PRESSED_COLOR = Color.BLACK |
Default color (a constant) | |
static final int | DEFAULT_TEXT_COLOR_ON_BACKGROUND = Color.BLACK |
Default color (a constant) | |
static int | themeColor = DEFAULT_THEME_COLOR |
Default color for the app, defaults to DEFAULT_THEME_COLOR. | |
static int | textColorOnThemeColor = DEFAULT_TEXT_COLOR_ON_THEME_COLOR |
Default color for the app, defaults to DEFAULT_TEXT_COLOR_ON_THEME_COLOR. | |
static int | buttonColor = DEFAULT_BUTTON_COLOR |
Default color for the app, defaults to DEFAULT_BUTTON_COLOR. | |
static int | buttonPressedColor = DEFAULT_BUTTON_PRESSED_COLOR |
Default color for the app, defaults to DEFAULT_BUTTON_PRESSED_COLOR. | |
static int | textColorOnBackground = DEFAULT_TEXT_COLOR_ON_BACKGROUND |
Default color for the app, defaults to DEFAULT_TEXT_COLOR_ON_BACKGROUND. | |
static final String | DIALOG_MESSAGE_LEFT_JUSTIFY = "@left@" |
Prefix to message string to left justify. | |
static final String | DIALOG_MESSAGE_SMALLER_TEXT = "@smaller@" |
Prefix to message string to use smaller text. | |
static final int | DEFAULT_INPUT_TYPE = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT |
Default type for showTextInput() | |
Member Function Documentation
◆ getThemeColorToUse()
|
static |
Color for the currently active UgiUiActivity.
- Returns
- theme color to use for the current activity
◆ getTextColorOnThemeColorToUse()
|
static |
Color for the currently active UgiUiActivity.
- Returns
- text color on theme color to use for the current activity
◆ getButtonColorToUse()
|
static |
Color for the currently active UgiUiActivity.
- Returns
- button color to use for the current activity
◆ getButtonPressedColorToUse()
|
static |
Color for the currently active UgiUiActivity.
- Returns
- button pressed color to use for the current activity
◆ getTextColorOnBackgroundToUse()
|
static |
Color for the currently active UgiUiActivity.
- Returns
- text color to use for the current activity
◆ traverseSubviews()
|
static |
Traverse all subviews of the given view.
- Parameters
-
v View to traverse callback Callback to call
- Returns
- Return value from callback
◆ getParentActivity()
|
static |
Get the parent activity for a view.
- Parameters
-
view View to get the parent activity of
- Returns
- The activity
◆ lightenColor()
|
static |
Make a color lighter.
- Parameters
-
color Color to change degree Degree to lighten: 0 = white, 1 = no change
- Returns
- New color
◆ darkenColor()
|
static |
Make a color darker.
- Parameters
-
color Color to change degree Degree to darken: 0 = black, 1 = no change
- Returns
- New color
◆ getColorLuminance()
|
static |
Get the perceived luminance of a color.
- Parameters
-
color The color to get the luminance of
- Returns
- Luminance (between 0 and 1)
◆ colorToString()
|
static |
Get a string description of a color (mostl;y for debugging)
- Parameters
-
color The color
- Returns
- String description
◆ modifyColorToBeSufficientlyDarkForText()
|
static |
Modify a color to be sufficiently dark (or light) to appear on the given background color.
- Parameters
-
textColor text color to modify, if needed backgroundColor background color that the text will appear on
- Returns
- modified text color
◆ getUseUGrokItStyleAlerts()
|
static |
Get whether U Grok It style alert dialogs are being used.
- Returns
- true if U Grok It style alert dialogs are being used
◆ setUseUGrokItStyleAlerts()
|
static |
Set whether U Grok It style alert dialogs should be used.
- Parameters
-
b true if U Grok It style alert dialogs are being used
◆ showCustomAlert()
|
static |
Show an alert with a custom view
- Parameters
-
context Activity to show to alert dialog on title Title for the alert view Custom view cancelable true ifthe alert can be cancelled showCloseButton true to show a close button (X) closeCompletion Block to execute when the alert closes
- Returns
- The alert dialog (for updateAlert or hideUI)
◆ hideUI()
|
static |
Dismiss a UI component shown with one of the showXXX methods
- Parameters
-
o The UI dialog to dismiss
◆ updateAlertTitle()
|
static |
Update the title in an alert dialog
- Parameters
-
o The alert to update title New title for the alert dialog
◆ updateAlert()
|
static |
Update the message in an alert dialog
- Parameters
-
o The alert to update message Text for the body of the alert dialog
◆ showOkNeutralCancel()
|
static |
Show an alert dialog with ok, neutral and cancel buttons
- Parameters
-
context Activity to show to alert dialog on title Title for the alert message Text for the body of the alert okButtonTitle Text for the "ok" button, or "" for the default, or nil for no ok button neutralButtonTitle Text for the neutral button, or null for no ok button cancelButtonTitle Text for the "cancel" button, or "" for the default, or null for no cancel button completion Block to execute for "ok" neutralCompletion Block to execute for neutral cancelCompletion Block to execute for "cancel"
- Returns
- The alert dialog (for updateAlert or hideUI)
◆ showOkCancel()
|
static |
Show an alert dialog with ok and cancel buttons
- Parameters
-
context Activity to show to alert dialog on title Title for the alert message Text for the body of the alert okButtonTitle Text for the "ok" button, or "" for the default, or null for no ok button cancelButtonTitle Text for the "cancel" button, or "" for the default, or null for no cancel button completion Block to execute for "ok" cancelCompletion Block to execute for "cancel"
- Returns
- The alert dialog (for updateAlert or hideUI)
◆ showOk() [1/2]
|
static |
Show an alert dialog with an ok button
- Parameters
-
context Activity to show to alert dialog on title Title for the alert message Text for the body of the alert okButtonTitle Text for the "ok" button, or "" for the default, or null for no ok button completion Block to execute for "ok"
- Returns
- The alert dialog (for updateAlert or hideUI)
◆ showOk() [2/2]
|
static |
Show an alert dialog with an ok button
- Parameters
-
context Activity to show to alert dialog on title Title for the alert message Text for the body of the alert
- Returns
- The alert dialog (for updateAlert or hideUI)
◆ showCancel()
|
static |
Show an alert dialog with a cancel button
- Parameters
-
context Activity to show to alert dialog on title Title for the alert message Text for the body of the alert completion Block to execute for "cancel"
- Returns
- The alert dialog (for updateAlert or hideUI)
◆ showChoices()
|
static |
Show UI to choose from a list of choices
- Parameters
-
context context to show to alert dialog on choices Choices to choose from initialSelectedIndex Choice to select initially title Title for the alert message Text for the body of the alert actionButtonTitle Text for the "ok" button, or "" for the default, or null for no ok button canCancel true if the user can cancel actionCompletion Block to execute for "ok" confirmationCompletion Block to execute to confirm the choice, or null of no confirmation cancelCompletion Block to execute for "cancel"
- Returns
- The alert dialog (for updateAlert or hideUI)
◆ showMenu()
|
static |
Display a menu
- Parameters
-
context context to show to alert dialog on title Title for the alert cancelCompletion Block to execute for "cancel" items menu items
- Returns
- The alert dialog (for updateAlert or hideUI)
◆ showToast() [1/2]
|
static |
Show a "toast" (a temporary message)
- Parameters
-
context context to show to alert dialog on title Title for the toast message Text for the body of the toast interval Duration to display the toast
◆ showToast() [2/2]
|
static |
Show a "toast" (a temporary message) for the default time
- Parameters
-
context context to show to alert dialog on title Title for the toast message Text for the body of the toast
◆ showTextInput()
|
static |
Input a text string from the user
- Parameters
-
context context to show to alert dialog on title Title for the alert message Message for the alert actionButtonTitle Text for the "ok" button, or "" for the default, or null for no ok button initialText Initial text inputType Type of text input: android.text.InputType.XXX switchText Text for an on/off switch (if null then no switch) switchInitialValue Initial value for the switch actionCompletion Block to execute for "ok" cancelCompletion Block to execute for "cancel" shouldEnableForTextCompletion Code to determine whether the action button should be enabled
- Returns
- The alert dialog (for updateAlert or hideUI)
◆ showWaiting() [1/2]
|
static |
Show "waiting" alert dialog, call completion if cancelled
- Parameters
-
context context to show to alert dialog on message Text for the body of the alert dialog cancelCompletion Block to execute for "cancel" (or null if cancel is not an option)
◆ showWaiting() [2/2]
|
static |
Show "waiting" alert dialog without cancel
- Parameters
-
context context to show to alert dialog on message Text for the body of the alert dialog
◆ updateWaiting()
|
static |
Update the message in the waiting dialog.
- Parameters
-
message New message
◆ isWaitingShown()
|
static |
See if the waiting alert is shown.
- Returns
- true is waiting is shown
◆ stopInventoryWithCompletionShowWaiting()
|
static |
Stop running inventory, showing a waiting dialog.
- Parameters
-
context Context to show waiting alert on completion Completion to run after inventory stops
◆ stopInventoryWithShownAlert()
|
static |
Stop running inventory, showing a waiting alert if the given alert is dismissed before inventory stops.
- Parameters
-
context Context to show waiting alert on alert Alter being shown completion Completion to run after inventory stops and the alert is dismissed
◆ startDisconnectedAlert()
|
static |
Start showing a "disconnected, please connect your grokker" dialog if appropriate.
Normally called just after calling startInventory()
- Parameters
-
context context to show to alert dialog on cancelCompletion Completion to call if user cancels
◆ stopDisconnectedAlert()
|
static |
Stop showing disconnected dialog.
Normally called just before calling stopInventory()
◆ isDisconnectedAlertActive()
|
static |
See if the disconnected alert is active.
- Returns
- true if disconnected alert is active
◆ showInventoryError() [1/2]
|
static |
Show an alert if there was an inventory error.
- Parameters
-
context context to show to alert dialog on result Result passed to inventoryDidStop
- Returns
- The alert dialog (for updateAlert or hideUI)
◆ showInventoryError() [2/2]
|
static |
Show an alert if there was an inventory error.
- Parameters
-
context context to show to alert dialog on result Result passed to inventoryDidStop completion Code to run after the alert is dismissed
- Returns
- The alert dialog (for updateAlert or hideUI)
◆ getTagAccessErrorMessage()
|
static |
Get the error message for a tag access return value.
- Parameters
-
result Result passed to completion for readTag, lockUnlockTag, or others
- Returns
- Error message, or null if no error
◆ getInventoryErrorMessage()
|
static |
Get the error message for an inventory result.
- Parameters
-
result Result passed to inventoryDidStop
- Returns
- Error message, or null if no error
◆ getBarcodeScanErrorMessage()
|
static |
Get the appropriate error message if barcode scan failed.
- Returns
- Error message
◆ showBarcodeError()
|
static |
Show an alert with a message after barcode scan failed.
- Parameters
-
context context to show to alert dialog on completion Block to execute when the alert is completed
- Returns
- The alert dialog (for updateAlert or hideUI)
◆ showVersionAlert()
|
static |
Show an alert with version information
- Parameters
-
context Context to show to alert dialog on title Title, no nulkl to use app's name and version showExtraInfo true to show debugging info
- Returns
- The alert dialog (for updateAlert or hideUI)
◆ getStringWithDeviceName()
|
static |
Substitute the device name for "PD20" in a string.
- Parameters
-
s string
- Returns
- string with substitution
Overview
Completion for showTextInput()
Public Member Functions | |
boolean | exec (String value) |
Callback to see if the action button should be enabled. More... | |
Member Function Documentation
◆ exec()
boolean com.ugrokit.api.UgiUiUtil.ShowTextInputShouldEnableForTextCompletion.exec | ( | String | value | ) |
Callback to see if the action button should be enabled.
- Parameters
-
value text
- Returns
- true to enable
Overview
Information for a menu item.
Public Member Functions | |
MenuTitleAndHandler (String t, Runnable h) | |
Create a menu item. More... | |
Constructor & Destructor Documentation
◆ MenuTitleAndHandler()
com.ugrokit.api.UgiUiUtil.MenuTitleAndHandler.MenuTitleAndHandler | ( | String | t, |
Runnable | h | ||
) |
Create a menu item.
- Parameters
-
t Title text h Handler
Overview
Completion for showChoices()
Public Member Functions | |
void | exec (int choiceIndex, String choice) |
Completion method for showChoices() More... | |
Member Function Documentation
◆ exec()
void com.ugrokit.api.UgiUiUtil.ShowChoicesCompletion.exec | ( | int | choiceIndex, |
String | choice | ||
) |
Completion method for showChoices()
- Parameters
-
choiceIndex Index of the choice chosen choice The choice chosen
Overview
Completion for showChoices()
Public Member Functions | |
void | exec (int choiceIndex, String choice, Runnable completion) |
Completion method for showChoices() More... | |
Member Function Documentation
◆ exec()
void com.ugrokit.api.UgiUiUtil.ShowChoicesConfirmationCompletion.exec | ( | int | choiceIndex, |
String | choice, | ||
Runnable | completion | ||
) |
Completion method for showChoices()
- Parameters
-
choiceIndex Index of the choice chosen choice The choice chosen completion Code to run if confirmed
Overview
Callback type used by traverseSubviews.
Public Member Functions | |
View | exec (View v) |
Callback function for traversing a single view. More... | |
Member Function Documentation
◆ exec()
View com.ugrokit.api.UgiUiUtil.TraverseSubviewsCallback.exec | ( | View | v | ) |
Callback function for traversing a single view.
- Parameters
-
v View being traversed
- Returns
- If non-null, abort traversal and return this View
Overview
Completion for showTextInput()
Public Member Functions | |
void | exec (String value, boolean switchValue) |
Callback after text is entered. More... | |
Member Function Documentation
◆ exec()
void com.ugrokit.api.UgiUiUtil.ShowTextInputCompletion.exec | ( | String | value, |
boolean | switchValue | ||
) |
Callback after text is entered.
- Parameters
-
value text switchValue value of switch (or false if no switch)
Copyright © 2012-2017 U Grok It, Inc. connect@UGrokIt.com U Grok It and the U Grok It logo are registered trademarks of U Grok It, Inc. All other trademarks and copyrights are the property of their respective owners |