danger.ui
Class AlertWindow

java.lang.Object
  extended by danger.app.Listener
      extended by danger.ui.View
          extended by danger.ui.Container
              extended by danger.ui.Window
                  extended by danger.ui.DialogWindow
                      extended by danger.ui.AlertWindow
Direct Known Subclasses:
TextInputAlertWindow


public class AlertWindow
extends DialogWindow

This class is a UI object that displays a standard alert to the user.

The corresponding resource object is an object of type "alert".


Field Summary
protected static int GAP3
          Deprecated. For internal use only.
protected static int IMAGE_TEXT_GAP
          Deprecated. For internal use only.
protected  boolean m_autoDismiss
          Deprecated. Use setAutoDismiss(int, int, int, java.lang.Object, danger.app.Listener) and getAutoDismiss() instead.
protected  Event m_autoDismissEvent
          Deprecated. Use setAutoDismiss(int, int, int, java.lang.Object, danger.app.Listener) and getAutoDismissEvent() instead.
protected  int m_autoDismissMS
          Deprecated. Use setAutoDismiss(int, int, int, java.lang.Object, danger.app.Listener) and getAutoDismissMS() instead.
protected  Timer m_autoDismissTimer
          Deprecated. For internal use only.
protected  boolean m_forceNoButtons
          Deprecated. Use setForceNoButtons(boolean) instead.
static int MAX_BITMAP_SIZE
          Maximum pixels per side for the bitmap.
protected  ImageView mImageView
          Deprecated. Use getImageView() instead.
protected  int mImageViewHeight
          Deprecated. Use getImageView() and View.getHeight() instead.
protected  int mImageViewWidth
          Deprecated. Use getImageView() and View.getWidth() instead.
protected  StaticTextBox mMessageView
          Deprecated. Use getMessageView() instead.
protected  boolean mNeedLayout
          Deprecated. For internal use only.
protected  ScrollView mScrollView
          Deprecated. Use getScrollView() instead.
protected static int TOP_ICON_MARGIN
          Deprecated. For internal use only.
 
Fields inherited from class danger.ui.DialogWindow
APP_ALERT_STYLE, APP_DIALOG_STYLE, BOTTOM_POSITION1, BOTTOM_POSITION2, BOTTOM_POSITION3, BUTTON_HEIGHT, m_autoCenter, m_bottomBorder, m_leftBorder, m_rightBorder, m_showTone, m_showToneID, m_toneAlarm, m_topBorder, mAutoSizeHeight, mAutoSizeWidth, MAX_BOTTOM_BUTTONS, MAX_BUTTONS, mBackEvent, mButtonIDs, mButtons, mCancelEvent, mCenterTitle, mDefaultButton, mDefaultButtonPosition, mHideOnButton, mLayoutButtonsVertically, mListener, mNeedToAddBottomFrameButtons, mNeedToAddTopFrameButtons, mRegisteredForKeyGuardEvent, mShortcutModifiers, mShortcuts, SHOW_STATE_HIDDEN, SHOW_STATE_SHOWING, SHOW_STATE_VISIBLE, SYSTEM_ALERT_TYPE_ALARM, SYSTEM_ALERT_TYPE_CONTROL, SYSTEM_ALERT_TYPE_GENERAL, SYSTEM_ALERT_TYPE_INCOMING_CALL, SYSTEM_ALERT_TYPE_MISSED_CALL, SYSTEM_ALERT_TYPE_PERSISTENT_CONTROL, SYSTEM_DIALOG_STYLE, SYSTEM_ERROR_STYLE, TOP_POSITION1, TOP_POSITION2
 
Fields inherited from class danger.ui.Window
mBusyPaintCount, mDefaultListener, STATE_AUTO_HIDE_IF_IDLE, STATE_DROP_ORPHANED_EVENTS, STATE_FULLSCREEN, STATE_UNUSED1
 
