diff options
| author | Dianne Hackborn <hackbod@google.com> | 2009-07-23 19:01:31 -0700 |
|---|---|---|
| committer | Dianne Hackborn <hackbod@google.com> | 2009-07-24 17:30:15 -0700 |
| commit | ddca3ee3e86fbaa05c1528bd72afd955f0fb4ee6 (patch) | |
| tree | 8ebc21b041c8abb73e648ff9edc31a665901ae15 /core/java/android/view/KeyEvent.java | |
| parent | 8e4ac7140a038ca135c5981700efc75a0ad59765 (diff) | |
Add support for power keys, improve behavior of virtual keys.
The platform now knows how to deal with a platform key, which at this
point is "just like end call, but don't end a call."
Also improve the handling of virtual keys, to allow for canceling when
sliding off into the display and providing haptic feedback.
Finally fixes a bug where the raw x and y in motion event were not
always set which caused the status bar to not work.
Diffstat (limited to 'core/java/android/view/KeyEvent.java')
| -rw-r--r-- | core/java/android/view/KeyEvent.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java index 6349288b7e4b..f9b16fc9f1a5 100644 --- a/core/java/android/view/KeyEvent.java +++ b/core/java/android/view/KeyEvent.java @@ -258,6 +258,25 @@ public class KeyEvent implements Parcelable { public static final int FLAG_EDITOR_ACTION = 0x10; /** + * When associated with up key events, this indicates that the key press + * has been canceled. Typically this is used with virtual touch screen + * keys, where the user can slide from the virtual key area on to the + * display: in that case, the application will receive a canceled up + * event and should not perform the action normally associated with the + * key. Note that for this to work, the application can not perform an + * action for a key until it receives an up or the long press timeout has + * expired. + */ + public static final int FLAG_CANCELED = 0x20; + + /** + * This key event was generated by a virtual (on-screen) hard key area. + * Typically this is an area of the touchscreen, outside of the regular + * display, dedicated to "hardware" buttons. + */ + public static final int FLAG_VIRTUAL_HARD_KEY = 0x40; + + /** * Returns the maximum keycode. */ public static int getMaxKeyCode() { @@ -694,6 +713,14 @@ public class KeyEvent implements Parcelable { } /** + * For {@link #ACTION_UP} events, indicates that the event has been + * canceled as per {@link #FLAG_CANCELED}. + */ + public final boolean isCanceled() { + return (mFlags&FLAG_CANCELED) != 0; + } + + /** * Retrieve the key code of the key event. This is the physical key that * was pressed, <em>not</em> the Unicode character. * |
