AI2 Component  (Version nb184)
com.google.appinventor.components.runtime.Notifier Class Reference
Inheritance diagram for com.google.appinventor.components.runtime.Notifier:
com.google.appinventor.components.runtime.AndroidNonvisibleComponent com.google.appinventor.components.runtime.Component com.google.appinventor.components.runtime.Component

Public Member Functions

 Notifier (ComponentContainer container)
 
void ShowProgressDialog (String message, String title)
 
void DismissProgressDialog ()
 
void progressDialog (String message, String title)
 
void ShowMessageDialog (String message, String title, String buttonText)
 
void ShowChooseDialog (String message, String title, final String button1Text, final String button2Text, boolean cancelable)
 
void AfterChoosing (String choice)
 
void ChoosingCanceled ()
 
void ShowTextDialog (String message, String title, boolean cancelable)
 
void ShowPasswordDialog (String message, String title, boolean cancelable)
 
void HideKeyboard (View view)
 
void AfterTextInput (String response)
 
void TextInputCanceled ()
 
void ShowAlert (final String notice)
 
void NotifierLength (int length)
 
int NotifierLength ()
 
void BackgroundColor (@IsColor int argb)
 
int TextColor ()
 
void TextColor (int argb)
 
void LogError (String message)
 
void LogWarning (String message)
 
void LogInfo (String message)
 
- Public Member Functions inherited from com.google.appinventor.components.runtime.AndroidNonvisibleComponent
HandlesEventDispatching getDispatchDelegate ()
 

Static Public Member Functions

static void oneButtonAlert (Activity activity, String message, String title, String buttonText, final Runnable callBack)
 
static void oneButtonAlert (Activity activity, String message, String title, String buttonText)
 
static void twoButtonDialog (Activity activity, String message, String title, final String button1Text, final String button2Text, boolean cancelable, final Runnable positiveAction, final Runnable negativeAction, final Runnable cancelAction)
 

Additional Inherited Members

- Static Public Attributes inherited from com.google.appinventor.components.runtime.Component
static final String ASSET_DIRECTORY = "component"
 
static final int ALIGNMENT_NORMAL = 0
 
static final int ALIGNMENT_CENTER = 1
 
static final int ALIGNMENT_OPPOSITE = 2
 
static final int ACCELEROMETER_SENSITIVITY_WEAK = 1
 
static final int ACCELEROMETER_SENSITIVITY_MODERATE = 2
 
static final int ACCELEROMETER_SENSITIVITY_STRONG = 3
 
static final int BUTTON_SHAPE_DEFAULT = 0
 
static final int BUTTON_SHAPE_ROUNDED = 1
 
static final int BUTTON_SHAPE_RECT = 2
 
static final int BUTTON_SHAPE_OVAL = 3
 
static final int COLOR_NONE = 0x00FFFFFF
 
static final int COLOR_BLACK = 0xFF000000
 
static final int COLOR_BLUE = 0xFF0000FF
 
static final int COLOR_CYAN = 0xFF00FFFF
 
static final int COLOR_DKGRAY = 0xFF444444
 
static final int COLOR_GRAY = 0xFF888888
 
static final int COLOR_GREEN = 0xFF00FF00
 
static final int COLOR_LTGRAY = 0xFFCCCCCC
 
static final int COLOR_MAGENTA = 0xFFFF00FF
 
static final int COLOR_ORANGE = 0xFFFFC800
 
static final int COLOR_PINK = 0xFFFFAFAF
 
static final int COLOR_RED = 0xFFFF0000
 
static final int COLOR_WHITE = 0xFFFFFFFF
 
static final int COLOR_YELLOW = 0xFFFFFF00
 
static final int COLOR_DEFAULT = 0x00000000
 
static final String DEFAULT_VALUE_COLOR_NONE = "&H00FFFFFF"
 
static final String DEFAULT_VALUE_COLOR_BLACK = "&HFF000000"
 
static final String DEFAULT_VALUE_COLOR_BLUE = "&HFF0000FF"
 
static final String DEFAULT_VALUE_COLOR_CYAN = "&HFF00FFFF"
 