Fields inherited from class danger.ui.View
DEFAULT_SCROLL_FOCUS_MARGIN, FOCUS_DEFAULT, FOCUS_DOWNWARD, FOCUS_LEFTWARD, FOCUS_NONE, FOCUS_RIGHTWARD, FOCUS_UPWARD, mOriginX, mOriginY, mStyle, POSITION_ABOVE, POSITION_ALIGN_BASELINE, POSITION_ALIGN_BOTTOM, POSITION_ALIGN_HORIZONTALLY, POSITION_ALIGN_LEFT, POSITION_ALIGN_PARENT_BOTTOM, POSITION_ALIGN_PARENT_RIGHT, POSITION_ALIGN_RIGHT, POSITION_ALIGN_TOP, POSITION_ALIGN_VERTICALLY, POSITION_BELOW, POSITION_CENTER_HORIZONTALLY, POSITION_CENTER_VERTICALLY, POSITION_TO_LEFT, POSITION_TO_RIGHT, PREFER_DIRECTION_NONE, PREFER_HORIZONTAL_DIRECTION, PREFER_VERTICAL_DIRECTION, STATE_AT_AND_SPACE_PAGE, STATE_CAN_FOCUS, STATE_DEBUG_BOUNDS, STATE_ENABLED, STATE_FOCUSED, STATE_MAKE_DING, STATE_PARTIAL_FOCUS_OK, STATE_TRANSPARENT, STATE_VISIBLE, WIDTH_FILL_TO_RIGHT
 
Constructor Summary
AlertWindow()
          Constructs an alert window with with the DialogWindow.APP_DIALOG_STYLE style and no title, message, or cancel button
AlertWindow(CharSequence message)
          Constructs an alert window with the DialogWindow.APP_DIALOG_STYLE style and no title or cancel button
AlertWindow(CharSequence message, boolean showCancel)
          Constructs an alert window with the DialogWindow.APP_DIALOG_STYLE style and no title.
AlertWindow(String message)
          Constructs an alert window with the DialogWindow.APP_DIALOG_STYLE style and no title or cancel button
AlertWindow(String message, boolean showCancel)
          Constructs an alert window with the DialogWindow.APP_DIALOG_STYLE style and no title.
AlertWindow(String title, CharSequence message)
          Constructs an alert window with the DialogWindow.APP_DIALOG_STYLE style and no cancel button
AlertWindow(String title, CharSequence message, boolean showCancel)
          Constructs an alert window with the DialogWindow.APP_DIALOG_STYLE style.
AlertWindow(String title, CharSequence message, boolean showCancel, int windowStyle)
          Constructs an alert window with the specified message and title.
AlertWindow(String title, String message)
          Constructs an alert window with the DialogWindow.APP_DIALOG_STYLE style and no cancel button
AlertWindow(String title, String message, boolean showCancel)
          Constructs an alert window with the DialogWindow.APP_DIALOG_STYLE style.
AlertWindow(String title, String message, boolean showCancel, int windowStyle)
          Constructs an alert window with the specified message and title.
 
Method Summary
 void addChildBelowMessageArea(View child, int hOffset, int vOffset)
          Add a child below the alert's icon and message.
 boolean getAutoDismiss()
          Get whether the alert is self-dismissing or not.
 Event getAutoDismissEvent()
          Get the event to be sent when the alert auto-dismisses.
 int getAutoDismissMS()
          Get the number of milliseconds this alert is to be displayed before auto-dismissing.
 Bitmap getBitmap()
          Get the bitmap for the alert.
 boolean getForceNoButtons()
          Return the value set by setForceNoButtons(boolean).
 ImageView getImageView()
          Returns the ImageView containing the bitmap.
protected  int getMaxMessageHeight()
          Get the maximum height that can be used for the message.
 String getMessage()
          Get the message for the alert.
 Font getMessageFont()
          Get the message font for the alert.
 CharSequence getMessageSequence()
           
 StaticTextBox getMessageView()
          Returns the StaticTextBox containing the message.
 ScrollView getScrollView()
          If the message is too large to fit on the screen, then the alert will automatically use this ScrollView, and place the message view (getMessageView()) inside it.
 Bitmap getSleepScreenImage()
          Get the message to image in the sleep screen.
 String getSleepScreenMessage()
          Deprecated. Use getSleepScreenMessageCharSequence instead
 CharSequence getSleepScreenMessageCharSequence()
          Return the sleep screen message for this alert.
protected  boolean layout()
          Positions and adds the alert's contents.
protected  void layoutBitmap(Rect contentRect)
          Lay out the alert bitmap.
protected  int layoutMessage(int textColLeft, int textColWidth, int textTop, int minBottom)
          Lay out the alert message.
protected  void onHide()
          This method is called when this view is hidden, via the method View.hide().
 void paint(Pen pen)
          Draw the contents of this View.
 boolean receiveEvent(Event e)
          Receive an event from the alert window.
