com.ugrokit.api.UgiDefaultConfigurationUi Class Reference

Overview

Default implementation of UgiConfigurationDelegate.

May be subclassed by applications.

Public Member Functions

Ugi getUgi ()
 Get the associated Ugi object. More...
 
boolean getSendGrokkerSerialNumber ()
 See whether the Grokker serial number should ever be sent to the U Grok It server (default = true) More...
 
void setSendGrokkerSerialNumber (boolean b)
 Set whether the Grokker serial number should ever be sent to the U Grok It server. More...
 
void waitUntilReady (final Runnable completion)
 
Wait until the delegate is able to handle other calls More...
 
void permissionNeeded (final Runnable completion)
 
Notify the user that permissions are needed (Marshmallow and beyond) and and for the permission More...
 
void notifyPermissionRequestFailed (final Runnable completion)
 
Notify the user that the user did not grant permissions More...
 
void notifyAutoRotateOff (final Runnable completion)
 
Notify the user that auto rotate is off More...
 
void showUserMessageBeforeFirstConnect (String message, final Runnable completion)
 
Notify the user of a message before first connection More...
 
void promptAudioJackLocation ()
 Prompt for changing the audio jack setting.
 
void notifyCantSetVolume (final Runnable completion)
 
Notify the user that we can't set the volume, so the user needs to More...
 
void cancelNotifyCantSetVolume ()
 Cancel any notifyCantSetVolume() message.
 
boolean getCheckServerForUnknownDevices ()
 See whether the U Grok It server should be checked if the Android device is not recognized (default = true) More...
 
void setCheckServerForUnknownDevices (boolean b)
 Set whether the U Grok It server should be checked if the Android device is not recognized. More...
 
boolean getSendFirstConnectionAndAutomaticConfigurationReports ()
 See whether first-connection and automatic-configuration reports should be sent to the U Grok It server (default = true) More...
 
void setSendFirstConnectionAndAutomaticConfigurationReports (boolean b)
 Set whether first connection and automatic configuration reports should be sent. More...
 
void autoConfigurationProgress (boolean isPluggedIn, AudioConnectionParams params, int configNum, int progressForConfig, int totalForConfig)
 Notification that automatic configuration is in progress. More...
 
void autoConfigurationCompleted (boolean success, AudioConnectionParams params, int elapsedSeconds)
 Notification that automatic configuration has completed. More...
 
void promptAudioReconfiguration ()
 Prompt the user about audio configuration.
 
boolean getDoAutomaticFirmwareUpdate ()
 See whether automatic firmware update checks will be run (default = true) More...
 
void setDoAutomaticFirmwareUpdate (boolean b)
 Set whether the Grokker firmware should be automatically updated via checking the U Grok It server. More...
 
void promptForFirmwareUpdate (UgiFirmwareUpdateInfo info, final Runnable updateCompletion, final Runnable cancelCompletion, final Runnable postponeCompletion)
 
A firmware update is available. More...
 
void notifyFirmwareUpdateErrorLoadingUpdate (final Runnable completion)
 
Notify the user that there was an error loading the firmware update. More...
 
void displayFirmwareUpdateProgress (final Runnable cancelCompletion)
 
Display progress notification about the firmware update More...
 
void updateFirmwareUpdateProgress (int amountDone, int amountTotal, boolean canCancel)
 
Update the progress notification about the firmware update More...
 
void notifyFirmwareUpdateSuccess (int seconds, final Runnable completion)
 
Notify the user the firmware update completed successfully More...
 
void notifyFirmwareUpdateFailure (boolean mustRetry, Ugi.FirmwareUpdateReturnValues error, final Runnable retryCompletion, final Runnable cancelCompletion)
 
Notify the user that the firmware update failed More...
 
void abortFirmwareUpdateInteraction ()
 
Abort firmware update (Grokker has been disconnected)
 
void afterFirmwareUpdate (boolean updated)
 
Firmware update sequence has finished More...
 
void startBackgroundAction (WaitingCauses cause)
 
Notification that a background action is starting. More...
 
void finishBackgroundAction ()
 
Notification that a background action finished
 
Object showChoices (final String[] choices, int initialSelectedIndex, String title, String message, String actionButtonTitle, boolean canCancel, final UgiUiUtil.ShowChoicesCompletion actionCompletion, final UgiUiUtil.ShowChoicesConfirmationCompletion confirmationCompletion, final Runnable cancelCompletion)
 
Show an alert dialog to choose from a list of choices More...
 
Object showOkCancel (String title, String message, String okButtonTitle, String cancelButtonTitle, final Runnable completion, final Runnable cancelCompletion)
 
