Static Public Member Functions | Classes | Static Public Attributes
com.ugrokit.api.UgiUiUtil Class Reference

## 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 | showOkNeutralCancel (Context context, String title, String message, String okButtonTitle, String neutralButtonTitle, String cancelButtonTitle, final Runnable completion, final Runnable neutralCompletion, final Runnable cancelCompletion, final Dialog.OnKeyListener onKeyListener)
| 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 | showOkCancel (Context context, String title, String message, String okButtonTitle, String cancelButtonTitle, final Runnable completion, final Runnable cancelCompletion, final Dialog.OnKeyListener onKeyListener)
| 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, String okButtonTitle, final Runnable completion, final Dialog.OnKeyListener onKeyListener)
| 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, final Runnable cancelCompletion, final Dialog.OnKeyListener onKeyListener)
| Show "waiting" alert dialog. 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 Object | showInventoryError (Context context, int result, Runnable completion, final Dialog.OnKeyListener onKeyListener)
| 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 | showBarcodeError (Context context, Runnable completion, Dialog.OnKeyListener onKeyListener)
| 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 int com.ugrokit.api.UgiUiUtil.getThemeColorToUse | ( |  | ) |
| static

Color for the currently active UgiUiActivity.

Returns
  theme color to use for the current activity

## ◆ getTextColorOnThemeColorToUse()

static int com.ugrokit.api.UgiUiUtil.getTextColorOnThemeColorToUse | ( |  | ) |
| static

Color for the currently active UgiUiActivity.

Returns
  text color on theme color to use for the current activity

## ◆ getButtonColorToUse()

static int com.ugrokit.api.UgiUiUtil.getButtonColorToUse | ( |  | ) |
| static

Color for the currently active UgiUiActivity.

Returns
  button color to use for the current activity

## ◆ getButtonPressedColorToUse()

static int com.ugrokit.api.UgiUiUtil.getButtonPressedColorToUse | ( |  | ) |
| static

Color for the currently active UgiUiActivity.

Returns
  button pressed color to use for the current activity

## ◆ getTextColorOnBackgroundToUse()

static int com.ugrokit.api.UgiUiUtil.getTextColorOnBackgroundToUse | ( |  | ) |
| static

Color for the currently active UgiUiActivity.

Returns
  text color to use for the current activity

## ◆ traverseSubviews()

static View com.ugrokit.api.UgiUiUtil.traverseSubviews | ( | View | v,
|  | TraverseSubviewsCallback | callback
| ) |  |
| static

Traverse all subviews of the given view.

Parameters

  v | View to traverse
  callback | Callback to call

Returns
  Return value from callback

## ◆ getParentActivity()

static Activity com.ugrokit.api.UgiUiUtil.getParentActivity | ( | View | view | ) |
| static

Get the parent activity for a view.

Parameters

  view | View to get the parent activity of

Returns
  The activity

## ◆ lightenColor()

static int com.ugrokit.api.UgiUiUtil.lightenColor | ( | int | color,
|  | double | degree
| ) |  |
| static

Make a color lighter.

Parameters

  color | Color to change
  degree | Degree to lighten: 0 = white, 1 = no change

Returns
  New color

## ◆ darkenColor()

static int com.ugrokit.api.UgiUiUtil.darkenColor | ( | int | color,
|  | double | degree
| ) |  |
| static

Make a color darker.

Parameters

  color | Color to change
  degree | Degree to darken: 0 = black, 1 = no change

Returns
  New color

## ◆ getColorLuminance()

static double com.ugrokit.api.UgiUiUtil.getColorLuminance | ( | int | color | ) |
| 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 String com.ugrokit.api.UgiUiUtil.colorToString | ( | int | color | ) |
| static

Get a string description of a color (mostl;y for debugging)

Parameters

  color | The color

Returns
  String description

## ◆ modifyColorToBeSufficientlyDarkForText()

static int com.ugrokit.api.UgiUiUtil.modifyColorToBeSufficientlyDarkForText | ( | int | textColor,
|  | int | backgroundColor
| ) |  |
| 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 boolean com.ugrokit.api.UgiUiUtil.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 void com.ugrokit.api.UgiUiUtil.setUseUGrokItStyleAlerts | ( | boolean | b | ) |
| 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 Object com.ugrokit.api.UgiUiUtil.showCustomAlert | ( | Context | context,
|  | String | title,
|  | View | view,
|  | boolean | cancelable,
|  | boolean | showCloseButton,
|  | Runnable | closeCompletion
| ) |  |
| 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 void com.ugrokit.api.UgiUiUtil.hideUI | ( | Object | o | ) |
| static

