|
||||||||||
| 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
public class Window
Basic Window object.
Usually, you will instantiate a DialogWindow or
ScreenWindow (or some subclass of them) instead.
A generic Window object does not have any title
bar or frame.
| Field Summary | |
|---|---|
protected int |
mBusyPaintCount
Deprecated. For internal use only. |
protected Listener |
mDefaultListener
Deprecated. Use setDefaultListener(danger.app.Listener) instead. |
protected static int |
STATE_AUTO_HIDE_IF_IDLE
|
protected static int |
STATE_DROP_ORPHANED_EVENTS
|
protected static int |
STATE_FULLSCREEN
|
protected static int |
STATE_UNUSED1
|
| Constructor Summary | |
|---|---|
Window()
Create an application window. |
|
Window(boolean systemWindow,
int left,
int top,
int right,
int bottom)
|
|
Window(boolean systemWindow,
Rect r)
|
|
Window(int left,
int top,
int right,
int bottom)
|
|
Window(Rect r)
Create an application window with the given global bounds. |
|
| Method Summary | |
|---|---|
void |
adjustActionMenuState(Menu actionMenu)
This method does not get called for Windows which are not ScreenWindows. |
boolean |
advanceFocus()
Advances the focus of the current container to the next child view that can handle it. |
protected void |
autoHide()
|
boolean |
autoHideIfIdle()
Returns true if this window gets auto hidden if its idle for a certain amount of time. |
void |
autoHideIfIdle(boolean flag)
Set a flag that controls whether this window auto hides if it has been idle for certain amount of time (15 seconds) |
boolean |
blocksBackButton()
Whether the window blocks the system from handling the BACK button being held and thus going into keyguard. |
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. |
boolean |
blocksFloatingControls()
Whether the window blocks the sound and screen controls. |
boolean |
blocksKeyGuard()
Whether the window blocks the device from going into keyguard. |
boolean |
blocksVolumeButtons()
Whether the window blocks the external volume buttons. |
void |
centerHorizontal()
Horizontally center the window on the screen. |
void |
centerOnScreen()
Center the window on the screen, both vertically and horizontally. |
void |
centerUnderTitleBar()
Vertically center the window on the section of screen below the title bar. |
void |
centerVertical()
Vertically center the window on the screen. |
void |
disableControlWithID(int id)
Disable the control with the specified id. |
void |
dropOrphanedEvents(boolean drop)
Set a flag that controls whether this window drops orphan events. |
void |
enableControlWithID(int id)
Enable the control with the specified id. |
boolean |
eventWidgetDown(int inWhichWidget,
Event event)
Handle a button down event. |
boolean |
eventWidgetUp(int inWhichWidget,
Event event)
Handle the release of a device widget |
void |
forwardQueuedEvents(Window window)
Forward events that have been queued in this window, to another window. |
Application |
getApplication()
|
View |
getDefaultFocus()
Returns the default focus as set by setDefaultFocus(danger.ui.View) |
View |
getDescendantWithID(int inID)
Get the descendant with the specified id. |
int |
getIDOfChild(View child)
Get the id of a child. |
Listener |
getListener()
|
String |
getTitle()
Gets the title of the window. |
CharSequence |
getTitleSequence()
Gets the title of the window. |
Window |
getWindowBelow()
|
void |
hide()
Mark this view hidden so that it is not displayed. |
protected void |
hideActiveMenu(boolean onlyIfOrphaned)
|
void |
hideControlWithID(int id)
Hide the control with the specified id. |
int |
incrementMaxChildID()
Set the maximum child id for this window to be one more than the old value. |
boolean |
isActionMenuVisible()
This method always returns false for Windows which are not ScreenWindows. |
boolean |
isFullScreen()
|
boolean |
isUnresponsive()
Returns true if this window is currently unresponsive. |
protected void |
onActivate()
Called when the window stack changes such that this window is now the active window. |
protected void |
onDeactivate()
Called when the window stack changes such that this window is no longer the active window. |
protected void |
onPeriodicPulse()
This method is called periodically (every half second) for the frontmost window only. |
protected void |
onWindowPaint()
This method is called when the View receives a EventType.EVENT_WINDOW_PAINT event from the window manager. |
void |
receiveMessage(int inMessage,
int inData,
Object inArgument)
|
boolean |
reverseFocus()
Reverses the focus of the current container to the previous child view that can handle it. |
void |
setDefaultFocus(View view)
Sets the default focus. |
void |
setDefaultListener(Listener listener)
Set the default listener. |
void |
setEventArgForControlWithID(int id,
Object eventArg)
Set the event arg for the control with the specified id. |
void |
setEventForControlWithID(int id,
Event newEvent)
Set the event for the control with the specified id. |
void |
setFullScreen(boolean fullScreen)
Set whether this window is considered "full screen". |
void |
setMaxChildID(int id)
Set the maximum child id for this window. |
void |
setMaxControlID(int id)
Synonymous with setMaxChildID. |
void |
setPosition(int x,
int y)
Move this View to a new position specified in its parent's coordinate system. |
void |
setSize(int width,
int height)
Simultaneously set the width and height of this View. |
void |
setTitle(CharSequence inTitle)
Sets the title of the window. |
void |
setTitle(String inTitle)
Sets the title of the window. |
void |
setTitled(boolean titled)
|
void |
setTitleFormatDate(Date inDate)
Set the format date for the title. |
void |
setTitleFormatText(CharSequence[] inArgs)
Set the format text for the title. |
void |
setTitleFormatText(String inArg0)
Set the format text for the title. |
void |
setTitleFormatText(String[] inArgs)
Set the format text for the title. |
void |
setTitleFormatText(String inArg0,
String inArg1)
Set the format text for the title. |
void |
setTitleFormatText(String inArg0,
String inArg1,
String inArg2)
Set the format text for the title. |
protected boolean |
shouldDropEvent(Event event)
This method is called to find out whether an event should be dropped on the floor instead of dispatched. |
void |
show()
Mark this view visible. |
void |
showControlWithID(int id)
Show the control with the specified id. |
void |
startQueueingEvents()
Start queueing key events, in order to forward them to a window to be created later. |
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. |
boolean |
willPassEventToWindow(Event event,
Window window)
Return whether this window will simply pass the event to the specified window. |
| 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 Listener mDefaultListener
setDefaultListener(danger.app.Listener) instead.protected static final int STATE_FULLSCREEN
protected static final int STATE_UNUSED1
protected static final int STATE_DROP_ORPHANED_EVENTS
protected static final int STATE_AUTO_HIDE_IF_IDLE
protected int mBusyPaintCount
| Constructor Detail |
|---|
public Window()
Create an application window.
The window will be positioned at (0,0) and cover the entire screen.
public Window(Rect r)
Create an application window with the given global bounds.
public Window(boolean systemWindow,
Rect r)
public Window(int left,
int top,
int right,
int bottom)
public Window(boolean systemWindow,
int left,
int top,
int right,
int bottom)
| Method Detail |
|---|
public void setPosition(int x,
int y)
View
setPosition in class View
public void setSize(int width,
int height)
View
setSize in class Viewpublic void show()
ViewWindow. If this view was not
already visible, this method will call View.onShow() as the last
thing it does before returning. If you wish to have special behavior
when a view becomes visible, it is recommended that you override
that method.
In a future revision of the library, it is likely that this method
will be final.
show in class Viewpublic void hide()
ViewContainer, then none of the children will be displayed,
either. However, this method does not mark the children as hidden -
it simply means they won't be displayed. If this view was not
already hidden, this method will call View.onHide() as the last
thing it does before returning. If you wish to have special behavior
when a view becomes hidden, it is recommended that you override that
method.
In a future revision of the library, it is likely that this method
will be final.
hide in class Viewpublic void setDefaultFocus(View view)
show()
is called. Pass in null if you do not want the focus to
change when show() is called.
view - the view to set the focus to whenever show()
is called.public View getDefaultFocus()
setDefaultFocus(danger.ui.View)
public boolean advanceFocus()
Container
advanceFocus in class Containerpublic boolean reverseFocus()
Container
reverseFocus in class Containerprotected void hideActiveMenu(boolean onlyIfOrphaned)
protected final void onWindowPaint()
ViewEventType.EVENT_WINDOW_PAINT event from the window manager.
This really only makes sense for Windows, not other views.
onWindowPaint in class Viewprotected final void onPeriodicPulse()
View
onPeriodicPulse in class View
public boolean willPassEventToWindow(Event event,
Window window)
shouldDropEvent(danger.app.Event)
when determining whether to drop an event.
An event is usually sent to the frontmost window. In some cases,
however, another window becomes frontmost before the event is
handled. In this case, this method will be called with the
event in question, and the current frontmost window. If this
method returns true, then the event is not dropped. If it
returns false, then the event is dropped.
This default implementation always returns false.
protected final boolean shouldDropEvent(Event event)
ViewWindow to keep queued UI events from getting to a window
after it has ceased to be the frontmost window.
shouldDropEvent in class View
public boolean eventWidgetDown(int inWhichWidget,
Event event)
eventWidgetDown in class ContainerinWhichWidget - the widget that went up
public boolean eventWidgetUp(int inWhichWidget,
Event event)
Container
eventWidgetUp in class ContainerinWhichWidget - the widget that went down
public void forwardQueuedEvents(Window window)
Forward events that have been queued in this window, to another window.
You can use this to improve the responsiveness of your application
when the user uses a menu shortcut to create a new window and then
types quickly, before the window is visible. Use
MenuItem.queueEventsOnActivation(danger.ui.Window) to specify menu items which
cause this behavior. Once you have created the window, use
this method to send the queued events to the newly created window.
public void startQueueingEvents()
Start queueing key events, in order to forward them to a window to be created later.
The most common use of this method is in conjunction with
MenuItem.queueEventsOnActivation(danger.ui.Window). If a menu item
creates a new screen window, and then the screen window
immediately creates a dialog, you can call this method
on the screen window to queue events. Then, when the dialog is
created, you can forward those events to the dialog.
Important: if you use this method, you must call
forwardQueuedEvents(danger.ui.Window). Until you do, any key events that
would otherwise go to this window will not be handled.
public void receiveMessage(int inMessage,
int inData,
Object inArgument)
public void adjustActionMenuState(Menu actionMenu)
ScreenWindow.adjustActionMenuState()public boolean isActionMenuVisible()
ScreenWindow.adjustActionMenuState()public void centerOnScreen()
public void centerHorizontal()
public void centerVertical()
public void centerUnderTitleBar()
centerVertical(). This does not
affect the horizontal position of the window.
public Application getApplication()
public final Listener getListener()
public boolean isFullScreen()
public void setFullScreen(boolean fullScreen)
ScreenWindow does.
fullScreen - whether this window should be "full screen"public void setTitled(boolean titled)
public void setTitle(String inTitle)
public void setTitle(CharSequence inTitle)
setTitle(String).
See DialogWindow and ScreenWindow.
public String getTitle()
public CharSequence getTitleSequence()
getTitle(). See
DialogWindow and ScreenWindow.
public Window getWindowBelow()
public boolean blocksChooser()
public boolean blocksFloatingControls()
public boolean blocksBackButton()
public boolean blocksVolumeButtons()
public boolean blocksKeyGuard()
public boolean wantsSendButton()
public boolean wantsEndButton()
public void dropOrphanedEvents(boolean drop)
public boolean isUnresponsive()
public void autoHideIfIdle(boolean flag)
public boolean autoHideIfIdle()
protected void autoHide()
public void setMaxControlID(int id)
setMaxChildID(int)public void enableControlWithID(int id)
Container.getControlWithID(int) and
then calling Container.enable().
id - the id of the control as specified in the resource file,
or in the call to Container.addChild(danger.ui.View).public void disableControlWithID(int id)
Container.getControlWithID(int) and
then calling Container.disable().
id - the id of the control as specified in the resource file,
or in the call to Container.addChild(danger.ui.View).public void showControlWithID(int id)
Container.getControlWithID(int) and
then calling View.show().
id - the id of the control as specified in the resource file,
or in the call to Container.addChild(danger.ui.View).public void hideControlWithID(int id)
Container.getControlWithID(int) and
then calling View.hide().
id - the id of the control as specified in the resource file,
or in the call to Container.addChild(danger.ui.View).public void setDefaultListener(Listener listener)
setEventForControlWithID(int, danger.app.Event) where the event has a null
listener.
listener - the listener to use
public void setEventForControlWithID(int id,
Event newEvent)
Container.getControlWithID(int) and
then calling Control.setEvent(danger.app.Event).
If the event has a null listener, then the event is replaced by
one whose listener is the one set in setDefaultListener(danger.app.Listener).
id - the id of the control as specified in the resource file,
or in the call to Container.addChild(danger.ui.View).
public void setEventArgForControlWithID(int id,
Object eventArg)
Container.getControlWithID(int) and
then calling Control.setEventArg(java.lang.Object).
This call does not affect any of the other event parameters.
id - the id of the control as specified in the resource file,
or in the call to Container.addChild(danger.ui.View).public void setMaxChildID(int id)
setMaxControlID(int), which
is equivalent) before calling Container.addChild(danger.ui.View) with an id.
It is an error to call Container.addChild(danger.ui.View) with a value greater
than that specified in this method. It is also illegal to
call Container.addChild(danger.ui.View) with such an id, for any
container which is a descendant of this window.
Note that if you are only creating a window from a resource
and not calling Container.addChild(danger.ui.View) manually, then you do not
not have to manually call this method because it is called
for you automatically.
id - the maximum child idpublic int incrementMaxChildID()
setMaxChildID(int)public View getDescendantWithID(int inID)
getDescendantWithID in class ContainerinID - the id of the descendantpublic int getIDOfChild(View child)
child must be a descendant of this window. Since it
does not have to be a direct descendant, this method would be
more aptly named getIDOfDescendant.
child - the child to get the id ofpublic void setTitleFormatText(String inArg0)
inArg0 - the argument to replace ^0 with.StringFormat
public void setTitleFormatText(String inArg0,
String inArg1)
setTitleFormatText(String inArg0).
inArg0 - the argument to replace ^0 with.inArg1 - the argument to replace ^1 with.StringFormat
public void setTitleFormatText(String inArg0,
String inArg1,
String inArg2)
setTitleFormatText(String inArg0).
inArg0 - the argument to replace ^0 with.inArg1 - the argument to replace ^1 with.inArg2 - the argument to replace ^2 with.StringFormatpublic void setTitleFormatText(String[] inArgs)
setTitleFormatText(String inArg0).
inArgs - the arguments to replace ^0, ^1, etc. withStringFormatpublic void setTitleFormatText(CharSequence[] inArgs)
setTitleFormatText(String inArg0).
inArgs - the arguments to replace ^0, ^1, etc. withStringFormatpublic void setTitleFormatDate(Date inDate)
DateFormat for a description of the different
text you can use.
inDate - the date to replace ^0, ^1, etc. withDateFormatprotected void onActivate()
protected void onDeactivate()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||