summaryrefslogtreecommitdiffstats
path: root/core/java/android/widget/TextView.java
diff options
context:
space:
mode:
authorGilles Debunne <debunne@google.com>2010-08-26 14:48:48 -0700
committerGilles Debunne <debunne@google.com>2010-08-26 14:48:48 -0700
commitfc2563ba4e9c93ed803f3ce540f92f199f848036 (patch)
treea2157a6c4678af10aa28115edf16d4f030475d1e /core/java/android/widget/TextView.java
parentc70bd1921bbc4046d0caf84959e5f1c2d526769a (diff)
parentf309c7a869b968465619077c78922cf3f95a629d (diff)
downloadframeworks_base-fc2563ba4e9c93ed803f3ce540f92f199f848036.zip
frameworks_base-fc2563ba4e9c93ed803f3ce540f92f199f848036.tar.gz
frameworks_base-fc2563ba4e9c93ed803f3ce540f92f199f848036.tar.bz2
resolved conflicts for merge of f309c7a8 to master
Change-Id: I80dfe8a0b142fa95fa83d46f3b60223c2991fce3
Diffstat (limited to 'core/java/android/widget/TextView.java')
-rw-r--r--core/java/android/widget/TextView.java63
1 files changed, 32 insertions, 31 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index ec54e9d..92d6158 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -7174,6 +7174,38 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
return (((long) start) << 32) | end;
}
+ private void selectCurrentWord() {
+ // In case selection mode is started after an orientation change or after a select all,
+ // use the current selection instead of creating one
+ if (hasSelection()) {
+ return;
+ }
+
+ int selectionStart, selectionEnd;
+
+ // selectionModifierCursorController is not null at that point
+ SelectionModifierCursorController selectionModifierCursorController =
+ ((SelectionModifierCursorController) mSelectionModifierCursorController);
+ int minOffset = selectionModifierCursorController.getMinTouchOffset();
+ int maxOffset = selectionModifierCursorController.getMaxTouchOffset();
+
+ long wordLimits = getWordLimitsAt(minOffset);
+ if (wordLimits >= 0) {
+ selectionStart = (int) (wordLimits >>> 32);
+ } else {
+ selectionStart = Math.max(minOffset - 5, 0);
+ }
+
+ wordLimits = getWordLimitsAt(maxOffset);
+ if (wordLimits >= 0) {
+ selectionEnd = (int) (wordLimits & 0x00000000FFFFFFFFL);
+ } else {
+ selectionEnd = Math.min(maxOffset + 5, mText.length());
+ }
+
+ Selection.setSelection((Spannable) mText, selectionStart, selectionEnd);
+ }
+
@Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
if (!isShown()) {
@@ -7470,37 +7502,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
}
- private void selectCurrentWord() {
- // In case selection mode is started after an orientation change, use the current
- // selection instead of creating one
- if (hasSelection()) {
- return;
- }
-
- int selectionStart, selectionEnd;
-
- SelectionModifierCursorController selectionModifierCursorController =
- ((SelectionModifierCursorController) mSelectionModifierCursorController);
- int minOffset = selectionModifierCursorController.getMinTouchOffset();
- int maxOffset = selectionModifierCursorController.getMaxTouchOffset();
-
- long wordLimits = getWordLimitsAt(minOffset);
- if (wordLimits >= 0) {
- selectionStart = (int) (wordLimits >>> 32);
- } else {
- selectionStart = Math.max(minOffset - 5, 0);
- }
-
- wordLimits = getWordLimitsAt(maxOffset);
- if (wordLimits >= 0) {
- selectionEnd = (int) (wordLimits & 0x00000000FFFFFFFFL);
- } else {
- selectionEnd = Math.min(maxOffset + 5, mText.length());
- }
-
- Selection.setSelection((Spannable) mText, selectionStart, selectionEnd);
- }
-
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return true;