Dismiss a UI component shown with one of the showXXX methods.

Parameters

  o | The UI dialog to dismiss

## ◆ updateAlertTitle()

static void com.ugrokit.api.UgiUiUtil.updateAlertTitle | ( | Object | o,
|  | String | title
| ) |  |
| static

Update the title in an alert dialog.

Parameters

  o | The alert to update
  title | New title for the alert dialog

## ◆ updateAlert()

static void com.ugrokit.api.UgiUiUtil.updateAlert | ( | Object | o,
|  | String | message
| ) |  |
| static

Update the message in an alert dialog.

Parameters

  o | The alert to update
  message | Text for the body of the alert dialog

## ◆ showOkNeutralCancel() [1/2]

static Object com.ugrokit.api.UgiUiUtil.showOkNeutralCancel | ( | Context | context,
|  | String | title,
|  | String | message,
|  | String | okButtonTitle,
|  | String | neutralButtonTitle,
|  | String | cancelButtonTitle,
|  | final Runnable | completion,
|  | final Runnable | neutralCompletion,
|  | final Runnable | cancelCompletion
| ) |  |
| 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)

## ◆ showOkNeutralCancel() [2/2]

static Object com.ugrokit.api.UgiUiUtil.showOkNeutralCancel | ( | Context | context,
|  | String | title,
|  | String | message,
|  | String | okButtonTitle,
|  | String | neutralButtonTitle,
|  | String | cancelButtonTitle,
|  | final Runnable | completion,
|  | final Runnable | neutralCompletion,
|  | final Runnable | cancelCompletion,
|  | final Dialog.OnKeyListener | onKeyListener
| ) |  |
| 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"
  onKeyListener | A listener for key events. Useful for detecting PD67 side button presses.

Returns
  The alert dialog (for updateAlert or hideUI)

## ◆ showOkCancel() [1/2]

static Object com.ugrokit.api.UgiUiUtil.showOkCancel | ( | Context | context,
|  | String | title,
|  | String | message,
|  | String | okButtonTitle,
|  | String | cancelButtonTitle,
|  | final Runnable | completion,
|  | final Runnable | cancelCompletion
| ) |  |
| 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)

## ◆ showOkCancel() [2/2]

static Object com.ugrokit.api.UgiUiUtil.showOkCancel | ( | Context | context,
|  | String | title,
|  | String | message,
|  | String | okButtonTitle,
|  | String | cancelButtonTitle,
|  | final Runnable | completion,
|  | final Runnable | cancelCompletion,
|  | final Dialog.OnKeyListener | onKeyListener
| ) |  |
| 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"
  onKeyListener | A listener for key events. Useful for detecting PD67 side button presses.

Returns
  The alert dialog (for updateAlert or hideUI)

## ◆ showOk() [1/3]

static Object com.ugrokit.api.UgiUiUtil.showOk | ( | Context | context,
|  | String | title,
|  | String | message,
|  | String | okButtonTitle,
|  | final Runnable | completion
| ) |  |
| 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/3]

static Object com.ugrokit.api.UgiUiUtil.showOk | ( | Context | context,
|  | String | title,
|  | String | message,
|  | String | okButtonTitle,
|  | final Runnable | completion,
|  | final Dialog.OnKeyListener | onKeyListener
| ) |  |
| 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"
  onKeyListener | A listener for key events. Useful for detecting PD67 side button presses.

Returns
  The alert dialog (for updateAlert or hideUI)

## ◆ showOk() [3/3]

static Object com.ugrokit.api.UgiUiUtil.showOk | ( | Context | context,
|  | String | title,
|  | String | message
| ) |  |
| 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 Object com.ugrokit.api.UgiUiUtil.showCancel | ( | Context | context,
|  | String | title,
|  | String | message,
|  | final Runnable | completion
| ) |  |
| 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 Object com.ugrokit.api.UgiUiUtil.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
| ) |  |
| 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 Object com.ugrokit.api.UgiUiUtil.showMenu | ( | final Context | context,
|  | String | title,
|  | final Runnable | cancelCompletion,
|  | final MenuTitleAndHandler... | items
| ) |  |
| 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 void com.ugrokit.api.UgiUiUtil.showToast | ( | final Context | context,
|  | String | title,
|  | String | message,
|  | double | interval
| ) |  |
| 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 void com.ugrokit.api.UgiUiUtil.showToast | ( | final Context | context,
|  | String | title,
|  | String | message
| ) |  |
| 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 Object com.ugrokit.api.UgiUiUtil.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
| ) |  |
| 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/3]

