|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdanger.app.Listener
danger.ui.View
danger.ui.Container
danger.ui.Window
danger.ui.DialogWindow
public class DialogWindow
Standard dialog window.
This window class has the standard look and feel of dialog windows, including the title, frame, and frame buttons.
| Field Summary | |
|---|---|
static int |
APP_ALERT_STYLE
Constant to be used with setWindowStyle(int) or
a constructor. |
static int |
APP_DIALOG_STYLE
Constant to be used with setWindowStyle(int) or
a constructor. |
static int |
BOTTOM_POSITION1
Specifies the bottom rightmost frame button position. |
static int |
BOTTOM_POSITION2
Specifies the bottom middle frame button position. |
static int |
BOTTOM_POSITION3
Specifies the bottom leftmost frame button position. |
protected static int |
BUTTON_HEIGHT
Deprecated. For internal use only. |
protected boolean |
m_autoCenter
Deprecated. Use setAutoCenter(boolean) instead. |
protected int |
m_bottomBorder
Deprecated. Use setBorders(int, int, int, int) instead. |
protected int |
m_leftBorder
Deprecated. Use setBorders(int, int, int, int) instead. |
protected int |
m_rightBorder
Deprecated. Use setBorders(int, int, int, int) instead. |
protected RingToneObject |
m_showTone
Deprecated. Use setShowTone(danger.audio.RingToneObject) instead. |
protected int |
m_showToneID
Deprecated. Use setShowTone(int) instead. |
protected Alarm |
m_toneAlarm
Deprecated. For internal use only. |
protected int |
m_topBorder
Deprecated. Use setBorders(int, int, int, int) instead. |
protected boolean |
mAutoSizeHeight
Deprecated. Use setAutoSize(boolean) or setAutoSizeHeight(boolean) instead. |
protected boolean |
mAutoSizeWidth
Deprecated. Use setAutoSize(boolean) or setAutoSizeWidth(boolean) instead. |
protected static int |
MAX_BOTTOM_BUTTONS
Deprecated. For internal use only. |
protected static int |
MAX_BUTTONS
Deprecated. For internal use only. |
protected Event |
mBackEvent
Deprecated. Use setBackEvent(danger.app.Event) instead. |
protected int[] |
mButtonIDs
Deprecated. For internal use only. |
protected Button[] |
mButtons
Deprecated. For internal use only. |
protected Event |
mCancelEvent
Deprecated. Use setCancelButtonEvent(danger.app.Event) instead. |
protected boolean |
mCenterTitle
Deprecated. Use setCenterTitle(boolean) instead. |
protected Button |
mDefaultButton
Deprecated. Use setDefaultFrameButton(Button) instead. |
protected int |
mDefaultButtonPosition
Deprecated. Use setDefaultFrameButton(int) instead. |
protected boolean[] |
mHideOnButton
Deprecated. Use setHideOnButtonEvent(boolean),
setHideOnButtonWithID(int,boolean) or
setHideOnButtonWithPosition(int,boolean) instead. |
protected boolean |
mLayoutButtonsVertically
Deprecated. Use setLayoutBottomFrameButtonsVertically(boolean) instead. |
protected Listener |
mListener
Deprecated. Use setListener(danger.app.Listener) instead. |
protected boolean |
mNeedToAddBottomFrameButtons
Deprecated. For internal use only. |
protected boolean |
mNeedToAddTopFrameButtons
Deprecated. For internal use only. |
protected boolean |
mRegisteredForKeyGuardEvent
Deprecated. For internal use only. |
protected int[] |
mShortcutModifiers
Deprecated. For internal use only. |
protected char[] |
mShortcuts
Deprecated. For internal use only. |
static int |
SHOW_STATE_HIDDEN
Constant returned by getShowState(). |
static int |
SHOW_STATE_SHOWING
Constant returned by getShowState(). |
static int |
SHOW_STATE_VISIBLE
Constant returned by getShowState(). |
static int |
SYSTEM_ALERT_TYPE_ALARM
Constant to be used with show(int). |
static int |
SYSTEM_ALERT_TYPE_CONTROL
Constant to be used with show(int). |
static int |
SYSTEM_ALERT_TYPE_GENERAL
Constant to be used with show(int). |
static int |
SYSTEM_ALERT_TYPE_INCOMING_CALL
Constant to be used with show(int). |
static int |
SYSTEM_ALERT_TYPE_MISSED_CALL
Constant to be used with show(int). |
static int |
SYSTEM_ALERT_TYPE_PERSISTENT_CONTROL
Constant to be used with show(int). |
static int |
SYSTEM_DIALOG_STYLE
Constant to be used with setWindowStyle(int) or
a constructor. |
static int |
SYSTEM_ERROR_STYLE
Constant to be used with setWindowStyle(int) or
a constructor. |
static int |
TOP_POSITION1
Specifies the top rightmost frame button position. |
static int |
TOP_POSITION2
Specifies the top leftmost frame button position. |
| Fields inherited from class danger.ui.Window |
|---|
mBusyPaintCount, mDefaultListener, STATE_AUTO_HIDE_IF_IDLE, STATE_DROP_ORPHANED_EVENTS, STATE_FULLSCREEN, STATE_UNUSED1 |
| Constructor Summary | |
|---|---|
DialogWindow()
Construct an instance. |
|
DialogWindow(boolean showCancel)
Construct an instance. |
|
DialogWindow(CharSequence inTitle)
Construct an instance. |
|
DialogWindow(CharSequence inTitle,
int windowStyle)
Construct an instance. |
|
DialogWindow(CharSequence inTitle,
int windowStyle,
boolean showCancel)
Construct an instance. |
|
DialogWindow(String inTitle)
Construct an instance. |
|
DialogWindow(String inTitle,
int windowStyle)
Construct an instance. |
|
DialogWindow(String inTitle,
int windowStyle,
boolean showCancel)
Construct an instance. |
|
| Method Summary | |
|---|---|
protected void |
activateFrameButton(int position)
Activates the frame button with the given position. |
Button |
addBottomFrameButton(CharSequence buttonStr,
int eventType,
int data,
Object arg,
char shortcut)
|
Button |
addBottomFrameButton(String buttonStr,
int eventType,
int data,
Object arg,
char shortcut)
Add a button to the dialog window. |
protected void |
addBottomFrameButtons()
Add the bottom frame buttons to the window. |
Button |
addFrameButton(int position,
CharSequence buttonStr,
int flags,
int eventType,
int eventWhat,
int data,
Object arg,
char shortcut,
int id)
|
Button |
addFrameButton(int position,
CharSequence buttonStr,
int flags,
int eventType,
int data,
Object arg,
char shortcut)
|
Button |
addFrameButton(int position,
CharSequence buttonStr,
int flags,
int eventType,
int data,
Object arg,
char shortcut,
int id)
|
Button |
addFrameButton(int position,
CharSequence buttonStr,
int eventType,
int eventWhat,
int data,
Object arg,
char shortcut,
int shortcutModifiers,
int id)
|
Button |
addFrameButton(int position,
CharSequence buttonStr,
int eventType,
int data,
Object arg)
|
Button |
addFrameButton(int position,
CharSequence buttonStr,
int eventType,
int data,
Object arg,
char shortcut)
|
Button |
addFrameButton(int position,
CharSequence buttonStr,
int eventType,
int data,
Object arg,
char shortcut,
int id)
|
Button |
addFrameButton(int position,
CharSequence buttonStr,
int eventType,
int data,
Object arg,
char shortcut,
int shortcutModifiers,
int id)
|
Button |
addFrameButton(int position,
CharSequence buttonStr,
Listener eventListener,
int eventType,
int eventWhat,
int data,
Object arg,
char shortcut,
int shortcutModifiers,
int id)
|
Button |
addFrameButton(int position,
String buttonStr,
int flags,
int eventType,
int eventWhat,
int data,
Object arg,
char shortcut,
int id)
Add a frame button to the dialog. |
Button |
addFrameButton(int position,
String buttonStr,
int flags,
int eventType,
int data,
Object arg,
char shortcut)
Add a button to the dialog window. |
Button |
addFrameButton(int position,
String buttonStr,
int flags,
int eventType,
int data,
Object arg,
char shortcut,
int id)
|
Button |
addFrameButton(int position,
String buttonStr,
int eventType,
int eventWhat,
int data,
Object arg,
char shortcut,
int shortcutModifiers,
int id)
|
Button |
addFrameButton(int position,
String buttonStr,
int eventType,
int data,
Object arg)
|
Button |
addFrameButton(int position,
String buttonStr,
int eventType,
int data,
Object arg,
char shortcut)
|
Button |
addFrameButton(int position,
String buttonStr,
int eventType,
int data,
Object arg,
char shortcut,
int id)
|
Button |
addFrameButton(int position,
String buttonStr,
int eventType,
int data,
Object arg,
char shortcut,
int shortcutModifiers,
int id)
|
Button |
addFrameButton(int position,
String buttonStr,
Listener eventListener,
int eventType,
int eventWhat,
int data,
Object arg,
char shortcut,
int shortcutModifiers,
int id)
Add a button to the dialog window. |
Button |
addTopFrameButton(CharSequence buttonStr,
int eventType,
int data,
Object arg,
char shortcut)
|
Button |
addTopFrameButton(String buttonStr,
int eventType,
int data,
Object arg,
char shortcut)
Add a top frame button to the dialog. |
protected void |
addTopFrameButtons()
Add the top frame buttons to the window. |
boolean |
blocksChooser()
Whether the window blocks from going to the chooser Some applications, such as security/passcode lock and registration block from going to the chooser when the JUMP button is pressed. |
protected int |
calcBottom()
This is called automatically to determine positions of vertical frame buttons. |
protected int |
convertShortcutKeyToButtonIndex(char key,
Event event)
This is called automatically to determine if a shortcut key matches a shortcut for a frame button. |
int |
convertShortcutKeyToButtonIndex(Event e)
This is called automatically to determine if a shortcut key matches a shortcut for a frame button. |
void |
disableBottomRightButtonOnEmptyField(TextField textField)
Specifies that the bottom right frame button should be disabled whenever the specified text field is empty. |
void |
disableButtonOnEmptyField(int buttonID,
int fieldID)
Specifies that the specified button should be disabled whenever the specified text field is empty. |
protected void |
drawDialogStyleFrame(Pen p,
int windowStyle)
Draw the frame for the dialog window. |
boolean |
eventKeyUp(char c,
Event event)
Processes key releases directed at this container. |
boolean |
eventShortcut(char shortcut,
Event event)
Handles shortcuts for frame buttons. |
boolean |
eventWidgetDown(int widget,
Event event)
Handle a button down event. |
boolean |
eventWidgetUp(int widget,
Event event)
Handle the release of a device widget |
protected Button |
getCancelButton()
This method will return the cancel button, if there is any. |
View |
getChildWithID(int id)
Get the child view with the given id. |
Rect |
getContentRect()
Get the content rect Returns the content rect of the dialog, which does not include the top or bottom frames (or frame buttons). |
Button |
getDefaultFrameButton()
Get the frame button with initial focus. |
View |
getDescendantWithID(int id)
Get the descendant view with the given id. |
protected Button |
getFrameButtonWithID(int id)
Get the frame button with the given id. |
int |
getNumTopFrameButtons()
|
int |
getShowState()
Get the show state. |
Bitmap |
getSleepScreenImage()
|
String |
getSleepScreenMessage()
Deprecated. Use getSleepScreenMessageCharSequence instead |
CharSequence |
getSleepScreenMessageCharSequence()
|
String |
getTitle()
Obtain the title of the window Obtains the title of the window that was set via a constructor or by a call to setTitle(java.lang.String) |
int |
getTitleBarHeight()
Get the height of the title bar Currently, this value is a constant. |
protected static Font |
getTitleFont()
Get the font being used for the dialog title. |
CharSequence |
getTitleSequence()
Obtain the title of the window Obtains the title of the window that was set via a constructor or by a call to setTitle(java.lang.String). |
int |
getWidthToFitTitle()
Get the dialog width that will fit the title exactly, accounting for any top frame buttons. |
int |
getWindowStyle()
|
boolean |
handleButtonShortcut(char shortcut,
Event event)
Handle shortcuts for buttons in the container. |
protected boolean |
handleFrameButtonShortcut(int position)
Handle a frame button shortcut This method is called to handle a shortcut for a particular frame button. |
boolean |
handleShortcutKey(Event e)
Handle a shortcut key event. |
boolean |
hasVisibleFrameButtons()
Determine whether this dialog has any visible frame buttons. |
void |
hide()
Hide the dialog window. |
protected void |
layoutTopFrameButtons()
This is called automatically to position the top frame buttons in the dialog. |
void |
paint(Pen pen)
Draw the contents of this View. |
protected void |
positionDialog()
This method is called to position the dialog. |
boolean |
receiveEvent(Event e)
Entry point for event processing. |
void |
reflowFrameButtons()
|
void |
removeAllChildren()
Remove all child views. |
void |
removeFrameButtonWithID(int id)
Remove a frame button. |
void |
setAutoCenter(boolean autoCenter)
Use this method to specify whether the dialog should be automatically centered in positionDialog(). |
void |
setAutoSize(boolean doAutoSize)
Specify whether the window should be automatically resized. |
void |
setAutoSizeHeight(boolean doAutoSize)
Specify whether the window's height should be set automatically. |
void |
setAutoSizeWidth(boolean doAutoSize)
Specify whether the window's width should be set automatically. |
void |
setBackEvent(Event e)
Specifies an event to send when the BACK button is pressed. |
void |
setBorders(int inLeft,
int inTop,
int inRight,
int inBottom)
Set the width of the borders. |
void |
setCancelButtonEvent(Event e)
Specifies the event to be sent when the user selects the Cancel button. |
void |
setCenterTitle(boolean center)
Set a flag that tells the dialog to center its title. |
void |
setContentSize(int width,
int height)
Resize the window Sets the size of the window such that the content rect is the given size. |
void |
setDefaultFrameButton(Button button)
Set the default frame button. |
void |
setDefaultFrameButton(int which)
Set the default frame button. |
protected void |
setDrawBottomFrame(boolean drawFrame)
Specify whether to draw the bottom frame of the dialog. |
void |
setEventForControlWithID(int id,
Event newEvent)
Set the event for the control with the given id. |
protected boolean |
setEventForFrameButtonWithID(int id,
Event newEvent)
Set the event for the frame button with the given id. |
void |
setFocusedChild(View inNewFocus)
Convenience method which simply calls setFocusedChild(newFocus,
true). |
void |
setFocusedDescendant(View inNewFocus,
boolean inFromAbove)
Set the focus for the container to be the child which is, or which has as a descendant, the given view. |
void |
setForceDrawBottomFrame(boolean drawFrame)
Specify whether the bottom frame should be drawn, even if there's nothing in the frame. |
void |
setFrameButtonShortcut(int position,
char shortcut)
Set the shortcut for a frame button The shortcut will not display or require any modifier keys (MENU, ALT, or SHIFT). |
void |
setFrameButtonShortcut(int position,
char shortcut,
int modifiers)
Set the shortcut for a frame button |
void |
setHideOnButtonEvent(boolean hide)
Use this method to specify whether the dialog should be automatically hidden when the user selects a frame button. |
void |
setHideOnButtonWithID(int id,
boolean hide)
Use this method to specify whether the dialog should be automatically hidden when the user selects the frame button with the specified id. |
void |
setHideOnButtonWithPosition(int position,
boolean hide)
Use this method to specify whether the dialog should be automatically hidden when the user selects the frame button with the specified position. |
void |
setLayoutBottomFrameButtonsVertically(boolean flag)
Layout buttons vertically instead of horizontally. |
void |
setListener(Listener inListener)
Set the listener for the dialog. |
void |
setNoDefaultFrameButton()
Specify that no frame button should be focused when the dialog is first displayed. |
void |
setShowCancel(boolean showCancel)
Specify whether a cancel button should be displayed. |
void |
setShowTone(int resourceID)
Specify a tone to play while the dialog is showing. |
void |
setShowTone(RingToneObject tone)
Specify a tone to play while the dialog is showing. |
void |
setSize(int width,
int height)
Set the size of the dialog. |
void |
setSleepScreenMessage(CharSequence message)
Set the message to display on the sleep screen when this dialog is up while the device is in keyguard mode |
void |
setSleepScreenMessage(String message)
Set the message to display on the sleep screen when this dialog is up while the device is in keyguard mode |
void |
setTitle(CharSequence inTitle)
Specifies the title of the window Sets the title to appear in the upper left of the window. |
void |
setTitle(String inTitle)
Specifies the title of the window Sets the title to appear in the upper left of the window. |
void |
setWidthToFitTitle()
Resize the window to fit the title This method changes the width of the dialog to fit the title exactly, accounting for any top frame buttons. |
void |
setWindowStyle(int windowStyle)
Set the window style. |
void |
show()
Show the dialog. |
void |
show(int alertType)
Show the dialog. |
void |
show(int alertType,
boolean withPendingSound)
Show the dialog. |
protected void |
showInternal()
Actually shows the dialog. |
void |
snapToChildren(int inLeft,
int inTop,
int inRight,
int inBottom)
Resize the dialog to fit the children, with the given gaps. |
protected void |
startShowTone()
Starts playing the tone specified with setShowTone(danger.audio.RingToneObject). |
protected void |
stopShowTone()
Stops playing the tone specified with setShowTone(danger.audio.RingToneObject). |
protected void |
updateBottomButtonWidths()
This is called automatically to set the width of the bottom frame buttons. |
protected void |
updateFrameButtonColors()
This is called automatically to change the color of the buttons depending on the window style. |
boolean |
wantsEndButton()
Whether the window wants to receive END button events instead of page down. |
boolean |
wantsSendButton()
Whether the window wants to receive SEND button events instead of page down. |
| 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 |
|---|
protected boolean mAutoSizeWidth
setAutoSize(boolean) or setAutoSizeWidth(boolean) instead.protected boolean mAutoSizeHeight
setAutoSize(boolean) or setAutoSizeHeight(boolean) instead.protected Event mBackEvent
setBackEvent(danger.app.Event) instead.protected Event mCancelEvent
setCancelButtonEvent(danger.app.Event) instead.protected int m_leftBorder
setBorders(int, int, int, int) instead.protected int m_rightBorder
setBorders(int, int, int, int) instead.protected int m_topBorder
setBorders(int, int, int, int) instead.protected int m_bottomBorder
setBorders(int, int, int, int) instead.protected boolean m_autoCenter
setAutoCenter(boolean) instead.protected RingToneObject m_showTone
setShowTone(danger.audio.RingToneObject) instead.protected int m_showToneID
setShowTone(int) instead.protected boolean mNeedToAddTopFrameButtons
protected boolean mNeedToAddBottomFrameButtons
protected Button[] mButtons
protected char[] mShortcuts
protected int[] mShortcutModifiers
protected int[] mButtonIDs
protected int mDefaultButtonPosition
setDefaultFrameButton(int) instead.protected Button mDefaultButton
setDefaultFrameButton(Button) instead.protected boolean[] mHideOnButton
setHideOnButtonEvent(boolean),
setHideOnButtonWithID(int,boolean) or
setHideOnButtonWithPosition(int,boolean) instead.protected boolean mLayoutButtonsVertically
setLayoutBottomFrameButtonsVertically(boolean) instead.protected Listener mListener
setListener(danger.app.Listener) instead.protected boolean mRegisteredForKeyGuardEvent
protected Alarm m_toneAlarm
protected boolean mCenterTitle
setCenterTitle(boolean) instead.protected static final int BUTTON_HEIGHT
public static final int BOTTOM_POSITION1
public static final int BOTTOM_POSITION2
public static final int BOTTOM_POSITION3
public static final int TOP_POSITION1
public static final int TOP_POSITION2
protected static final int MAX_BUTTONS
protected static final int MAX_BOTTOM_BUTTONS
public static final int APP_DIALOG_STYLE
setWindowStyle(int) or
a constructor.
Specifies that the window is a standard application dialog.
public static final int SYSTEM_DIALOG_STYLE
setWindowStyle(int) or
a constructor.
Specifies that the window is a system dialog, with a light blue border. System dialogs float over other all applications. They also cause a pending notification ring if the user has not turned that system setting off.
public static final int SYSTEM_ERROR_STYLE
setWindowStyle(int) or
a constructor.
Specifies that the window is a system error dialog. The only difference between this and a system dialog is that a red border appears in the dialog.
public static final int APP_ALERT_STYLE
setWindowStyle(int) or
a constructor.
Specifies that the window is an application dialog with a red border.
public static final int SYSTEM_ALERT_TYPE_GENERAL
show(int). Only relevant for
system dialogs and system error dialogs.
Specifies a general alert type.
public static final int SYSTEM_ALERT_TYPE_INCOMING_CALL
show(int). Only relevant for
system dialogs and system error dialogs.
Specifies that the dialog is a result of an incoming phone call.
public static final int SYSTEM_ALERT_TYPE_MISSED_CALL
show(int). Only relevant for
system dialogs and system error dialogs.
Specifies that the dialog is a result of a missed phone call.
public static final int SYSTEM_ALERT_TYPE_ALARM
show(int). Only relevant for
system dialogs and system error dialogs.
Specifies that the dialog is a result of a calendar alarm.
public static final int SYSTEM_ALERT_TYPE_CONTROL
show(int). Only relevant for
system dialogs and system error dialogs.
Specifies that the dialog is the sound controls dialog.
public static final int SYSTEM_ALERT_TYPE_PERSISTENT_CONTROL
show(int). Only relevant for
system dialogs and system error dialogs.
Specifies that the dialog is a persistent control. It will appear behind all other system alerts.
public static final int SHOW_STATE_HIDDEN
getShowState().
public static final int SHOW_STATE_SHOWING
getShowState().
public static final int SHOW_STATE_VISIBLE
getShowState().
| Constructor Detail |
|---|
public DialogWindow()
public DialogWindow(boolean showCancel)
showCancel - whether to show the cancel button or notpublic DialogWindow(String inTitle)
inTitle - the title of the dialogpublic DialogWindow(CharSequence inTitle)
inTitle - the title of the dialog
public DialogWindow(String inTitle,
int windowStyle)
inTitle - the title of the dialogwindowStyle - the window style. This should be one of
APP_DIALOG_STYLE, APP_ALERT_STYLE, SYSTEM_DIALOG_STYLE, or
SYSTEM_ERROR_STYLE.
See setWindowStyle for a description of the styles.
public DialogWindow(CharSequence inTitle,
int windowStyle)
inTitle - the title of the dialogwindowStyle - the window style. This should be one of
APP_DIALOG_STYLE, APP_ALERT_STYLE, SYSTEM_DIALOG_STYLE, or
SYSTEM_ERROR_STYLE.
See setWindowStyle for a description of the styles.
public DialogWindow(String inTitle,
int windowStyle,
boolean showCancel)
inTitle - the title of the dialogwindowStyle - the window style. This should be one of
APP_DIALOG_STYLE, APP_ALERT_STYLE, SYSTEM_DIALOG_STYLE, or
SYSTEM_ERROR_STYLE.
See setWindowStyle for a description of the styles.showCancel - whether to show the cancel button or not
public DialogWindow(CharSequence inTitle,
int windowStyle,
boolean showCancel)
inTitle - the title of the dialogwindowStyle - the window style. This should be one of
APP_DIALOG_STYLE, APP_ALERT_STYLE, SYSTEM_DIALOG_STYLE, or
SYSTEM_ERROR_STYLE.
See setWindowStyle for a description of the styles.showCancel - whether to show the cancel button or not| Method Detail |
|---|
public boolean wantsSendButton()
Window
wantsSendButton in class Windowpublic boolean wantsEndButton()
Window
wantsEndButton in class Windowpublic void setWindowStyle(int windowStyle)
windowStyle - the window style. This should be one of
APP_DIALOG_STYLE,
APP_ALERT_STYLE,
SYSTEM_DIALOG_STYLE, or
SYSTEM_ERROR_STYLE.public int getWindowStyle()
public void removeAllChildren()
removeAllChildren in class ContainerContainer.removeAllChildren()
public void disableButtonOnEmptyField(int buttonID,
int fieldID)
buttonID - the id of the button to disablefieldID - the id of the text field to monitorpublic void disableBottomRightButtonOnEmptyField(TextField textField)
textField - the text field to monitorprotected void addTopFrameButtons()
addTopFrameButton(java.lang.String, int, int, java.lang.Object, char) or
addFrameButton(int, java.lang.String, int, int, int, java.lang.Object, char) to specify a top frame button to add.
The dialog will keep track of these buttons and then add them
using this method automatically.
public int getNumTopFrameButtons()
public boolean hasVisibleFrameButtons()
protected void addBottomFrameButtons()
addBottomFrameButton(java.lang.String, int, int, java.lang.Object, char) or
addFrameButton(int, java.lang.String, int, int, int, java.lang.Object, char) to specify a bottom frame button to add.
The dialog will keep track of these buttons and then add them
using this method automatically.
public void setShowCancel(boolean showCancel)
setCancelButtonEvent(danger.app.Event). Unless you call
setHideOnButtonEvent(boolean), the dialog will be automatically
be hidden when the user selects this button.
If you want the cancel button in a different position, or
with a shortcut, then you should use addFrameButton(int, java.lang.String, int, int, int, java.lang.Object, char).
showCancel - whether to show the cancel button or notpublic void setListener(Listener inListener)
inListener - A Listener that will receive events from the window.public View getChildWithID(int id)
Container.addChild(danger.ui.View). It will also return a frame button with the
given id, even if that button has not yet been automatically
added with Container.addChild(danger.ui.View).
Returns null if there is no direct descendant with the given id.
It is generally better to call getDescendantWithID(int),
which works even if the view is nested inside other containers.
getDescendantWithID(int) is also slightly faster.
Use getChildWithID(int) only when you need the behavior that
it returns null if it's not a direct descendant.
getChildWithID in class Containerid - the id of the child to obtain
Container.getChildWithID(int)public View getDescendantWithID(int id)
Container.addChild(danger.ui.View). It will also return a frame button with the
given id, even if that button has not yet been automatically
added with Container.addChild(danger.ui.View).
Returns null if there is no descendant with the given id.
getDescendantWithID in class Windowid - the id of the descendant to obtain
Container.getChildWithID(int)protected Button getCancelButton()
protected Button getFrameButtonWithID(int id)
getChildWithID(int).
id - the id of the frame button to obtain
public void setEventForControlWithID(int id,
Event newEvent)
setEventForControlWithID in class Windowid - the id of the controlnewEvent - the new event to be usedWindow.setEventForControlWithID(int, danger.app.Event)
protected boolean setEventForFrameButtonWithID(int id,
Event newEvent)
setEventForControlWithID(int, danger.app.Event).
id - the id of the frame buttonnewEvent - the new event to be used
public Button addBottomFrameButton(String buttonStr,
int eventType,
int data,
Object arg,
char shortcut)
public Button addBottomFrameButton(CharSequence buttonStr,
int eventType,
int data,
Object arg,
char shortcut)
public Button addTopFrameButton(String buttonStr,
int eventType,
int data,
Object arg,
char shortcut)
show() is called.
If you need more control (for example, specifying a button id,
or an explicit position), then use addFrameButton(int, java.lang.String, int, int, int, java.lang.Object, char)
instead.
buttonStr - the title of the buttoneventType - the event type for the button eventdata - the data for the button eventarg - the argument for the button eventshortcut - the shortcut for the button
public Button addTopFrameButton(CharSequence buttonStr,
int eventType,
int data,
Object arg,
char shortcut)
public Button addFrameButton(int position,
String buttonStr,
int flags,
int eventType,
int data,
Object arg,
char shortcut)
public Button addFrameButton(int position,
CharSequence buttonStr,
int flags,
int eventType,
int data,
Object arg,
char shortcut)
public Button addFrameButton(int position,
String buttonStr,
int flags,
int eventType,
int data,
Object arg,
char shortcut,
int id)
public Button addFrameButton(int position,
CharSequence buttonStr,
int flags,
int eventType,
int data,
Object arg,
char shortcut,
int id)
public Button addFrameButton(int position,
String buttonStr,
int flags,
int eventType,
int eventWhat,
int data,
Object arg,
char shortcut,
int id)
show() is called.
position - where to put the button. This should be one of
TOP_POSITION1 (top right), TOP_POSITION2, BOTTOM_POSITION1 (bottom
right), BOTTOM_POSITION2, or BOTTOM_POSITION3 (bottom left).buttonStr - the title of the buttonflags - some combination of AlertResourceDecoder constants
ALERT_BUTTON_FLAG_*_BUTTON,
ALERT_BUTTON_FLAG_MENU_SHORTCUT, ALERT_BUTTON_FLAG_SHIFT_SHORTCUT,
ALERT_BUTTON_FLAG_ALT_SHORTCUT,
ALERT_BUTTON_FLAG_DONT_HIDE_ON_BUTTON_EVENT, and
ALERT_BUTTON_FLAG_DEFAULT_BUTTON.
The first four flags specify the title; if you use one of these flags,
then buttonStr is ignored.eventType - the event type for the button eventeventWhat - the Event.what parameter for the button eventdata - the data for the button eventarg - the argument for the button eventshortcut - the shortcut for the buttonid - the id of the button
public Button addFrameButton(int position,
CharSequence buttonStr,
int flags,
int eventType,
int eventWhat,
int data,
Object arg,
char shortcut,
int id)
public Button addFrameButton(int position,
String buttonStr,
int eventType,
int data,
Object arg)
public Button addFrameButton(int position,
CharSequence buttonStr,
int eventType,
int data,
Object arg)
public Button addFrameButton(int position,
String buttonStr,
int eventType,
int data,
Object arg,
char shortcut)
public Button addFrameButton(int position,
CharSequence buttonStr,
int eventType,
int data,
Object arg,
char shortcut)
public Button addFrameButton(int position,
String buttonStr,
int eventType,
int data,
Object arg,
char shortcut,
int id)
public Button addFrameButton(int position,
CharSequence buttonStr,
int eventType,
int data,
Object arg,
char shortcut,
int id)
public Button addFrameButton(int position,
String buttonStr,
int eventType,
int data,
Object arg,
char shortcut,
int shortcutModifiers,
int id)
public Button addFrameButton(int position,
CharSequence buttonStr,
int eventType,
int data,
Object arg,
char shortcut,
int shortcutModifiers,
int id)
public Button addFrameButton(int position,
String buttonStr,
int eventType,
int eventWhat,
int data,
Object arg,
char shortcut,
int shortcutModifiers,
int id)
public Button addFrameButton(int position,
CharSequence buttonStr,
int eventType,
int eventWhat,
int data,
Object arg,
char shortcut,
int shortcutModifiers,
int id)
public Button addFrameButton(int position,
String buttonStr,
Listener eventListener,
int eventType,
int eventWhat,
int data,
Object arg,
char shortcut,
int shortcutModifiers,
int id)
position - values of 1-3, indicates which button to assign.buttonStr - A String containing the label for the button.eventListener - Listener for the button eventeventType - An int containing the event type to be sent when the button is chosen.eventWhat - An int containing the Event.what parameter to be sent when the button is chosen.data - An int containing any additional data to be sent in the event.arg - An Object containing an object reference to be sent in the event.shortcut - A char specifying the shortcut to be used for the button.shortcutModifiers - Some combination of Shortcut.MODIFIER_MENU,
Shortcut.MODIFIER_SHIFT, and Shortcut.MODIFIER_ALT.id - An id which can be used to reference the button in the future.Shortcut
public Button addFrameButton(int position,
CharSequence buttonStr,
Listener eventListener,
int eventType,
int eventWhat,
int data,
Object arg,
char shortcut,
int shortcutModifiers,
int id)
public void removeFrameButtonWithID(int id)
Container.removeChild(danger.ui.View) or View.hide().
The frame button should have been added using a call to
addTopFrameButton(java.lang.String, int, int, java.lang.Object, char), addBottomFrameButton(java.lang.String, int, int, java.lang.Object, char), or
addFrameButton(int, java.lang.String, int, int, int, java.lang.Object, char).
id - the id of the frame button to remove.
public void setFrameButtonShortcut(int position,
char shortcut)
position - the position of the button to modify. This should
be one of TOP_POSITION1, TOP_POSITION2, etc.shortcut - the new shortcut key
public void setFrameButtonShortcut(int position,
char shortcut,
int modifiers)
position - the position of the button to modify. This should
be one of TOP_POSITION1, TOP_POSITION2, etc.shortcut - the new shortcut keymodifiers - Some combination of Shortcut.MODIFIER_MENU,
Shortcut.MODIFIER_SHIFT, and Shortcut.MODIFIER_ALT. Currently,
only Shortcut.MODIFIER_MENU is handled correctly. The others
are displayed correctly, but not handled correctly. Specify 0
if no modifiers are required.public void setDefaultFrameButton(int which)
setDefaultFrameButton(int). In other
words, if you call both setDefaultFrameButton(int) and
Window.setDefaultFocus(danger.ui.View), then whatever was set with
Window.setDefaultFocus(danger.ui.View) will be focused.
which - the position of the frame button that should have
default focus when the dialog is first displayed. This should be
one of TOP_POSITION1, TOP_POSITION2, etc.public void setDefaultFrameButton(Button button)
setDefaultFrameButton(int). In other
words, if you call both setDefaultFrameButton(int) and
Window.setDefaultFocus(danger.ui.View), then whatever was set with
Window.setDefaultFocus(danger.ui.View) will be focused.
button - the button that should have default focus when
the dialog is first displayedpublic void setNoDefaultFrameButton()
public Button getDefaultFrameButton()
public void setLayoutBottomFrameButtonsVertically(boolean flag)
protected void updateFrameButtonColors()
protected void layoutTopFrameButtons()
protected int calcBottom()
protected void updateBottomButtonWidths()
public int convertShortcutKeyToButtonIndex(Event e)
e - the event to test
protected int convertShortcutKeyToButtonIndex(char key,
Event event)
key - the key to testevent - the event, which can be used to match modifier keys
public boolean handleShortcutKey(Event e)
e - An Event containing the shortcut event that was received.protected boolean handleFrameButtonShortcut(int position)
activateFrameButton(int), which results in sending an
appropriate event.
Override this method if you want to handle this yourself.
position - the position of the button whose shortcut
this should handle. One of TOP_POSITION1, TOP_POSITION2, etc.
public boolean handleButtonShortcut(char shortcut,
Event event)
ContainerContainer.eventShortcut(char, danger.app.Event) in your Window.
handleButtonShortcut in class Container
public boolean eventShortcut(char shortcut,
Event event)
handleShortcutKey(danger.app.Event) to handle the
shortcut.
eventShortcut in class Containershortcut - the key that was pressedevent - the event associated with the key press
true if the shortcut was handledView.eventShortcut(char, danger.app.Event)protected void activateFrameButton(int position)
receiveEvent(danger.app.Event), where
the event associated with this button (in addFrameButton(int, java.lang.String, int, int, int, java.lang.Object, char)
is sent, and the window is hidden unless setHideOnButtonEvent(boolean)
has been called.
position - the position of the button to activate. One
of TOP_POSITION1, TOP_POSITION2, etc.public void setCancelButtonEvent(Event e)
setShowCancel(boolean).
e - the event to be sentpublic void setBackEvent(Event e)
e - the event to be sentpublic void setTitle(String inTitle)
setTitle in class WindowinTitle - the title of the windowpublic final void setTitle(CharSequence inTitle)
setTitle in class WindowinTitle - the title of the windowpublic String getTitle()
setTitle(java.lang.String)
getTitle in class Windowpublic final CharSequence getTitleSequence()
setTitle(java.lang.String).
This method is a mess so that if somebody
has overridden getTitle()
it will use that instead of what it thinks internally
the title should be.
getTitleSequence in class Windowpublic int getTitleBarHeight()
public void setWidthToFitTitle()
getWidthToFitTitle() to determine the width.
Please note that this method may grow or shrink the dialog, so if
you don't want it to shrink, you may want to first call
getWidthToFitTitle() and compare it with the current width.
public int getWidthToFitTitle()
public Rect getContentRect()
public void setContentSize(int width,
int height)
getContentRect() will return a rect with the given
width and height.
width - the width of the content rectheight - the height of the content rectpublic void setAutoSize(boolean doAutoSize)
show()
is called. See setBorders(int, int, int, int) for more information.
doAutoSize - whether to automatically resize the dialogpublic void setAutoSizeWidth(boolean doAutoSize)
setAutoSizeHeight(boolean). Use setAutoSize(boolean)
to set both attributes at the same time.
This method does not resize the dialog immediately. Rather,
it specifies how to resize the dialog when show()
is called. See setBorders(int, int, int, int) for more information.
doAutoSize - whether to automatically set the dialog's
widthpublic void setAutoSizeHeight(boolean doAutoSize)
setAutoSizeWidth(boolean). Use setAutoSize(boolean)
to set both attributes at the same time.
This method does not resize the dialog immediately. Rather,
it specifies how to resize the dialog when show()
is called. See setBorders(int, int, int, int) for more information.
doAutoSize - whether to automatically set the dialog's
height
public void setSize(int width,
int height)
layoutTopFrameButtons() to account for the new width.
setSize in class Windowwidth - the width of the dialogheight - the height of the dialogpublic void setFocusedChild(View inNewFocus)
ContainersetFocusedChild(newFocus,
true).
setFocusedChild in class ContainerinNewFocus - null-ok; the child which should assume focus or
null if no child should have focusContainer.setFocusedChild(danger.ui.View, boolean)
public void setFocusedDescendant(View inNewFocus,
boolean inFromAbove)
Containernull, then this indicates that whatever child
currently has focus should lose focus, and if it has a child with
focus, then that child should lose it too (etc.). This method throws
an exception if you pass a non-null view that is
not a descendant of this instance. It also throws an exception
if any of the views in the heritage between this instance and the
given view are not instances of Container.
setFocusedDescendant in class ContainerinNewFocus - null-ok; the descendant which should assume focus or
null if no descendant should have focusinFromAbove - whether or not focus is coming in from aboveContainer.setFocusedDescendant(danger.ui.View, boolean)public void show()
show in class Windowpublic void show(int alertType)
alertType - the type of alert. This is only relevant for
system dialogs. This should be one of
SYSTEM_ALERT_TYPE_GENERAL,
SYSTEM_ALERT_TYPE_INCOMING_CALL,
SYSTEM_ALERT_TYPE_MISSED_CALL,
SYSTEM_ALERT_TYPE_ALARM,
SYSTEM_ALERT_TYPE_CONTROL, or
SYSTEM_ALERT_TYPE_PERSISTENT_CONTROL.public int getShowState()
SHOW_STATE_HIDDEN)
or visible (SHOW_STATE_VISIBLE).
However, system dialogs have a third, transitory state. When
show() is called for a system dialog, an event is sent to
the notification manager. At some time in the future, the
dialog is actually shown. During this (usually brief) time, the
dialog's state will be reported as SHOW_STATE_SHOWING.
public void show(int alertType,
boolean withPendingSound)
alertType - the type of alert. This is only relevant for
system dialogs. This should be one of SYSTEM_ALERT_TYPE_GENERAL,
SYSTEM_ALERT_TYPE_INCOMING_CALL, SYSTEM_ALERT_TYPE_MISSED_CALL,
SYSTEM_ALERT_TYPE_ALARM, SYSTEM_ALERT_TYPE_CONTROL, or
SYSTEMA_ALERT_TYPE_PERSISTENT_CONTROL.withPendingSound - if this is a system dialog, then this
parameter determines whether this dialog should cause a pending
alert notification sound.public void setShowTone(RingToneObject tone)
tone - the tone to playpublic void setShowTone(int resourceID)
resourceID - resource id of the tone to playpublic void reflowFrameButtons()
protected void showInternal()
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.
public void hide()
setShowTone(danger.audio.RingToneObject)
will be stopped.
hide in class Windowprotected void startShowTone()
setShowTone(danger.audio.RingToneObject).
Generally, you should not have to call or override this method.
protected void stopShowTone()
setShowTone(danger.audio.RingToneObject).
Generally, you should not have to call or override this method.
protected void positionDialog()
positionDialog will center the dialog
on the screen. Override this method if you want some other
position. Alternatively, if you simply do not want
positionDialog to center the dialog, then call
setAutoCenter(boolean).
public void setAutoCenter(boolean autoCenter)
positionDialog().
autoCenter - whether the dialog should be centered or notpublic String getSleepScreenMessage()
public CharSequence getSleepScreenMessageCharSequence()
public void setSleepScreenMessage(String message)
public void setSleepScreenMessage(CharSequence message)
public Bitmap getSleepScreenImage()
public void snapToChildren(int inLeft,
int inTop,
int inRight,
int inBottom)
setBorders(int, int, int, int). snapToChildren is
automatically called when you call show().
snapToChildren in class ContainerinLeft - the width of the left borderinTop - the width of the top borderinRight - the width of the right borderinBottom - the width of the bottom borderpublic void paint(Pen pen)
ViewThe 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.
paint in class Containerpen - non-null; the pen to use for drawing operationsView.paint(danger.ui.Pen)
protected void drawDialogStyleFrame(Pen p,
int windowStyle)
p - the pen to usewindowStyle - the type of window style frame to drawpublic boolean receiveEvent(Event e)
ListenerDispatcher when it reads an Event in its queue
that is targetted at this instance. The default behavior is to
do nothing and return false. Subclasses are expected
to override this method to do something more useful.
receiveEvent in class Containere - non-null; the event to process
true) or not (false) this
method actually handled the event to completionListener.receiveEvent(danger.app.Event)public boolean blocksChooser()
Window
blocksChooser in class Window
public boolean eventKeyUp(char c,
Event event)
Container
eventKeyUp in class Containerc - the character being released.View.eventKeyUp(char, danger.app.Event)
public boolean eventWidgetUp(int widget,
Event event)
Container
eventWidgetUp in class Windowwidget - the widget that went down
View.eventWidgetUp(int, danger.app.Event)
public boolean eventWidgetDown(int widget,
Event event)
Window
eventWidgetDown in class Windowwidget - the widget that went up
View.eventWidgetDown(int, danger.app.Event)protected void setDrawBottomFrame(boolean drawFrame)
public void setForceDrawBottomFrame(boolean drawFrame)
protected static Font getTitleFont()
public void setHideOnButtonEvent(boolean hide)
setHideOnButtonWithID(int, boolean).
hide - whether the dialog should be hidden
public void setHideOnButtonWithID(int id,
boolean hide)
setHideOnButtonEvent(boolean).
id - the id of the frame buttonhide - whether the dialog should be hidden
public void setHideOnButtonWithPosition(int position,
boolean hide)
setHideOnButtonEvent(boolean).
position - the position of the frame button (TOP_POSITION1,
TOP_POSITION2, etc.)hide - whether the dialog should be hidden
public void setBorders(int inLeft,
int inTop,
int inRight,
int inBottom)
inLeft - the width of the left borderinTop - the width of the top borderinRight - the width of the right borderinBottom - the width of the bottom borderpublic void setCenterTitle(boolean center)
center - whether to center the dialog title.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||