danger.app
Class Event

java.lang.Object
  extended by danger.app.Event
All Implemented Interfaces:
EventType


public final class Event
extends Object
implements EventType

Standard object used for passing events, such as UI events.

Event objects are sent when the user initiates an action (such as selecting a menu item). You can specify the listener for events for the associated UI objects (such as a menu item, a button, etc). You can also register to receive some specific events by using Application.registerForEvent(danger.app.Listener, int).


Field Summary
 Object argument
          arbitrary Object
 int data
          Additional event-specific data.
 int keycode
          For key events contains the raw keycode
 int modifiers
          Event modifiers.
 Listener target
          Where to route the event on receipt.
 int timestamp
          Timestamp of when the event happened.
 int type
          Event type ID.
 int what
          Event specifier.
 
Fields inherited from interface danger.app.EventType
BATTERY_CHARGE, BATTERY_COLD, BATTERY_DISCHARGE, BATTERY_FLAG_CHARGE, BATTERY_FLAG_DC_PLUG, BATTERY_FLAG_FAULT, BATTERY_FLAG_FULL, BATTERY_FLAG_POWER, BATTERY_FLAG_SHUTDOWN, BATTERY_FLAG_TEMP, BATTERY_FULL, BATTERY_HOT, BATTERY_NOPOWER, BITMAP_DECODED, DEVICE_ARROW_DOWN, DEVICE_ARROW_DOWN_LEFT, DEVICE_ARROW_DOWN_RIGHT, DEVICE_ARROW_LEFT, DEVICE_ARROW_RIGHT, DEVICE_ARROW_UP, DEVICE_ARROW_UP_LEFT, DEVICE_ARROW_UP_RIGHT, DEVICE_BUTTON_BACK, DEVICE_BUTTON_CANCEL, DEVICE_BUTTON_DONE, DEVICE_BUTTON_END, DEVICE_BUTTON_JUMP, DEVICE_BUTTON_LEFT_SHOULDER, DEVICE_BUTTON_MENU, DEVICE_BUTTON_RIGHT_SHOULDER, DEVICE_BUTTON_SEND, DEVICE_BUTTON_VOLUME_DOWN, DEVICE_BUTTON_VOLUME_UP, DEVICE_EXT_HOOK_DOWN, DEVICE_EXT_HOOK_UP, DEVICE_META_ALT, DEVICE_META_ALT_LOCKED, DEVICE_META_CAPS, DEVICE_META_CAPS_LOCKED, DEVICE_META_NONE, DEVICE_META_SHIFT_ALT, DEVICE_MULTIPLE_WHEEL, DEVICE_NAVIGATION, DEVICE_WHEEL, DEVICE_WHEEL_BUTTON, DEVICE_WHEEL_PAGE_DOWN, DEVICE_WHEEL_PAGE_UP, EVENT_ACTIVE_SPEAKER_CHANGED, EVENT_ADD_LINK, EVENT_ALARM, EVENT_APP_NETWORK, EVENT_AUDIO, EVENT_AUDIO_MEDIA_VOLUME_CHANGE_REQUESTED, EVENT_AUDIO_MEDIA_VOLUME_CHANGED, EVENT_AUTO_SYNC_DONE, EVENT_AUTOSYNC_CATEGORYID_CHANGED, EVENT_BACKLIGHT_CHANGED, EVENT_BATTERY_COVER_STATE_CHANGED, EVENT_BATTERY_STATE_CHANGED, EVENT_BLUETOOTH_STATE_CHANGED, EVENT_CALL_CUSTOMER_CARE, EVENT_CAMERA_STATUS, EVENT_CONNECTION_DOWN, EVENT_CONNECTION_UP, EVENT_COPY, EVENT_COPY_LINK, EVENT_CUT, EVENT_DATASTORE_RESTORED, EVENT_DELETE_SELECTION, EVENT_ENTERING_KEY_GUARD, EVENT_HEADSET_STATUS, EVENT_HINGE_CHANGED, EVENT_ICON_GALLERY_UPDATED, EVENT_ICON_RECORD_UPDATED, EVENT_IM_SERVICES, EVENT_IMAGE_GALLERY_CONTROLLER_UPDATED, EVENT_IN_PHONE_STATUS, EVENT_INPUT_METHOD, EVENT_INVALID, EVENT_IP_ADDRESS, EVENT_JUMP_SHORTCUTS_CHANGED, EVENT_KEY_DOWN, EVENT_KEY_HELD, EVENT_KEY_META, EVENT_KEY_REPEAT, EVENT_KEY_UP, EVENT_LEAVING_KEY_GUARD, EVENT_LINK_TEXT_BOX_HAS_PAGED_DOWN, EVENT_LINK_TEXT_BOX_HAS_PAGED_UP, EVENT_LOADER, EVENT_LOW_MEMORY, EVENT_MAILTO_LINK_ADD_CONTACT, EVENT_MEDIA_PLAYER_STATE_CHANGED, EVENT_MENU_HIDDEN, EVENT_MENU_SHOWN, EVENT_MESSAGE, EVENT_MIDLET_DISPLAY_CLEARED, EVENT_MIDLET_DISPLAY_OBSCURED, EVENT_MIDLET_FUNNEL_TRANSACTION, EVENT_MINUTE_TICK, EVENT_MODIFIER_ALT, EVENT_MODIFIER_BACK_BUTTON, EVENT_MODIFIER_CANCEL_BUTTON, EVENT_MODIFIER_CAPS, EVENT_MODIFIER_JUMP_BUTTON, EVENT_MODIFIER_MENU_BUTTON, EVENT_MODIFIER_NONE, EVENT_MODIFIER_SYM, EVENT_MODIFIER_TRACKBALL, EVENT_MODIFIER_WHEEL, EVENT_NETWORK_ACTIVITY, EVENT_NETWORK_ERROR, EVENT_NETWORK_STATUS, EVENT_NUM_ACTIVE_VOICE_CALLS_CHANGED, EVENT_OPEN_LINK, EVENT_PASTE, EVENT_PDP_CONTEXT_ACTIVATION_ERROR, EVENT_PERIODIC_PULSE, EVENT_PHONE_LINK_ADD_CONTACT, EVENT_PHONE_STANDBY_TEXT_CHANGED, EVENT_PHOTO_GALLERY, EVENT_PHOTO_GALLERY_PROXY, EVENT_PHOTO_PROXY_RECORD_CONTAINER, EVENT_PHOTO_RECORD, EVENT_PHOTO_RECORD_UPDATED, EVENT_POWER, EVENT_POWER_ON, EVENT_POWER_SWITCH_DOWN, EVENT_POWER_SWITCH_UP, EVENT_PREFERENCES_CHANGED, EVENT_PROFILE_CHANGED, EVENT_RADIO_RESET, EVENT_RADIO_STATE_CHANGE, EVENT_RAW_KEY_DOWN, EVENT_RAW_KEY_HELD, EVENT_RAW_KEY_REPEAT, EVENT_RAW_KEY_UP, EVENT_REDO, EVENT_ROAM_STATUS, EVENT_SCREEN_WINDOW_ACTIVATED, EVENT_SCREEN_WINDOW_DEACTIVATED, EVENT_SELECT_ALL, EVENT_SEND_LINK, EVENT_SETTINGSDB_FLUSHED, EVENT_SHORTCUT, EVENT_SHOW_EMERGENCY_SCREEN, EVENT_SIGNAL_STRENGTH, EVENT_SIM_PRESENCE, EVENT_SIM_UNLOCKED, EVENT_STOP_TEST_KEYPAD, EVENT_STORAGE_DEVICE_STATE_CHANGED, EVENT_SYSTEM_LAST, EVENT_SYSTEM_STYLE_CHANGED, EVENT_TIME_CHANGED, EVENT_TIME_FORMAT_CHANGED, EVENT_TIMER, EVENT_UNDO, EVENT_USB_DATA, EVENT_USB_STATUS, EVENT_WIDGET_DOWN, EVENT_WIDGET_HELD, EVENT_WIDGET_UP, EVENT_WINDOW_ACTIVATED, EVENT_WINDOW_DEACTIVATED, EVENT_WINDOW_PAINT, MESSAGE_GOTO_URL, MESSAGE_GOTO_URL_IN_BACKGROUND, NAME_CHANGED, RECORD_ADDED, RECORD_PENDING, RECORD_REMOVED, RECORD_ROTATED, RECORD_UPDATED, SELECTION_CHANGED, SORT_CHANGED, UID_CHANGED, WHAT_AT_COMMAND_TIMEOUT, WHAT_BATTERY_COVER_REMOVED, WHAT_BATTERY_COVER_REPLACED, WHAT_BLUETOOTH_OFF, WHAT_BLUETOOTH_ON, WHAT_CAMERA_JACKED_IN, WHAT_CAMERA_JACKED_OUT, WHAT_CHANNEL_WRITE_TIMEOUT, WHAT_CMUX_BAD_CHECKSUM, WHAT_HEADSET_JACKED_IN, WHAT_HEADSET_JACKED_OUT, WHAT_HINGE_CLOSED, WHAT_HINGE_OPENED, WHAT_LOW_DATA, WHAT_LOW_HANDLES, WHAT_MEDIA_PLAYER_HIDE_MINI, WHAT_MEDIA_PLAYER_PAUSE_TRACK, WHAT_MEDIA_PLAYER_SHOW_MINI, WHAT_MEDIA_PLAYER_START_TRACK, WHAT_MEDIA_PLAYER_STOP_TRACK, WHAT_MEDIA_PLAYER_UPDATE_TRACK, WHAT_NETWORK_IP_DEAD, WHAT_NETWORK_PERSONALIZATION_RESTORED, WHAT_NETWORK_PERSONALIZATION_SAVED, WHAT_NVMEM_ERASED, WHAT_OUT_OF_BUFFERS, WHAT_PDP_ACTIVATE_TIMEOUT, WHAT_POSITION_REACHED, WHAT_RADIO_FIRMWARE_FIXED, WHAT_RADIO_IGNORED_LOW_POWER_REQUEST, WHAT_RADIO_RESET, WHAT_RADIO_WONT_WAKE, WHAT_RECORDING_ABORTED, WHAT_RECORDING_STARTED, WHAT_RECORDING_STOPPED, WHAT_SEQUENCE_LOOPED, WHAT_SEQUENCE_PURGED, WHAT_SEQUENCE_STOPPED, WHAT_SERIAL_WRITE_TIMEOUT, WHAT_SIM_ARRIVES, WHAT_SIM_DEPARTS, WHAT_SIM_HARDWARE_ERROR, WHAT_SIM_INIT_TIMEOUT, WHAT_SOUND_LOOPED, WHAT_SOUND_PURGED, WHAT_SOUND_STOPPED, WHAT_SPEAKER_BLUETOOTH, WHAT_SPEAKER_HEADSET, WHAT_SPEAKER_INTERNAL, WHAT_SPEAKER_SPEAKERPHONE, WHAT_STAR_99_POUND_ERROR, WHAT_STORAGE_DEVICE_INSERTED, WHAT_STORAGE_DEVICE_MODIFIED, WHAT_STORAGE_DEVICE_MOUNTED, WHAT_STORAGE_DEVICE_PUBLISHED, WHAT_STORAGE_DEVICE_REMOVED, WHAT_STORAGE_DEVICE_UNMOUNTED, WHAT_STORAGE_DEVICE_UNPUBLISHED, WHAT_STREAM_LOOPED, WHAT_STREAM_STOPPED, WHAT_SYSTEM_LOADED, WHAT_TONE_INSTALLED, WHAT_TONE_REMOVED, WHAT_TONE_START, WHAT_TONE_STOP, WHAT_UART_BREAK, WHAT_UART_FRAMING_ERROR, WHAT_UART_OVERRUN
 
