diff options
| author | Svetoslav Ganov <svetoslavganov@google.com> | 2012-05-29 17:32:39 -0700 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2012-05-29 17:32:39 -0700 |
| commit | 378aa011d5f989166b62e9db6328a5881a1a73a0 (patch) | |
| tree | 429829753fe020eb7eda3ea04f132dab90debe30 /core/java/android/widget/TextView.java | |
| parent | b554ee35853369e898d5feea9ea4b6667a682dac (diff) | |
| parent | a5c896afe89aaf40166343232d85980b94974032 (diff) | |
am a5c896af: Merge "Updating the behaviour of accessibility text iterators." into jb-dev
* commit 'a5c896afe89aaf40166343232d85980b94974032':
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 bd19f001590f..3e2d43a3f654 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -8376,10 +8376,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(); } /** @@ -8391,7 +8393,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); |