protected  void removeContentChildren()
          Remove the alert's children.
 void setAutoDismiss(int ms, Event event)
          Specify that this alert should auto-dismiss after the given number of milliseconds.
 void setAutoDismiss(int ms, int eventType, int eventData, Object eventArg, Listener listener)
          Specify that this alert should auto-dismiss.
 void setBitmap(Bitmap inBitmap)
          Set the bitmap for the alert.
 void setForceNoButtons(boolean noButtons)
          Specify whether to force this alert not to have any buttons.
 void setMessage(CharSequence msg)
          Set the message for the alert window.
 void setMessage(String msg)
          Set the message for the alert window.
 void setMessageFont(Font inFont)
          Set the font of the message in the alert window.
 void setMessageFormatDate(Date inDate)
          Set the format date for the message.
 void setMessageFormatText(CharSequence[] inArgs)
          See setMessageFormatText(String inArg0)
 void setMessageFormatText(String inArg0)
          Set the format text for the message.
 void setMessageFormatText(String[] inArgs)
          See setMessageFormatText(String inArg0)
 void setMessageFormatText(String inArg0, String inArg1)
          See setMessageFormatText(String inArg0)
 void setMessageFormatText(String inArg0, String inArg1, String inArg2)
          See setMessageFormatText(String inArg0)
 void setWindowStyle(int style)
          Set the dialog window style.
protected  void showInternal()
          Actually shows the dialog.
 
Methods inherited from class danger.ui.DialogWindow
activateFrameButton, addBottomFrameButton, addBottomFrameButton, addBottomFrameButtons, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addFrameButton, addTopFrameButton, addTopFrameButton, addTopFrameButtons, blocksChooser, calcBottom, convertShortcutKeyToButtonIndex, convertShortcutKeyToButtonIndex, disableBottomRightButtonOnEmptyField, disableButtonOnEmptyField, drawDialogStyleFrame, eventKeyUp, eventShortcut, eventWidgetDown, eventWidgetUp, getCancelButton, getChildWithID, getContentRect, getDefaultFrameButton, getDescendantWithID, getFrameButtonWithID, getNumTopFrameButtons, getShowState, getTitle, getTitleBarHeight, getTitleFont, getTitleSequence, getWidthToFitTitle, getWindowStyle, handleButtonShortcut, handleFrameButtonShortcut, handleShortcutKey, hasVisibleFrameButtons, hide, layoutTopFrameButtons, positionDialog, reflowFrameButtons, removeAllChildren, removeFrameButtonWithID, setAutoCenter, setAutoSize, setAutoSizeHeight, setAutoSizeWidth, setBackEvent, setBorders, setCancelButtonEvent, setCenterTitle, setContentSize, setDefaultFrameButton, setDefaultFrameButton, setDrawBottomFrame, setEventForControlWithID, setEventForFrameButtonWithID, setFocusedChild, setFocusedDescendant, setForceDrawBottomFrame, setFrameButtonShortcut, setFrameButtonShortcut, setHideOnButtonEvent, setHideOnButtonWithID, setHideOnButtonWithPosition, setLayoutBottomFrameButtonsVertically, setListener, setNoDefaultFrameButton, setShowCancel, setShowTone, setShowTone, setSize, setSleepScreenMessage, setSleepScreenMessage, setTitle, setTitle, setWidthToFitTitle, show, show, show, snapToChildren, startShowTone, stopShowTone, updateBottomButtonWidths, updateFrameButtonColors, wantsEndButton, wantsSendButton
 
Methods inherited from class danger.ui.Window
adjustActionMenuState, advanceFocus, autoHide, autoHideIfIdle, autoHideIfIdle, blocksBackButton, blocksFloatingControls, blocksKeyGuard, blocksVolumeButtons, centerHorizontal, centerOnScreen, centerUnderTitleBar, centerVertical, disableControlWithID, dropOrphanedEvents, enableControlWithID, forwardQueuedEvents, getApplication, getDefaultFocus, getIDOfChild, getListener, getWindowBelow, hideActiveMenu, hideControlWithID, incrementMaxChildID, isActionMenuVisible, isFullScreen, isUnresponsive, onActivate, onDeactivate, onPeriodicPulse, onWindowPaint, receiveMessage, reverseFocus, setDefaultFocus, setDefaultListener, setEventArgForControlWithID, setFullScreen, setMaxChildID, setMaxControlID, setPosition, setTitled, setTitleFormatDate, setTitleFormatText, setTitleFormatText, setTitleFormatText, setTitleFormatText, setTitleFormatText, shouldDropEvent, showControlWithID, startQueueingEvents, willPassEventToWindow
 