Constructor Summary
Event()
           
Event(Event e)
           
Event(int type)
           
Event(int type, int what)
           
Event(int type, int what, int data)
           
Event(int type, int what, int data, Object argument)
           
Event(int type, int what, Object argument)
           
Event(Listener target, int type)
           
Event(Listener target, int type, int what)
           
Event(Listener target, int type, int what, int data)
           
Event(Listener target, int type, int what, int data, int modifiers)
           
Event(Listener target, int type, int what, int data, int modifiers, int timestamp, Object argument)
           
Event(Listener target, int type, int what, int data, Object argument)
           
 
Method Summary
 void debugPrint()
           
 void debugPrint(String beforeMessage, String afterMessage)
           
 void debugPrint(String beforeMessage, String afterMessage, boolean ignoreTorrential)
           
static void debugPrintFilterAdd(String name)
           
static void debugPrintFilterAddAll()
           
static void debugPrintFilterClear()
           
static void debugPrintFilterDump()
           
static void debugPrintFilterRemove(String name)
           
 byte getHorizontalCount()
           Return the horizontal component of a navigation event.
 Listener getListener()
          Deprecated.  deprecated Use Event.target instead.
 byte getVerticalCount()
           Return the vertical component of a navigation event.
 int getWheelCount()
          Return the wheel count, for events that coalesce wheel movement into one event.
 boolean isKeyEvent()
          Return whether the event is a "key" event.
 boolean isMenuEvent()
          Return whether the event is a "menu" event.
 boolean isUIEvent()
          Return whether the event is a "UI" event, such as a button click, or keypress.
