summaryrefslogtreecommitdiffstats
path: root/core/java/android/widget/TextView.java
diff options
context:
space:
mode:
authorGilles Debunne <debunne@google.com>2012-02-29 10:59:56 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-02-29 10:59:56 -0800
commitf17981b33b0359136c0b88a92311a3140be2ba71 (patch)
tree96e6f0e9eb2e7f75f40911144a0a4e713b9ad1f0 /core/java/android/widget/TextView.java
parent0c9aa1b6fca0210353af8a153cbb0380dc83ed2d (diff)
parent9f102ca592e5bca91140c72e0962277d8731f977 (diff)
downloadframeworks_base-f17981b33b0359136c0b88a92311a3140be2ba71.zip
frameworks_base-f17981b33b0359136c0b88a92311a3140be2ba71.tar.gz
frameworks_base-f17981b33b0359136c0b88a92311a3140be2ba71.tar.bz2
Merge "Vibrate on long press, even out of text"
Diffstat (limited to 'core/java/android/widget/TextView.java')
-rw-r--r--core/java/android/widget/TextView.java19
1 files changed, 9 insertions, 10 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 0c0672d..29e9e91 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -8141,24 +8141,26 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
@Override
public boolean performLongClick() {
boolean handled = false;
- boolean vibrate = true;
if (super.performLongClick()) {
handled = true;
}
+ if (mEditor == null) {
+ return handled;
+ }
+
// Long press in empty space moves cursor and shows the Paste affordance if available.
- if (!handled && mEditor != null && !isPositionOnText(getEditor().mLastDownPositionX, getEditor().mLastDownPositionY) &&
+ if (!handled && !isPositionOnText(getEditor().mLastDownPositionX, getEditor().mLastDownPositionY) &&
getEditor().mInsertionControllerEnabled) {
final int offset = getOffsetForPosition(getEditor().mLastDownPositionX, getEditor().mLastDownPositionY);
stopSelectionActionMode();
Selection.setSelection((Spannable) mText, offset);
getInsertionController().showWithActionPopup();
handled = true;
- vibrate = false;
}
- if (!handled && mEditor != null && getEditor().mSelectionActionMode != null) {
+ if (!handled && getEditor().mSelectionActionMode != null) {
if (touchPositionIsInSelection()) {
// Start a drag
final int start = getSelectionStart();
@@ -8177,15 +8179,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
// Start a new selection
- if (!handled && mEditor != null) {
- vibrate = handled = startSelectionActionMode();
+ if (!handled) {
+ handled = startSelectionActionMode();
}
- if (vibrate) {
+ if (handled) {
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
- }
-
- if (handled && mEditor != null) {
getEditor().mDiscardNextActionUp = true;
}