Fix: Drag handle isn't updated after crossing bidi boundary.

mDrawable is updated, but it was not re-drawn properly.
postInvalidate() should be called when the drawable is
updated.

Bug: 21141841
Change-Id: Icb3ddf18d05285ffa8758a9be256482d594ab8ed
This commit is contained in:
Keisuke Kuroyanagi
2015-05-14 20:10:57 +09:00
parent aee0c2ce39
commit 33f81ac108

View File

@@ -3426,9 +3426,13 @@ public class Editor {
protected void updateDrawable() {
final int offset = getCurrentCursorOffset();
final boolean isRtlCharAtOffset = mTextView.getLayout().isRtlCharAt(offset);
final Drawable oldDrawable = mDrawable;
mDrawable = isRtlCharAtOffset ? mDrawableRtl : mDrawableLtr;
mHotspotX = getHotspotX(mDrawable, isRtlCharAtOffset);
mHorizontalGravity = getHorizontalGravity(isRtlCharAtOffset);
if (oldDrawable != mDrawable) {
postInvalidate();
}
}
protected abstract int getHotspotX(Drawable drawable, boolean isRtlRun);