static Event makeBlankEvent()
          Construct an event with all fields set to 0 / null, including particularly the timestamp, which is normally set to be the current time.
 boolean modifierIsActive(int modifierMask)
          Determine if the specified modifier key or button was held for this event.
 boolean modifierIsChorded()
           Determines if the event modifier signifies that a modifier key or button was held during the event.
 void sendToTarget()
           
 void setArgument(Object arg)
          Deprecated.  deprecated Use Event.argument = instead.
 void setListener(Listener inListener)
          Deprecated.  deprecated Use Event.target = instead.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

public int type
Event type ID. Negative numbers are system events. Positive numbers are application-specific events.


what

public int what
Event specifier. Often indicates event sub-type (ie keycode).


keycode

public int keycode
For key events contains the raw keycode


data

public int data
Additional event-specific data. In key events this will be the "key identity" used to match against shortcuts -- currently always a letter of the alphabet, a digit, '@', '.', or one other locale-specific punctuation character. In widget-down events (but alas, only in the 2.3 release and later) this will be EventType.EVENT_RAW_KEY_REPEAT if it is actually a widget-repeat instead of a widget-down.


modifiers

public int modifiers
Event modifiers. A bitwise inclusive or mask of 0 or more of the following keyboard meta modifiers:
   EVENT_MODIFIER_CAPS
   EVENT_MODIFIER_ALT
   EVENT_MODIFIER_SYM
   EVENT_MODIFIER_BACK_BUTTON
   EVENT_MODIFIER_MENU_BUTTON
   EVENT_MODIFIER_JUMP_BUTTON
   EVENT_MODIFIER_TRACKBALL
 


