am beabcb92: Merge "Fix Insertion ActionMode not showing on RTL languages" into mnc-dev

* commit 'beabcb92cbdec6f68bd712c9972e6f8377b78f46':
  Fix Insertion ActionMode not showing on RTL languages
This commit is contained in:
Raph Levien
2015-08-12 21:07:43 +00:00
committed by Android Git Automerger
2 changed files with 11 additions and 3 deletions

View File

@@ -3308,7 +3308,7 @@ public class Editor {
mSelectionBounds.set(
primaryHorizontal,
layout.getLineTop(line),
primaryHorizontal + 1,
primaryHorizontal,
layout.getLineTop(line + 1) + mHandleHeight);
}
// Take TextView's padding and scroll into account.

View File

@@ -194,8 +194,16 @@ public class FloatingActionMode extends ActionMode {
mContext.getResources().getDisplayMetrics().widthPixels,
mContext.getResources().getDisplayMetrics().heightPixels);
return Rect.intersects(mContentRectOnScreen, mScreenRect)
&& Rect.intersects(mContentRectOnScreen, mViewRectOnScreen);
return intersectsClosed(mContentRectOnScreen, mScreenRect)
&& intersectsClosed(mContentRectOnScreen, mViewRectOnScreen);
}
/*
* Same as Rect.intersects, but includes cases where the rectangles touch.
*/
private static boolean intersectsClosed(Rect a, Rect b) {
return a.left <= b.right && b.left <= a.right
&& a.top <= b.bottom && b.top <= a.bottom;
}
@Override