Show an alert dialog with ok and cancel buttons More...
 
Object showOk (String title, String message, String okButtonTitle, final Runnable completion)
 
Show an alert dialog with an ok button More...
 
void hideAlert (Object alertDialog)
 
Dismiss a dialog More...
 
void updateAlert (Object alertDialog, String message)
 
Update the message in an alert dialog More...
 
void showWaiting (String message, final Runnable cancelCompletion)
 
Show "waiting" alert dialog, call completion if cancelled More...
 
void showWaiting (String message)
 
Show "waiting" alert dialog without cancel More...
 
void hideWaiting ()
 
Hide "waiting" alert dialog
 

Member Function Documentation

◆ getUgi()

Ugi com.ugrokit.api.UgiDefaultConfigurationUi.getUgi ( )

Get the associated Ugi object.

Returns
the Ugi object

◆ getSendGrokkerSerialNumber()

boolean com.ugrokit.api.UgiDefaultConfigurationUi.getSendGrokkerSerialNumber ( )

See whether the Grokker serial number should ever be sent to the U Grok It server (default = true)

Returns
true if the Grokker serial number should ever be sent to the U Grok It server

Implements com.ugrokit.api.UgiConfigurationDelegate.

◆ setSendGrokkerSerialNumber()

void com.ugrokit.api.UgiDefaultConfigurationUi.setSendGrokkerSerialNumber ( boolean  sendGrokkerSerialNumber)

Set whether the Grokker serial number should ever be sent to the U Grok It server.

Parameters
sendGrokkerSerialNumbertrue to allow the Grokker serial number to be sent to the U Grok It server

Implements com.ugrokit.api.UgiConfigurationDelegate.

◆ waitUntilReady()

void com.ugrokit.api.UgiDefaultConfigurationUi.waitUntilReady ( final Runnable  completion)


Wait until the delegate is able to handle other calls

Parameters
completionBlock to execute when ready to handle other calls

Implements com.ugrokit.api.UgiConfigurationDelegate.

◆ permissionNeeded()

void com.ugrokit.api.UgiDefaultConfigurationUi.permissionNeeded ( final Runnable  completion)


Notify the user that permissions are needed (Marshmallow and beyond) and and for the permission

Parameters
completionBlock to execute when notification is complete

Implements com.ugrokit.api.UgiConfigurationDelegate.

◆ notifyPermissionRequestFailed()

void com.ugrokit.api.UgiDefaultConfigurationUi.notifyPermissionRequestFailed ( final Runnable  completion)


Notify the user that the user did not grant permissions

Parameters
completionBlock to execute when notification is complete

Implements com.ugrokit.api.UgiConfigurationDelegate.

◆ notifyAutoRotateOff()

void com.ugrokit.api.UgiDefaultConfigurationUi.notifyAutoRotateOff ( final Runnable  completion)


Notify the user that auto rotate is off

Parameters
completionBlock to execute when notification is complete

Implements com.ugrokit.api.UgiConfigurationDelegate.

◆ showUserMessageBeforeFirstConnect()

void com.ugrokit.api.UgiDefaultConfigurationUi.showUserMessageBeforeFirstConnect ( String  message,
final Runnable  completion 
)


Notify the user of a message before first connection

Parameters
messageThe message to show
completionBlock to execute when notification is complete

Implements com.ugrokit.api.UgiConfigurationDelegate.

◆ notifyCantSetVolume()

void com.ugrokit.api.UgiDefaultConfigurationUi.notifyCantSetVolume ( final Runnable  completion)


Notify the user that we can't set the volume, so the user needs to

Parameters
completionBlock to execute when notification is complete

Implements com.ugrokit.api.UgiConfigurationDelegate.

◆ getCheckServerForUnknownDevices()

boolean com.ugrokit.api.UgiDefaultConfigurationUi.getCheckServerForUnknownDevices ( )

See whether the U Grok It server should be checked if the Android device is not recognized (default = true)

Returns
true if the server should be checked

Implements com.ugrokit.api.UgiConfigurationDelegate.

◆ setCheckServerForUnknownDevices()

void com.ugrokit.api.UgiDefaultConfigurationUi.setCheckServerForUnknownDevices ( boolean  checkServerForUnknownDevices)

Set whether the U Grok It server should be checked if the Android device is not recognized.

Parameters
checkServerForUnknownDevicestrue if the server should be checked

Implements com.ugrokit.api.UgiConfigurationDelegate.

◆ getSendFirstConnectionAndAutomaticConfigurationReports()

boolean com.ugrokit.api.UgiDefaultConfigurationUi.getSendFirstConnectionAndAutomaticConfigurationReports ( )