timestamp

public int timestamp
Timestamp of when the event happened.


argument

public Object argument
arbitrary Object


target

public Listener target
Where to route the event on receipt.

Constructor Detail

Event

public Event(Listener target,
             int type,
             int what,
             int data,
             int modifiers,
             int timestamp,
             Object argument)

Event

public Event(Listener target,
             int type,
             int what,
             int data,
             Object argument)

Event

public Event(Listener target,
             int type,
             int what,
             int data,
             int modifiers)

Event

public Event(int type,
             int what,
             int data,
             Object argument)

Event

public Event(int type,
             int what,
             Object argument)

Event

public Event(int type,
             int what,
             int data)

Event

public Event(int type,
             int what)

Event

public Event(int type)

Event

public Event()

Event

public Event(Listener target,
             int type,
             int what,
             int data)

Event

public Event(Listener target,
             int type,
             int what)

Event

public Event(Listener target,
             int type)

Event

public Event(Event e)
Method Detail

makeBlankEvent

public static Event makeBlankEvent()
Construct an event with all fields set to 0 / null, including particularly the timestamp, which is normally set to be the current time.

Returns:
non-null; a newly-allocated blank event

setListener

public void setListener(Listener inListener)
Deprecated.  deprecated Use Event.target = instead.


getListener