Methods inherited from class danger.ui.Container
addChild, addChild, addChildAt, addChildAt, addFromContainerResource, addFromContainerResource, addFromContainerResource, addFromDialogResource, addFromDialogResource, advanceFocusInWindow, childCount, childIsOnScreen, disable, enable, eventKeyDown, eventKeyHeld, eventKeyRepeat, eventPeriodicPulse, eventRawKeyDown, eventRawKeyHeld, eventRawKeyRepeat, eventRawKeyUp, eventWidgetHeld, focusedDescendantIsValid, getBottomChild, getBottomChild, getChildAt, getChildIndex, getControlWithID, getFirstChild, getFirstFocusableChild, getFocusableChildInWindow, getFocusedChild, getFocusedLeaf, getInterestingRect, getLastChild, getLastFocusableChild, getLeftMostChild, getNextFocusableChild, getNextFocusableChild, getPageHeight, getPrevFocusableChild, getPrevFocusableChild, getRightMostChild, getRightMostChild, hideAllChildren, isDescendant, keepRectInView, loseFocus, moveChildToIndex, onChildPositionChanged, onChildSizeChanged, onChildVisibilityChanged, pageToEnd, pageToHome, paintChildren, reflowChildren, removeChild, setFocusedChild, setFocusedChild, setFocusedDescendant, setFocusedDescendant, setFocusToFirstDescendant, setFormatDateForControlWithID, setFormatDateForTextControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setListenerForAllControls, setReflowAdjustHeight, setWindow, showAllChildren, snapHeightToChildren, snapHeightToChildren, snapWidthToChildren, snapWidthToChildren, takeFocus, willFocusWithin, willFocusWithin
 
Methods inherited from class danger.ui.View
boundsIntersect, boundsIntersect, canLoseFocus, clear, clear, copyStyle, getAcceptFocus, getBackgroundColor, getBottom, getBounds, getBounds, getFocusTraversalDirection, getFocusTraversalFrom, getFocusTraversalPolicy, getFrame, getFrame, getGlobalBottom, getGlobalLeft, getGlobalRight, getGlobalTop, getHeight, getID, getInterestingRect, getLabelFont, getLabelFont, getLeft, getOrigin, getOrigin, getOriginX, getOriginY, getParent, getParentContainer, getPartialFocusOK, getRight, getScrollFocusMargin, getSibling, getState, getStyle, getStyleColor, getStyleFont, getTop, getWidth, getWindow, globalToLocal, globalToLocalH, globalToLocalV, invalidate, invalidate, invalidate, invalidateIndependentOfOrigin, invalidateIndependentOfOrigin, isEnabled, isFocusable, isFocused, isOnScreen, isTransparent, isVisible, isVisibleInHierarchy, isVisibleOnScreen, justSetVisible, localToGlobal, localToGlobal, localToGlobalH, localToGlobalV, localToWindow, moveBy, notifyWhenParentSizeChanges, notifyWhenPositionChanges, notifyWhenSizeChanges, offsetOrigin, offsetOrigin, onAddedToParent, onDecoded, onEnabledStateChanged, onPositionChanged, onRemovedFromParent, onShortcut, onShortcut, onShortcutConsumed, onShow, onSizeChanged, onStyleChanged, onViewPositionChanged, onViewSizeChanged, playLimitSound, receiveEventInternal, resetOrigin, sendEventToWindow, setAcceptFocus, setAtAndSpacePage, setBackground, setBackgroundColor, setBottom, setDebugBounds, setDynamicPosition, setDynamicWidth, setEnabled, setFocusTraversalDirection, setFocusTraversalFrom, setFocusTraversalPolicy, setFrame, setHeight, setKeyedValue, setLabelFont, setLeft, setMakeLimitNoise, setOrigin, setOrigin, setPartialFocusOK, setPreferredDirection, setRight, setScrollFocusMargin, setStyle, setStyleColor, setStyleFont, setStyleFrameColor, setTop, setTransparent, setVisible, setWidth, showContextMenu, styleIsDefault, swapStyleColors, windowToLocal
 