See whether first-connection and automatic-configuration reports should be sent to the U Grok It server (default = true)

Returns
true if the server should be checked

Implements com.ugrokit.api.UgiConfigurationDelegate.

◆ setSendFirstConnectionAndAutomaticConfigurationReports()

void com.ugrokit.api.UgiDefaultConfigurationUi.setSendFirstConnectionAndAutomaticConfigurationReports ( boolean  sendFirstConnectionAndAutomaticConfigurationReports)

Set whether first connection and automatic configuration reports should be sent.

Parameters
sendFirstConnectionAndAutomaticConfigurationReportstrue if first connection and automatic configuration reports should be sent

Implements com.ugrokit.api.UgiConfigurationDelegate.

◆ autoConfigurationProgress()

void com.ugrokit.api.UgiDefaultConfigurationUi.autoConfigurationProgress ( boolean  isPluggedIn,
AudioConnectionParams  params,
int  configNum,
int  progressForConfig,
int  totalForConfig 
)

Notification that automatic configuration is in progress.

Parameters
isPluggedIntrue if something is plugged in (wait until this is true to display an alert)
paramsAudio parameters being tried currently
configNumConfiguration number being tried
progressForConfigStep # with this configuration
totalForConfigTotal # of steps for this configuration

Implements com.ugrokit.api.UgiConfigurationDelegate.

◆ autoConfigurationCompleted()

void com.ugrokit.api.UgiDefaultConfigurationUi.autoConfigurationCompleted ( boolean  success,
AudioConnectionParams  params,
int  elapsedSeconds 
)

Notification that automatic configuration has completed.

Parameters
successtrue if successful
paramsAudio parameters
elapsedSecondsTime required for automatic configuration

Implements com.ugrokit.api.UgiConfigurationDelegate.

◆ getDoAutomaticFirmwareUpdate()

boolean com.ugrokit.api.UgiDefaultConfigurationUi.getDoAutomaticFirmwareUpdate ( )

See whether automatic firmware update checks will be run (default = true)

Returns
true if automatic firmware update checks are being run

Implements com.ugrokit.api.UgiConfigurationDelegate.

◆ setDoAutomaticFirmwareUpdate()

void com.ugrokit.api.UgiDefaultConfigurationUi.setDoAutomaticFirmwareUpdate ( boolean  doAutomaticFirmwareUpdate)

Set whether the Grokker firmware should be automatically updated via checking the U Grok It server.

Parameters
doAutomaticFirmwareUpdatetrue if the Grokker firmware should be automatically updated

Implements com.ugrokit.api.UgiConfigurationDelegate.

◆ promptForFirmwareUpdate()

void com.ugrokit.api.UgiDefaultConfigurationUi.promptForFirmwareUpdate ( UgiFirmwareUpdateInfo  info,
final Runnable  updateCompletion,
final Runnable  cancelCompletion,
final Runnable  postponeCompletion 
)


A firmware update is available.

Prompt the user for whether to update. If the app does not want to update now, return NO call the Ugi method repromptForAutomaticFirmwareUpdateIfAvailable at some point.

Parameters
infoInformation about the firmware update that is available
updateCompletionBlock to execute to do the update
cancelCompletionBlock to execute if the user cancels
postponeCompletionBlock to to postpone until later

Implements com.ugrokit.api.UgiConfigurationDelegate.

◆ notifyFirmwareUpdateErrorLoadingUpdate()

void com.ugrokit.api.UgiDefaultConfigurationUi.notifyFirmwareUpdateErrorLoadingUpdate ( final Runnable  completion)


Notify the user that there was an error loading the firmware update.

Parameters
completionBlock to execute after notification

Implements com.ugrokit.api.UgiConfigurationDelegate.

◆ displayFirmwareUpdateProgress()

void com.ugrokit.api.UgiDefaultConfigurationUi.displayFirmwareUpdateProgress ( final Runnable  cancelCompletion)


Display progress notification about the firmware update

Parameters
cancelCompletionBlock to execute if the user cancels

Implements com.ugrokit.api.UgiConfigurationDelegate.

◆ updateFirmwareUpdateProgress()

void com.ugrokit.api.UgiDefaultConfigurationUi.updateFirmwareUpdateProgress ( int  amountDone,
int  amountTotal,
boolean  canCancel 
)


Update the progress notification about the firmware update

Parameters
amountDoneAmmount of the firmware update that is done
amountTotalAmmount of the firmware update total
canCancelYES if the user can cancel at this point

Implements com.ugrokit.api.UgiConfigurationDelegate.

◆ notifyFirmwareUpdateSuccess()