static final String DEFAULT_VALUE_COLOR_DKGRAY = "&HFF444444"
 
static final String DEFAULT_VALUE_COLOR_GRAY = "&HFF888888"
 
static final String DEFAULT_VALUE_COLOR_GREEN = "&HFF00FF00"
 
static final String DEFAULT_VALUE_COLOR_LTGRAY = "&HFFCCCCCC"
 
static final String DEFAULT_VALUE_COLOR_MAGENTA = "&HFFFF00FF"
 
static final String DEFAULT_VALUE_COLOR_ORANGE = "&HFFFFC800"
 
static final String DEFAULT_VALUE_COLOR_PINK = "&HFFFFAFAF"
 
static final String DEFAULT_VALUE_COLOR_RED = "&HFFFF0000"
 
static final String DEFAULT_VALUE_COLOR_WHITE = "&HFFFFFFFF"
 
static final String DEFAULT_VALUE_COLOR_YELLOW = "&HFFFFFF00"
 
static final String DEFAULT_VALUE_COLOR_DEFAULT = "&H00000000"
 
static final float FONT_DEFAULT_SIZE = 14
 
static final int LAYOUT_ORIENTATION_HORIZONTAL = ComponentConstants.LAYOUT_ORIENTATION_HORIZONTAL
 
static final int LAYOUT_ORIENTATION_VERTICAL = ComponentConstants.LAYOUT_ORIENTATION_VERTICAL
 
static final int SCALING_SCALE_PROPORTIONALLY = 0
 
static final int SCALING_SCALE_TO_FIT = 1
 
static final int TYPEFACE_DEFAULT = 0
 
static final int TYPEFACE_SANSSERIF = 1
 
static final int TYPEFACE_SERIF = 2
 
static final int TYPEFACE_MONOSPACE = 3
 
static final int LENGTH_PREFERRED = -1
 
static final int LENGTH_FILL_PARENT = -2
 
static final int LENGTH_UNKNOWN = -3
 
static final int LENGTH_PERCENT_TAG = -1000
 
static final int TOAST_LENGTH_SHORT = 0
 
static final int TOAST_LENGTH_LONG = 1
 
static final int DIRECTION_NORTH = 1
 
static final int DIRECTION_NORTHEAST = 2
 
static final int DIRECTION_EAST = 3
 
static final int DIRECTION_SOUTHEAST = 4
 
static final int DIRECTION_SOUTH = -1
 
static final int DIRECTION_SOUTHWEST = -2
 
static final int DIRECTION_WEST = -3
 
static final int DIRECTION_NORTHWEST = -4
 
static final int DIRECTION_NONE = 0
 
static final int DIRECTION_MIN = -4
 
static final int DIRECTION_MAX = 4
 
static float SLIDER_MIN_VALUE = 10
 
static float SLIDER_MAX_VALUE = 50
 
static float SLIDER_THUMB_VALUE = (SLIDER_MIN_VALUE + SLIDER_MAX_VALUE) / 2.0f
 
static final String DEFAULT_VALUE_TEXT_TO_SPEECH_COUNTRY = ""
 
static final String DEFAULT_VALUE_TEXT_TO_SPEECH_LANGUAGE = ""
 
- Protected Member Functions inherited from com.google.appinventor.components.runtime.AndroidNonvisibleComponent
 AndroidNonvisibleComponent (Form form)
 
- Protected Attributes inherited from com.google.appinventor.components.runtime.AndroidNonvisibleComponent
final Form form
 

Detailed Description

The Notifier component displays alert messages and creates Android log entries through an assortment of methods.

Author
halab.nosp@m.elso.nosp@m.n@goo.nosp@m.gle..nosp@m.com (Hal Abelson)

Definition at line 78 of file Notifier.java.

Constructor & Destructor Documentation

◆ Notifier()

com.google.appinventor.components.runtime.Notifier.Notifier ( ComponentContainer  container)

Creates a new Notifier component.

Parameters
containerthe enclosing component

Definition at line 99 of file Notifier.java.

Member Function Documentation

◆ AfterChoosing()