Methods inherited from class danger.app.Listener
cancelEvents, childEventPump, childEventPumpDone, eventProblem, isDispatchingThread, sendEvent, sendEvent, sendEvent, sendEvent, sendEvent, sendLowPriorityEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mImageViewWidth

protected int mImageViewWidth
Deprecated. Use getImageView() and View.getWidth() instead.

mImageViewHeight

protected int mImageViewHeight
Deprecated. Use getImageView() and View.getHeight() instead.

mNeedLayout

protected boolean mNeedLayout
Deprecated. For internal use only.

m_forceNoButtons

protected boolean m_forceNoButtons
Deprecated. Use setForceNoButtons(boolean) instead.

m_autoDismissEvent

protected Event m_autoDismissEvent
Deprecated. Use setAutoDismiss(int, int, int, java.lang.Object, danger.app.Listener) and getAutoDismissEvent() instead.

m_autoDismiss

protected boolean m_autoDismiss
Deprecated. Use setAutoDismiss(int, int, int, java.lang.Object, danger.app.Listener) and getAutoDismiss() instead.

m_autoDismissMS

protected int m_autoDismissMS
Deprecated. Use setAutoDismiss(int, int, int, java.lang.Object, danger.app.Listener) and getAutoDismissMS() instead.

m_autoDismissTimer

protected Timer m_autoDismissTimer
Deprecated. For internal use only.

mImageView

protected ImageView mImageView
Deprecated. Use getImageView() instead.

mMessageView

protected StaticTextBox mMessageView
Deprecated. Use getMessageView() instead.

mScrollView

protected ScrollView mScrollView
Deprecated. Use getScrollView() instead.

MAX_BITMAP_SIZE

public static final int MAX_BITMAP_SIZE
Maximum pixels per side for the bitmap.

See Also:
Constant Field Values

TOP_ICON_MARGIN

protected static final int TOP_ICON_MARGIN
Deprecated. For internal use only.
See Also:
Constant Field Values

IMAGE_TEXT_GAP

protected static final int IMAGE_TEXT_GAP
Deprecated. For internal use only.
See Also:
Constant Field Values

GAP3

protected static final int GAP3
Deprecated. For internal use only.
See Also:
Constant Field Values
Constructor Detail

AlertWindow

public AlertWindow()
Constructs an alert window with with the DialogWindow.APP_DIALOG_STYLE style and no title, message, or cancel button


AlertWindow

public AlertWindow(String message)
Constructs an alert window with the DialogWindow.APP_DIALOG_STYLE style and no title or cancel button


AlertWindow

public AlertWindow(CharSequence message)
Constructs an alert window with the DialogWindow.APP_DIALOG_STYLE style and no title or cancel button


AlertWindow

public AlertWindow(String title,
                   String message)
Constructs an alert window with the DialogWindow.APP_DIALOG_STYLE style and no cancel button


AlertWindow

public AlertWindow(String title,
                   CharSequence message)
Constructs an alert window with the DialogWindow.APP_DIALOG_STYLE style and no cancel button


AlertWindow

public AlertWindow(String message,
                   boolean showCancel)
Constructs an alert window with the DialogWindow.APP_DIALOG_STYLE style and no title.


AlertWindow

public AlertWindow(CharSequence message,
                   boolean showCancel)
Constructs an alert window with the DialogWindow.APP_DIALOG_STYLE style and no title.


AlertWindow

public AlertWindow(String title,
                   String message,
                   boolean showCancel)
Constructs an alert window with the DialogWindow.APP_DIALOG_STYLE style.


AlertWindow

public AlertWindow(String title,
                   CharSequence message,
                   boolean showCancel)
Constructs an alert window with the DialogWindow.APP_DIALOG_STYLE style.


AlertWindow

public AlertWindow(String title,
                   String message,
                   boolean showCancel,
                   int windowStyle)
Constructs an alert window with the specified message and title.

Creates an alert window. All constructors create an alert window with an OK button in the bottom right, with BACK as the shortcut. The alert window is not displayed until its show method is called.

Parameters:
title - A String containing the title of the alert
message - A String containing the alert message to be displayed.
showCancel - whether to display the cancel button or not. If displayed, it will appear in the upper right of the dialog, and will not have a shortcut.
windowStyle - one of DialogWindow.APP_DIALOG_STYLE, DialogWindow.APP_ALERT_STYLE, DialogWindow.SYSTEM_DIALOG_STYLE, DialogWindow.SYSTEM_ERROR_STYLE. See DialogWindow.setWindowStyle(int).

