summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorClara Bayarri <clarabayarri@google.com>2015-04-10 17:22:39 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-04-10 17:22:42 +0000
commit94bf0d9157418d398325e7e8c1662923b848842e (patch)
tree794005b1814be62c11bd86ace33106b69384416f /core/java/android
parentfe928dac694674caa6073e81bcb0de6754f4dd1e (diff)
parentb7419dd76e6d0ff06a1d45fd8389093c9a212351 (diff)
downloadframeworks_base-94bf0d9157418d398325e7e8c1662923b848842e.zip
frameworks_base-94bf0d9157418d398325e7e8c1662923b848842e.tar.gz
frameworks_base-94bf0d9157418d398325e7e8c1662923b848842e.tar.bz2
Merge "Editor: Account for a split cursor in the content rect calculation"
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/widget/Editor.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index 5fb0c92..491826a 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -3108,6 +3108,17 @@ public class Editor {
mTextView.getSelectionStart(), mTextView.getSelectionEnd(), mSelectionPath);
mSelectionPath.computeBounds(mSelectionBounds, true);
mSelectionBounds.bottom += mSelectionHandleHeight;
+ } else if (mCursorCount == 2) {
+ // We have a split cursor. In this case, we take the rectangle that includes both
+ // parts of the cursor to ensure we don't obscure either of them.
+ Rect firstCursorBounds = mCursorDrawable[0].getBounds();
+ Rect secondCursorBounds = mCursorDrawable[1].getBounds();
+ mSelectionBounds.set(
+ Math.min(firstCursorBounds.left, secondCursorBounds.left),
+ Math.min(firstCursorBounds.top, secondCursorBounds.top),
+ Math.max(firstCursorBounds.right, secondCursorBounds.right),
+ Math.max(firstCursorBounds.bottom, secondCursorBounds.bottom)
+ + mInsertionHandleHeight);
} else {
// We have a single cursor.
int line = mTextView.getLayout().getLineForOffset(mTextView.getSelectionStart());