diff options
| author | Svetoslav Ganov <svetoslavganov@google.com> | 2012-05-29 17:30:16 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-05-29 17:30:16 -0700 |
| commit | a5c896afe89aaf40166343232d85980b94974032 (patch) | |
| tree | c0b7dd20b4284670ce1eb981153981f85ee96dcd /core/java/android/widget/TextView.java | |
| parent | 48d1daca98703a470f04b4e217d9e6dae6d61dd2 (diff) | |
| parent | 39f2aee640eea62b43fa79f28dec3a962e5cb065 (diff) | |
Merge "Updating the behaviour of accessibility text iterators." into jb-dev
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); |