AlertWindow

public AlertWindow(String title,
                   CharSequence message,
                   boolean showCancel,
                   int windowStyle)
Constructs an alert window with the specified message and title.

Creates an alert window. All constructors create an alert window with an OK button in the bottom right, with BACK as the shortcut. The alert window is not displayed until its show method is called.

Parameters:
title - A String containing the title of the alert
message - A String containing the alert message to be displayed.
showCancel - whether to display the cancel button or not. If displayed, it will appear in the upper right of the dialog, and will not have a shortcut.
windowStyle - one of DialogWindow.APP_DIALOG_STYLE, DialogWindow.APP_ALERT_STYLE, DialogWindow.SYSTEM_DIALOG_STYLE, DialogWindow.SYSTEM_ERROR_STYLE. See DialogWindow.setWindowStyle(int).
Method Detail

setBitmap

public void setBitmap(Bitmap inBitmap)
Set the bitmap for the alert. The bitmap will be displayed in the upper left of the alert.

The bitmap can be no larger than MAX_BITMAP_SIZE x MAX_BITMAP_SIZE (64x64).

If setBitmap is not called, then a default icon will be used. The default icon depends on whether the alert is a system alert or application alert. If you do not want a default bitmap to be displayed, then call setBitmap(null).

Parameters:
inBitmap - the bitmap to be used

getBitmap

public Bitmap getBitmap()
Get the bitmap for the alert. This will either return the value used in setBitmap(danger.ui.Bitmap), or it will return the default icon that will be used if setBitmap(danger.ui.Bitmap) has not been called.

Returns:
the bitmap that will be displayed

setMessage

public void setMessage(String msg)
Set the message for the alert window. This method sets the message that will be displayed in the alert window. Use this method before calling DialogWindow.show() to display the window.

Parameters:
msg - A String containing the message to be displayed in the alert window.

setMessage

public final void setMessage(CharSequence msg)
Set the message for the alert window.

This method sets the message that will be displayed in the alert window. Use this method before calling DialogWindow.show() to display the window.

Parameters:
msg - The message to be displayed in the alert window.
Since:
2.3

getSleepScreenMessage

public String getSleepScreenMessage()
Deprecated. Use getSleepScreenMessageCharSequence instead

Overrides:
getSleepScreenMessage in class DialogWindow

getSleepScreenMessageCharSequence