static void com.ugrokit.api.UgiUiUtil.showWaiting | ( | Context | context,
|  | String | message,
|  | final Runnable | cancelCompletion
| ) |  |
| 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/3]

static void com.ugrokit.api.UgiUiUtil.showWaiting | ( | Context | context,
|  | String | message,
|  | final Runnable | cancelCompletion,
|  | final Dialog.OnKeyListener | onKeyListener
| ) |  |
| static

Show "waiting" alert dialog.

Includes a completion for cancelling, as well as an OnKeyListener.

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)
  onKeyListener | A listener for key events. Useful for detecting PD67 side button presses.

## ◆ showWaiting() [3/3]

static void com.ugrokit.api.UgiUiUtil.showWaiting | ( | Context | context,
|  | String | message
| ) |  |
| 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 void com.ugrokit.api.UgiUiUtil.updateWaiting | ( | String | message | ) |
| static

Update the message in the waiting dialog.

Parameters

  message | New message

## ◆ isWaitingShown()

static boolean com.ugrokit.api.UgiUiUtil.isWaitingShown | ( |  | ) |
| static

See if the waiting alert is shown.

Returns
  true is waiting is shown

## ◆ stopInventoryWithCompletionShowWaiting()

static void com.ugrokit.api.UgiUiUtil.stopInventoryWithCompletionShowWaiting | ( | Context | context,
|  | final UgiInventory.StopInventoryCompletion | completion
| ) |  |
| 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 void com.ugrokit.api.UgiUiUtil.stopInventoryWithShownAlert | ( | final Context | context,
|  | final Object | alert,
|  | final Runnable | completion
| ) |  |
| 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 void com.ugrokit.api.UgiUiUtil.startDisconnectedAlert | ( | final Context | context,
|  | final Runnable | cancelCompletion
| ) |  |
| 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 void com.ugrokit.api.UgiUiUtil.stopDisconnectedAlert | ( |  | ) |
| static

Stop showing disconnected dialog.

Normally called just before calling stopInventory()

## ◆ isDisconnectedAlertActive()

static boolean com.ugrokit.api.UgiUiUtil.isDisconnectedAlertActive | ( |  | ) |
| static

See if the disconnected alert is active.

Returns
  true if disconnected alert is active

## ◆ showInventoryError() [1/3]

static Object com.ugrokit.api.UgiUiUtil.showInventoryError | ( | Context | context,
|  | int | result
| ) |  |
| 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/3]

static Object com.ugrokit.api.UgiUiUtil.showInventoryError | ( | Context | context,
|  | int | result,
|  | Runnable | completion
| ) |  |
| 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)

## ◆ showInventoryError() [3/3]

static Object com.ugrokit.api.UgiUiUtil.showInventoryError | ( | Context | context,
|  | int | result,
|  | Runnable | completion,
|  | final Dialog.OnKeyListener | onKeyListener
| ) |  |
| 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. If there is no inventory error, this will run immediately. Can be null if no completion is desired.
  onKeyListener | A listener for key events. Useful for detecting PD67 side button presses.

Returns
  The alert dialog (for updateAlert or hideUI)

## ◆ getTagAccessErrorMessage()

static String com.ugrokit.api.UgiUiUtil.getTagAccessErrorMessage | ( | UgiInventory.TagAccessReturnValues | result | ) |
| 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 String com.ugrokit.api.UgiUiUtil.getInventoryErrorMessage | ( | int | result | ) |
| 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 String com.ugrokit.api.UgiUiUtil.getBarcodeScanErrorMessage | ( |  | ) |
| static

Get the appropriate error message if barcode scan failed.

Returns
  Error message

## ◆ showBarcodeError() [1/2]

static Object com.ugrokit.api.UgiUiUtil.showBarcodeError | ( | Context | context,
|  | Runnable | completion
| ) |  |
| 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)

## ◆ showBarcodeError() [2/2]

static Object com.ugrokit.api.UgiUiUtil.showBarcodeError | ( | Context | context,
|  | Runnable | completion,
|  | Dialog.OnKeyListener | onKeyListener
| ) |  |
| 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
  onKeyListener | A listener for key events. Useful for detecting PD67 side button presses.

Returns
  The alert dialog (for updateAlert or hideUI)

## ◆ showVersionAlert()

static Object com.ugrokit.api.UgiUiUtil.showVersionAlert | ( | Context | context,
|  | String | title,
|  | final boolean | showExtraInfo
| ) |  |
| 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 String com.ugrokit.api.UgiUiUtil.getStringWithDeviceName | ( | String | s | ) |
| static

Substitute the device name for "PD20" in a string.

Parameters

  s | string

Returns
  string with substitution