public Listener getListener()
Deprecated.  deprecated Use Event.target instead.


setArgument

public void setArgument(Object arg)
Deprecated.  deprecated Use Event.argument = instead.


sendToTarget

public void sendToTarget()

modifierIsActive

public boolean modifierIsActive(int modifierMask)
Determine if the specified modifier key or button was held for this event. In the case of EventType.EVENT_MODIFIER_TRACKBALL, this indicates that the event originated from a movement of the trackball.

Parameters:
modifierMask - one or more of the following: EventType.EVENT_MODIFIER_CAPS, EventType.EVENT_MODIFIER_ALT, EventType.EVENT_MODIFIER_SYM, EventType.EVENT_MODIFIER_BACK_BUTTON, EventType.EVENT_MODIFIER_MENU_BUTTON, EventType.EVENT_MODIFIER_JUMP_BUTTON, EventType.EVENT_MODIFIER_TRACKBALL.

modifierIsChorded

public boolean modifierIsChorded()

Determines if the event modifier signifies that a modifier key or button was held during the event.

Note that this is different from checking Event.modifiers != 0, since the modifiers field may include EventType.EVENT_MODIFIER_TRACKBALL or EventType.EVENT_MODIFIER_WHEEL even if the event was not chorded.


getWheelCount

public int getWheelCount()
Return the wheel count, for events that coalesce wheel movement into one event. Otherwise return 1.


getHorizontalCount

public byte getHorizontalCount()

Return the horizontal component of a navigation event.

This returns the amount of horizontal movement of the navigation device. It is only relevant for events where the type is EventType.DEVICE_NAVIGATION.

Since:
3.0
See Also:
getVerticalCount()

getVerticalCount

public byte getVerticalCount()

Return the vertical component of a navigation event.

This returns the amount of vertical movement of the navigation device. It is only relevant for events where the type is EventType.DEVICE_NAVIGATION.

Since:
3.0
See Also:
getHorizontalCount()

isKeyEvent

public boolean isKeyEvent()
Return whether the event is a "key" event. A key event happens when a key goes down, repeats, or goes up.


isMenuEvent

public boolean isMenuEvent()
Return whether the event is a "menu" event.


isUIEvent

public boolean isUIEvent()
Return whether the event is a "UI" event, such as a button click, or keypress.


debugPrint

public void debugPrint(String beforeMessage,
                       String afterMessage,
                       boolean ignoreTorrential)

debugPrint

public void debugPrint()

debugPrint

public void debugPrint(String beforeMessage,
                       String afterMessage)

debugPrintFilterAdd

public static void debugPrintFilterAdd(String name)

debugPrintFilterRemove

public static void debugPrintFilterRemove(String name)

debugPrintFilterClear

public static void debugPrintFilterClear()

debugPrintFilterDump

public static void debugPrintFilterDump()

debugPrintFilterAddAll

public static void debugPrintFilterAddAll()