diff options
| author | Sujith Ramakrishnan <sujithrk@google.com> | 2014-05-19 15:32:13 -0700 |
|---|---|---|
| committer | Sujith Ramakrishnan <sujithrk@google.com> | 2014-07-01 15:57:45 -0700 |
| commit | cc32bd83e4d420c1adaeb3ea40f8986471e54590 (patch) | |
| tree | 197da414b65c1ebbfbbdaa0c1e102216836445ec /core/java/android/view/MotionEvent.java | |
| parent | 7de699fb68a5219f6801bf0c978fb9f739e54d3f (diff) | |
Add support for mouse-based text selection.
Incorporate patch from Logitech (donated under AOSP license) to the
framework to add mouse-based text selection to ArrowKeyMovementMethod.
Bug: 14652753
Change-Id: Iab264bb954b72ccedfada763eba8f13ef37a4578
Diffstat (limited to 'core/java/android/view/MotionEvent.java')
| -rw-r--r-- | core/java/android/view/MotionEvent.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java index 7f2defdaadeb..ae39b7aeee6d 100644 --- a/core/java/android/view/MotionEvent.java +++ b/core/java/android/view/MotionEvent.java @@ -3131,6 +3131,24 @@ public final class MotionEvent extends InputEvent implements Parcelable { return symbolicName != null ? symbolicName : Integer.toString(toolType); } + /** + * Checks if a mouse or stylus button (or combination of buttons) is pressed. + * @param button Button (or combination of buttons). + * @return True if specified buttons are pressed. + * + * @see #BUTTON_PRIMARY + * @see #BUTTON_SECONDARY + * @see #BUTTON_TERTIARY + * @see #BUTTON_FORWARD + * @see #BUTTON_BACK + */ + public final boolean isButtonPressed(int button) { + if (button == 0) { + return false; + } + return (getButtonState() & button) == button; + } + public static final Parcelable.Creator<MotionEvent> CREATOR = new Parcelable.Creator<MotionEvent>() { public MotionEvent createFromParcel(Parcel in) { |
