diff options
author | Leon Scroggins <scroggo@google.com> | 2009-12-01 10:45:24 -0500 |
---|---|---|
committer | Leon Scroggins <scroggo@google.com> | 2009-12-01 11:39:46 -0500 |
commit | ed90811e711065bcc82a45f4173587cd95ef6b6f (patch) | |
tree | 426ccaec2f12456a1c21ac554375636f31e6c3c6 /core | |
parent | 51e45ff0d53ce299be316e14e48cdd3e3a51d0b0 (diff) | |
download | frameworks_base-ed90811e711065bcc82a45f4173587cd95ef6b6f.zip frameworks_base-ed90811e711065bcc82a45f4173587cd95ef6b6f.tar.gz frameworks_base-ed90811e711065bcc82a45f4173587cd95ef6b6f.tar.bz2 |
Do not peform a click/move if longpress has been performed in WebTextView.
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/webkit/WebTextView.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java index 71b1f9f..412e0d9 100644 --- a/core/java/android/webkit/WebTextView.java +++ b/core/java/android/webkit/WebTextView.java @@ -103,6 +103,9 @@ import java.util.ArrayList; // do not want to pass this change to webkit. private boolean mFromSetInputType; private boolean mGotTouchDown; + // Keep track of whether a long press has happened. Only meaningful after + // an ACTION_DOWN MotionEvent + private boolean mHasPerformedLongClick; private boolean mInSetTextAndKeepSelection; // Array to store the final character added in onTextChanged, so that its // KeyEvents may be determined. @@ -453,8 +456,13 @@ import java.util.ArrayList; mDragSent = false; mScrolled = false; mGotTouchDown = true; + mHasPerformedLongClick = false; break; case MotionEvent.ACTION_MOVE: + if (mHasPerformedLongClick) { + mGotTouchDown = false; + return false; + } int slop = ViewConfiguration.get(mContext).getScaledTouchSlop(); Spannable buffer = getText(); int initialScrollX = Touch.getInitialScrollX(this, buffer); @@ -478,6 +486,7 @@ import java.util.ArrayList; mScrollX / maxScrollX : 0, mScrollY); } mScrolled = true; + cancelLongPress(); return true; } if (Math.abs((int) event.getX() - mDragStartX) < slop @@ -504,6 +513,10 @@ import java.util.ArrayList; return false; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: + if (mHasPerformedLongClick) { + mGotTouchDown = false; + return false; + } if (!mScrolled) { // If the page scrolled, or the TextView scrolled, we do not // want to change the selection @@ -547,6 +560,12 @@ import java.util.ArrayList; return false; } + @Override + public boolean performLongClick() { + mHasPerformedLongClick = true; + return super.performLongClick(); + } + /** * Remove this WebTextView from its host WebView, and return * focus to the host. |