diff options
| author | Svetoslav Ganov <svetoslavganov@google.com> | 2012-05-29 17:38:18 -0700 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2012-05-29 17:38:18 -0700 |
| commit | b616547cd5915793ebb5f7b85e815895c54b1d93 (patch) | |
| tree | 2b7de4dd965f3798e5f469f44c291739861c9e32 /core/java/android/widget/TextView.java | |
| parent | 35742844bca9c51ae4264d0dc10f19cfdcb4ab0b (diff) | |
| parent | 378aa011d5f989166b62e9db6328a5881a1a73a0 (diff) | |
am 378aa011: am a5c896af: Merge "Updating the behaviour of accessibility text iterators." into jb-dev
* commit '378aa011d5f989166b62e9db6328a5881a1a73a0':
Updating the behaviour of accessibility text iterators.
Diffstat (limited to 'core/java/android/widget/TextView.java')
| -rw-r--r-- | core/java/android/widget/TextView.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 55055e599114..152c55b16d80 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -8363,10 +8363,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener @Override public int getAccessibilityCursorPosition() { if (TextUtils.isEmpty(getContentDescription())) { - return getSelectionEnd(); - } else { - return super.getAccessibilityCursorPosition(); + final int selectionEnd = getSelectionEnd(); + if (selectionEnd >= 0) { + return selectionEnd; + } } + return super.getAccessibilityCursorPosition(); } /** @@ -8378,7 +8380,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener return; } if (TextUtils.isEmpty(getContentDescription())) { - if (index >= 0) { + if (index >= 0 && index <= mText.length()) { Selection.setSelection((Spannable) mText, index); } else { Selection.removeSelection((Spannable) mText); |