public CharSequence getSleepScreenMessageCharSequence()
Return the sleep screen message for this alert. If the sleep screen message has not been set by using DialogWindow.setSleepScreenMessage(java.lang.String), then the alert message (as set by setMessage(java.lang.String) is returned.

Overrides:
getSleepScreenMessageCharSequence in class DialogWindow
Returns:
the message to display on the sleep screen when this dialog is up while the device is in keyguard mode
Since:
3.0

getMessage

public String getMessage()
Get the message for the alert.

Returns:
the message that will be displayed

getMessageSequence

public CharSequence getMessageSequence()

setMessageFont

public void setMessageFont(Font inFont)
Set the font of the message in the alert window. This method sets the font of the message that will be displayed in the alert window.

Parameters:
inFont - A font object.

getMessageFont

public Font getMessageFont()
Get the message font for the alert.

Returns:
the font that will be used to display the message

getImageView

public final ImageView getImageView()
Returns the ImageView containing the bitmap.

Since:
3.0

getMessageView

public final StaticTextBox getMessageView()
Returns the StaticTextBox containing the message.

Since:
3.0

getScrollView

public final ScrollView getScrollView()
If the message is too large to fit on the screen, then the alert will automatically use this ScrollView, and place the message view (getMessageView()) inside it.

Since:
3.0

setWindowStyle

public void setWindowStyle(int style)
Set the dialog window style. If setBitmap(danger.ui.Bitmap) has not been called, then this will result in a call to setBitmap(danger.ui.Bitmap) to set the default icon for this dialog.

Overrides:
setWindowStyle in class DialogWindow
Parameters:
style - the window style. This should be one of DialogWindow.APP_DIALOG_STYLE, DialogWindow.APP_ALERT_STYLE, DialogWindow.SYSTEM_DIALOG_STYLE, or DialogWindow.SYSTEM_ERROR_STYLE.
See Also:
DialogWindow.setWindowStyle(int)

setForceNoButtons

public void setForceNoButtons(boolean noButtons)
Specify whether to force this alert not to have any buttons. By default, an alert has at least an OK button. Calling setForceNoButtons(true) cause the OK button not to be added. NOTE: This method does NOT prevent the cancel button from being added. Use DialogWindow.setShowCancel(boolean) if needed.

Parameters:
noButtons - if true, specifies that there should not be any buttons in this alert

getForceNoButtons

public final boolean getForceNoButtons()
Return the value set by setForceNoButtons(boolean).

Since:
3.0

setAutoDismiss

public void setAutoDismiss(int ms,
                           int eventType,
                           int eventData,
                           Object eventArg,
                           Listener listener)
Specify that this alert should auto-dismiss.

A convenience method which just calls setAutoDismiss(int ms, Event event). Specify 0 for the eventType if you do not wish to specify an event.

Parameters:
ms - number of milliseconds after which to automatically dismiss this alert.
eventType - the event type
eventData - the event data
eventArg - the event argument
listener - the event listener

setAutoDismiss

public void setAutoDismiss(int ms,
                           Event event)
Specify that this alert should auto-dismiss after the given number of milliseconds.

After the specified time, or when the user hits a key or button (whichever comes first), the alert will automatically dismiss, and the specified event will be sent.

This method must be called before calling DialogWindow.show().

Parameters:
ms - number of milliseconds after which to automatically dismiss this alert.
event - null-ok; the event to send when this alert is dismissed.

getAutoDismiss

public final boolean getAutoDismiss()
Get whether the alert is self-dismissing or not. See setAutoDismiss(int,int,int,Object,Listener) and setAutoDismiss(int,Event).

Since:
3.0

getAutoDismissMS

public final int getAutoDismissMS()
Get the number of milliseconds this alert is to be displayed before auto-dismissing. This value is irrelevant if getAutoDismiss() is false. See setAutoDismiss(int,int,int,Object,Listener) and setAutoDismiss(int,Event).

Since:
3.0

getAutoDismissEvent

public final Event getAutoDismissEvent()
Get the event to be sent when the alert auto-dismisses. See setAutoDismiss(int,int,int,Object,Listener) and setAutoDismiss(int,Event).

Since:
3.0

getMaxMessageHeight

protected int getMaxMessageHeight()
Get the maximum height that can be used for the message.

Returns the height which is the maximum height of the alert, minus the frames and any frame buttons.

Returns:
the maximum height than can be used for the message

layoutBitmap

protected void layoutBitmap(Rect contentRect)
Lay out the alert bitmap.

Generally, you should not have to call or override this method.

This method is automatically called from layout() to position and add the alert bitmap.

Note: It is not safe to call this method while the alert is already visible. You should ensure that the alert is hidden (or not yet shown) before calling this method.

Parameters:
contentRect - the content rect of the window, obtained by a call to (@link DialogWindow#getContentRect}.

layoutMessage

protected int layoutMessage(int textColLeft,
                            int textColWidth,
                            int textTop,
                            int minBottom)
Lay out the alert message.

Generally, you should not have to call or override this method.

This method is automatically called from layout() to position and add the alert message.

Note: It is not safe to call this method while the alert is already visible. You should ensure that the alert is hidden (or not yet shown) before calling this method.

Parameters:
textColLeft - the left edge of the message text
textColWidth - the width of the message text
textTop - the top edge of the message text
minBottom - the bottom edge of the alert bitmap. If the message is short than the image, then the message is centered to the image.
Returns:
the height of the message

addChildBelowMessageArea

public void addChildBelowMessageArea(View child,
                                     int hOffset,
                                     int vOffset)
Add a child below the alert's icon and message. Use this instead of Container.addChild(danger.ui.View) to add a child to an AlertWindow.

Note: Be sure to set the size of the child before making this call.

Parameters:
child - the child to add
hOffset - the horizontal offset of the child, relative to the left edge of the message area. If there is an icon, then the offset is relative to the left edge of the icon. Positive offsets move the child to the right.
vOffset - the vertical offset of the child, relative to the bottom edge of the message area. If the message is taller than the icon, then the offset is relative to the bottom edge of the message. Positive offsets move the child down.

removeContentChildren

protected void removeContentChildren()
Remove the alert's children.

This method does not remove the frame buttons. It will remove the alert message, bitmap, and scroll view (if any).

Note: It is not safe to call this method while the alert is already visible. You should ensure that the alert is hidden (or not yet shown) before calling this method.


paint

public void paint(Pen pen)
Description copied from class: View
Draw the contents of this View. This method is called by the graphics system when the View needs to be repainted. A Pen will be provided which is appropriately clipped and translated for drawing on this View.

The implementation of this method in this class will merely call clear() pen, if this View is opaque (not transparent), and will do nothing otherwise. If you don't need this behavior, then there is no point in calling super.paint() in an overriding method.

Overrides:
paint in class DialogWindow
Parameters:
pen - non-null; the pen to use for drawing operations
See Also:
View.paint(danger.ui.Pen)

layout

protected boolean layout()
Positions and adds the alert's contents.

This method positions and adds the alert's message, bitmap, and OK button (if any).

It calls removeContentChildren(), layoutBitmap(danger.ui.Rect), and layoutMessage(int, int, int, int).

Generally, you should not have to call or override this method. It is called automatically in showInternal().

Note: It is not safe to call this method while the alert is already visible. You should ensure that the alert is hidden (or not yet shown) before calling this method.

Returns:
this method always returns true

receiveEvent

public boolean receiveEvent(Event e)
Receive an event from the alert window.

Called whenever the alert window receives an event. The default behavior is to create and send an event to the listener for the alert window. Override this method to receive and process the events yourself.

Overrides:
receiveEvent in class DialogWindow
Parameters:
e - An Event containing the event received.
Returns:
whether (true) or not (false) this method actually handled the event to completion
See Also:
Listener.receiveEvent(danger.app.Event)

onHide

protected void onHide()
Description copied from class: View
This method is called when this view is hidden, via the method View.hide(). It is called as the very last thing done by that method, and it is only ever called if the view was not already hidden. Overriding this method is the recommended way to get special behavior when a view gets hidden . The implementation in this class does nothin.

Overrides:
onHide in class View

showInternal

protected void showInternal()
Description copied from class: DialogWindow
Actually shows the dialog. showInternal is called by DialogWindow.show() if the dialog is an application dialog. Otherwise, it is called indirectly by the Notification Manager when it is time to show the dialog. Generally, you should not have to call or override this method.

Overrides:
showInternal in class DialogWindow
See Also:
DialogWindow.showInternal()

getSleepScreenImage

public Bitmap getSleepScreenImage()
Get the message to image in the sleep screen.

The image returned by this method is displayed if this is a system alert and the device is in keyguard mode. The image is displayed alongside the message returned by getSleepScreenMessage().

It is automatically called by the Notification Manager.

It returns the value of getBitmap(). Over-ride if you want to display a different image in the sleep screen.

Overrides:
getSleepScreenImage in class DialogWindow
Returns:
the sleep screen image.

setMessageFormatText

public void setMessageFormatText(String inArg0)
Set the format text for the message. The argument will be substituted for any instance of ^0 in the message. For example, if the message is currently: "Delete '^0'" and you call setMessageFormatText("Buddies"), then the message will become "Delete 'Buddies'". NOTE: This can only be called once as the ^0 in the format string is replaced with the value of inArg0.

Parameters:
inArg0 - the argument to replace ^0 with.
See Also:
StringFormat

setMessageFormatText

public void setMessageFormatText(String inArg0,
                                 String inArg1)
See setMessageFormatText(String inArg0)

Parameters:
inArg0 - the argument to replace ^0 with.
inArg1 - the argument to replace ^1 with.
See Also:
StringFormat

setMessageFormatText

public void setMessageFormatText(String inArg0,
                                 String inArg1,
                                 String inArg2)
See setMessageFormatText(String inArg0)

Parameters:
inArg0 - the argument to replace ^0 with.
inArg1 - the argument to replace ^1 with.
inArg2 - the argument to replace ^2 with.
See Also:
StringFormat

setMessageFormatText

public void setMessageFormatText(String[] inArgs)
See setMessageFormatText(String inArg0)

Parameters:
inArgs - the arguments to replace ^0, ^1, etc. with.
See Also:
StringFormat

setMessageFormatText

public void setMessageFormatText(CharSequence[] inArgs)
See setMessageFormatText(String inArg0)

Parameters:
inArgs - the arguments to replace ^0, ^1, etc. with.
See Also:
StringFormat

setMessageFormatDate

public void setMessageFormatDate(Date inDate)
Set the format date for the message.

Parameters:
inDate - the date to use
See Also:
DateFormat