void com.ugrokit.api.UgiDefaultConfigurationUi.notifyFirmwareUpdateSuccess ( int  seconds,
final Runnable  completion 
)


Notify the user the firmware update completed successfully

Parameters
secondsNumber of seconds that the update took
completionBlock to execute after notification

Implements com.ugrokit.api.UgiConfigurationDelegate.

◆ notifyFirmwareUpdateFailure()

void com.ugrokit.api.UgiDefaultConfigurationUi.notifyFirmwareUpdateFailure ( boolean  mustRetry,
Ugi.FirmwareUpdateReturnValues  error,
final Runnable  retryCompletion,
final Runnable  cancelCompletion 
)


Notify the user that the firmware update failed

Parameters
mustRetryYES of the user must retry (do not present a Cancel option)
errorError value
retryCompletionBlock to execute to retry the update 9nil if the update cannot be retried)
cancelCompletionBlock to execute if the user cancels

Implements com.ugrokit.api.UgiConfigurationDelegate.

◆ afterFirmwareUpdate()

void com.ugrokit.api.UgiDefaultConfigurationUi.afterFirmwareUpdate ( boolean  updated)


Firmware update sequence has finished

Parameters
updatedtrue if update succeeded

Implements com.ugrokit.api.UgiConfigurationDelegate.

◆ startBackgroundAction()

void com.ugrokit.api.UgiDefaultConfigurationUi.startBackgroundAction ( WaitingCauses  cause)


Notification that a background action is starting.

Display a "waiting" alert

Parameters
causeAction that is about to start

Implements com.ugrokit.api.UgiConfigurationDelegate.

◆ showChoices()

Object com.ugrokit.api.UgiDefaultConfigurationUi.showChoices ( final String []  choices,
int  initialSelectedIndex,
String  title,
String  message,
String  actionButtonTitle,
boolean  canCancel,
final UgiUiUtil.ShowChoicesCompletion  actionCompletion,
final UgiUiUtil.ShowChoicesConfirmationCompletion  confirmationCompletion,
final Runnable  cancelCompletion 
)


Show an alert dialog to choose from a list of choices

Parameters
choicesChoices to choose from
initialSelectedIndexChoice to select initially
titleTitle for the alert
messageMessage for the alert
actionButtonTitleText for the "ok" button, or "" for the default, or nil for no ok button
canCanceltrue if the user can cancel
actionCompletionBlock to execute for "ok"
confirmationCompletionBlock to execute before "ok"
cancelCompletionBlock to execute for "cancel"
Returns
The alert dialog

◆ showOkCancel()

Object com.ugrokit.api.UgiDefaultConfigurationUi.showOkCancel ( String  title,
String  message,
String  okButtonTitle,
String  cancelButtonTitle,
final Runnable  completion,
final Runnable  cancelCompletion 
)


Show an alert dialog with ok and cancel buttons

Parameters
titleTitle for the alert
messageText for the body of the alert
okButtonTitleText for the "ok" button, or "" for the default, or nil for no ok button
cancelButtonTitleText for the "cancel" button, or "" for the default, or nil for no cancel button
completionBlock to execute for "ok"
cancelCompletionBlock to execute for "cancel"
Returns
The alert dialog

◆ showOk()

Object com.ugrokit.api.UgiDefaultConfigurationUi.showOk ( String  title,
String  message,
String  okButtonTitle,
final Runnable  completion 
)


Show an alert dialog with an ok button

Parameters
titleTitle for the alert
messageText for the body of the alert
okButtonTitleText for the "ok" button, or "" for the default, or nil for no ok button
completionBlock to execute for "ok"
Returns
The alert dialog

◆ hideAlert()

void com.ugrokit.api.UgiDefaultConfigurationUi.hideAlert ( Object  alertDialog)


Dismiss a dialog

Parameters
alertDialogThe alert dialog to dismiss

◆ updateAlert()

void com.ugrokit.api.UgiDefaultConfigurationUi.updateAlert ( Object  alertDialog,
String  message 
)


Update the message in an alert dialog

Parameters
alertDialogThe alert dialog to update
messageText for the body of the alert dialog

◆ showWaiting() [1/2]

void com.ugrokit.api.UgiDefaultConfigurationUi.showWaiting ( String  message,
final Runnable  cancelCompletion 
)


Show "waiting" alert dialog, call completion if cancelled

Parameters
messageText for the body of the alert dialog
cancelCompletionBlock to execute for "cancel" (or nil if cancel is not an option)

◆ showWaiting() [2/2]

void com.ugrokit.api.UgiDefaultConfigurationUi.showWaiting ( String  message)


Show "waiting" alert dialog without cancel

Parameters
messageText for the body of the alert dialog