void com.google.appinventor.components.runtime.Notifier.AfterChoosing ( String  choice)

Event after the user has made a selection for ShowChooseDialog(String, String, String, String, boolean).

Parameters
choiceis the text on the button the user pressed

Definition at line 284 of file Notifier.java.

◆ AfterTextInput()

void com.google.appinventor.components.runtime.Notifier.AfterTextInput ( String  response)

Event raised after the user has responded to ShowTextDialog(String, String, boolean).

Parameters
responseis the text that was entered

Definition at line 411 of file Notifier.java.

◆ BackgroundColor()

void com.google.appinventor.components.runtime.Notifier.BackgroundColor ( @IsColor int  argb)

Specifies the background color for alerts (not dialogs).

Parameters
argbbackground RGB color with alpha

Definition at line 475 of file Notifier.java.

◆ ChoosingCanceled()

void com.google.appinventor.components.runtime.Notifier.ChoosingCanceled ( )

Event raised when the user cancels choosing an option. ShowChooseDialog(String, String, String, String, boolean).

Definition at line 294 of file Notifier.java.

◆ DismissProgressDialog()

void com.google.appinventor.components.runtime.Notifier.DismissProgressDialog ( )

Dismisses the alert created by the ShowProgressDialog block

Definition at line 128 of file Notifier.java.

◆ HideKeyboard()

void com.google.appinventor.components.runtime.Notifier.HideKeyboard ( View  view)

Hide soft keyboard after user either enters text or cancels.

Definition at line 398 of file Notifier.java.

◆ LogError()

void com.google.appinventor.components.runtime.Notifier.LogError ( String  message)

Writes an error message to the Android system log. See the Google Android documentation for how to access the log.

Parameters
messagethe error message

Definition at line 543 of file Notifier.java.

◆ LogInfo()

void com.google.appinventor.components.runtime.Notifier.LogInfo ( String  message)

Writes an information message to the Android log.

Parameters
messagethe information message

Definition at line 565 of file Notifier.java.

◆ LogWarning()

void com.google.appinventor.components.runtime.Notifier.LogWarning ( String  message)

Writes a warning message to the Android log. See the Google Android documentation for how to access the log.

Parameters
messagethe warning message

Definition at line 555 of file Notifier.java.

◆ NotifierLength() [1/2]

int com.google.appinventor.components.runtime.Notifier.NotifierLength ( )

@suppressdoc

Definition at line 463 of file Notifier.java.

◆ NotifierLength() [2/2]

void com.google.appinventor.components.runtime.Notifier.NotifierLength ( int  length)

Specifies the length of time that the alert is shown – either "short" or "long".

Parameters
lengthLength of time that an alert is visible

Definition at line 453 of file Notifier.java.

◆ oneButtonAlert() [1/2]

static void com.google.appinventor.components.runtime.Notifier.oneButtonAlert ( Activity  activity,
String  message,
String  title,
String  buttonText 
)
static

Definition at line 184 of file Notifier.java.

◆ oneButtonAlert() [2/2]

static void com.google.appinventor.components.runtime.Notifier.oneButtonAlert ( Activity  activity,
String  message,
String  title,
String  buttonText,
final Runnable  callBack 
)
static

Definition at line 164 of file Notifier.java.

◆ progressDialog()

void com.google.appinventor.components.runtime.Notifier.progressDialog ( String  message,
String  title 
)

This method creates the actual ProgressDialog. If one is already being displayed, then it dismisses it, and creates this new one.

Parameters
messagethe message for the dialog
titlethe title for the dialog

Definition at line 141 of file Notifier.java.

◆ ShowAlert()

void com.google.appinventor.components.runtime.Notifier.ShowAlert ( final String  notice)

Display a temporary notification.

Parameters
noticethe text of the notification

Definition at line 435 of file Notifier.java.

◆ ShowChooseDialog()

void com.google.appinventor.components.runtime.Notifier.ShowChooseDialog ( String  message,
String  title,
final String  button1Text,
final String  button2Text,
boolean  cancelable 
)

