From 33f81ac108bd4d0ec709107e5ba1748221fc39e8 Mon Sep 17 00:00:00 2001 From: Keisuke Kuroyanagi Date: Thu, 14 May 2015 20:10:57 +0900 Subject: [PATCH] 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 --- core/java/android/widget/Editor.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index a1194f7dfa95f..3edac3b34ee45 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -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);