am ed90811e: Do not peform a click/move if longpress has been performed in WebTextView.
Merge commit 'ed90811e711065bcc82a45f4173587cd95ef6b6f' into eclair-mr2-plus-aosp * commit 'ed90811e711065bcc82a45f4173587cd95ef6b6f': Do not peform a click/move if longpress has been performed in WebTextView.
This commit is contained in:
@@ -103,6 +103,9 @@ import java.util.ArrayList;
|
|||||||
// do not want to pass this change to webkit.
|
// do not want to pass this change to webkit.
|
||||||
private boolean mFromSetInputType;
|
private boolean mFromSetInputType;
|
||||||
private boolean mGotTouchDown;
|
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;
|
private boolean mInSetTextAndKeepSelection;
|
||||||
// Array to store the final character added in onTextChanged, so that its
|
// Array to store the final character added in onTextChanged, so that its
|
||||||
// KeyEvents may be determined.
|
// KeyEvents may be determined.
|
||||||
@@ -453,8 +456,13 @@ import java.util.ArrayList;
|
|||||||
mDragSent = false;
|
mDragSent = false;
|
||||||
mScrolled = false;
|
mScrolled = false;
|
||||||
mGotTouchDown = true;
|
mGotTouchDown = true;
|
||||||
|
mHasPerformedLongClick = false;
|
||||||
break;
|
break;
|
||||||
case MotionEvent.ACTION_MOVE:
|
case MotionEvent.ACTION_MOVE:
|
||||||
|
if (mHasPerformedLongClick) {
|
||||||
|
mGotTouchDown = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
int slop = ViewConfiguration.get(mContext).getScaledTouchSlop();
|
int slop = ViewConfiguration.get(mContext).getScaledTouchSlop();
|
||||||
Spannable buffer = getText();
|
Spannable buffer = getText();
|
||||||
int initialScrollX = Touch.getInitialScrollX(this, buffer);
|
int initialScrollX = Touch.getInitialScrollX(this, buffer);
|
||||||
@@ -478,6 +486,7 @@ import java.util.ArrayList;
|
|||||||
mScrollX / maxScrollX : 0, mScrollY);
|
mScrollX / maxScrollX : 0, mScrollY);
|
||||||
}
|
}
|
||||||
mScrolled = true;
|
mScrolled = true;
|
||||||
|
cancelLongPress();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (Math.abs((int) event.getX() - mDragStartX) < slop
|
if (Math.abs((int) event.getX() - mDragStartX) < slop
|
||||||
@@ -504,6 +513,10 @@ import java.util.ArrayList;
|
|||||||
return false;
|
return false;
|
||||||
case MotionEvent.ACTION_UP:
|
case MotionEvent.ACTION_UP:
|
||||||
case MotionEvent.ACTION_CANCEL:
|
case MotionEvent.ACTION_CANCEL:
|
||||||
|
if (mHasPerformedLongClick) {
|
||||||
|
mGotTouchDown = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!mScrolled) {
|
if (!mScrolled) {
|
||||||
// If the page scrolled, or the TextView scrolled, we do not
|
// If the page scrolled, or the TextView scrolled, we do not
|
||||||
// want to change the selection
|
// want to change the selection
|
||||||
@@ -547,6 +560,12 @@ import java.util.ArrayList;
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean performLongClick() {
|
||||||
|
mHasPerformedLongClick = true;
|
||||||
|
return super.performLongClick();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove this WebTextView from its host WebView, and return
|
* Remove this WebTextView from its host WebView, and return
|
||||||
* focus to the host.
|
* focus to the host.
|
||||||
|
|||||||
Reference in New Issue
Block a user