Shows a dialog box with two buttons, from which the user can choose. If cancelable is true{:.logic.block} there will be an additional CANCEL button. Pressing a button will raise the AfterChoosing(String) event. The "choice" parameter to AfterChoosing(String) will be the text on the button that was pressed, or "Cancel" if the CANCEL button was pressed. If canceled, the TextInputCanceled() event will also run.

Parameters
messagethe text in the alert box
titlethe title for the alert box
button1Textthe text on the left-hand button
button2Textthe text on the right-hand button
cancelableindicates if additional CANCEL button should be added

Definition at line 213 of file Notifier.java.

◆ ShowMessageDialog()

void com.google.appinventor.components.runtime.Notifier.ShowMessageDialog ( String  message,
String  title,
String  buttonText 
)

Display an alert dialog with a single button that dismisses the alert.

Parameters
messagethe text in the alert box
titlethe title for the alert box
buttonTextthe text on the button

Definition at line 158 of file Notifier.java.

◆ ShowPasswordDialog()

void com.google.appinventor.components.runtime.Notifier.ShowPasswordDialog ( String  message,
String  title,
boolean  cancelable 
)

Shows a dialog box where the user can enter password (input is masked), after which the AfterTextInput(String) event will be raised. If cancelable is true{:.logic.block} there will be an additional CANCEL button. The AfterTextInput(String) and TextInputCanceled() events behave the same way as described in ShowTextDialog(String, String, boolean).

Parameters
messagethe text in the alert box
titlethe title for the alert box
cancelableindicates whether the user should be able to cancel out of dialog. When true, an additional CANCEL button will be added allowing user to cancel out of dialog. If selected, it will raise AfterTextInput with text of CANCEL.

Definition at line 339 of file Notifier.java.

◆ ShowProgressDialog()

void com.google.appinventor.components.runtime.Notifier.ShowProgressDialog ( String  message,
String  title 
)

Shows a dialog box with an optional title and message (use empty strings if they are not wanted). This dialog box contains a spinning artifact to indicate that the program is working. It cannot be canceled by the user but must be dismissed by the App Inventor Program by using the DismissProgressDialog() method.

Parameters
messagethe text in the alert box
titlethe title for the alert box

Definition at line 120 of file Notifier.java.

◆ ShowTextDialog()

void com.google.appinventor.components.runtime.Notifier.ShowTextDialog ( String  message,
String  title,
boolean  cancelable 
)

Shows a dialog box where the user can enter text, after which the AfterTextInput(String) event will be raised. If cancelable is true{:.logic.block} there will be an additional CANCEL button. Entering text will raise the AfterTextInput(String) event. The "response" parameter to AfterTextInput(String) will be the text that was entered, or "Cancel" if the CANCEL button was pressed. If canceled, the TextInputCanceled() event will also run.

Parameters
messagethe text in the alert box
titlethe title for the alert box
cancelableindicates whether the user should be able to cancel out of dialog. When true, an additional CANCEL button will be added allowing user to cancel out of dialog. If selected, it will raise AfterTextInput with text of CANCEL.

Definition at line 317 of file Notifier.java.

◆ TextColor() [1/2]

int com.google.appinventor.components.runtime.Notifier.TextColor ( )

Returns the alert's text color.

Returns
text RGB color with alpha

Definition at line 487 of file Notifier.java.

◆ TextColor() [2/2]

void com.google.appinventor.components.runtime.Notifier.TextColor ( int  argb)

Specifies the text color for alerts (not dialogs).

Parameters
argbtext RGB color with alpha

Definition at line 499 of file Notifier.java.

◆ TextInputCanceled()

void com.google.appinventor.components.runtime.Notifier.TextInputCanceled ( )

◆ twoButtonDialog()

static void com.google.appinventor.components.runtime.Notifier.twoButtonDialog ( Activity  activity,
String  message,
String  title,
final String  button1Text,
final String  button2Text,
boolean  cancelable,
final Runnable  positiveAction,
final Runnable  negativeAction,
final Runnable  cancelAction 
)
static

Definition at line 235 of file Notifier.java.


The documentation for this class was generated from the following file: