diff options
| author | 2011-02-07 17:11:41 -0800 | |
|---|---|---|
| committer | 2011-02-07 17:11:41 -0800 | |
| commit | 299733e2b40e77d6d08c749fa8dd8a783857ee0e (patch) | |
| tree | 86cf8870359f88e5670482b8b90655039bf8c9e9 | |
| parent | f313e95821cdb7e9dca8e61d87747064a63e807b (diff) | |
CTRL+A simply highlights all text.
Bug 3351442
It does not start text selection mode, and does not display selection
handles. Just like a selectAllOnFocus does.
Change-Id: I3b6df3c57abb7cc2cd03a0a67896faeec2ec631f
| -rw-r--r-- | core/java/android/widget/TextView.java | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 772eefd8be66..28b106bc4be4 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -8012,11 +8012,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener return true; case ID_SELECT_ALL: + // This does not enter text selection mode. Text is highlighted, so that it can be + // bulk edited, like selectAllOnFocus does. selectAll(); - // Update controller positions after selection change. - if (hasSelectionController()) { - getSelectionController().show(); - } return true; case ID_PASTE: @@ -8134,6 +8132,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener return true; } + boolean handled = false; + // Long press in empty space moves cursor and shows the Paste affordance if available. if (!isPositionOnText(mLastDownPositionX, mLastDownPositionY) && mInsertionControllerEnabled) { @@ -8141,11 +8141,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener stopSelectionActionMode(); Selection.setSelection((Spannable)mText, offset); getInsertionController().show(0); - mDiscardNextActionUp = true; - return true; + handled = true; } - if (mSelectionActionMode != null) { + if (!handled && mSelectionActionMode != null) { if (touchPositionIsInSelection()) { // Start a drag final int start = getSelectionStart(); @@ -8156,21 +8155,21 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener startDrag(data, getTextThumbnailBuilder(selectedText), localState, 0); stopSelectionActionMode(); } else { + // New selection at touch position updateSelectedRegion(); } - performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); - mDiscardNextActionUp = true; - return true; + handled = true; } // Start a new selection - if (startSelectionActionMode()) { + handled |= !handled && startSelectionActionMode(); + + if (handled) { performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); mDiscardNextActionUp = true; - return true; } - return false; + return handled; } /** |