diff options
author | Keisuke Kuroyanagi <ksk@google.com> | 2015-06-18 03:43:42 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-18 03:43:44 +0000 |
commit | fe67c1ec6d0f08542fad2fc1a3fb858d99d40341 (patch) | |
tree | 17e9e6ef28a3e59963c2e6f45ba24c6fbac60d4b /core | |
parent | c73cd407f0e886e5d0b26dda6b82d88ac9eec36a (diff) | |
parent | dbe2c293e113b35b43abdb5733311782f9afe11c (diff) | |
download | frameworks_base-fe67c1ec6d0f08542fad2fc1a3fb858d99d40341.zip frameworks_base-fe67c1ec6d0f08542fad2fc1a3fb858d99d40341.tar.gz frameworks_base-fe67c1ec6d0f08542fad2fc1a3fb858d99d40341.tar.bz2 |
Merge "Fix: Drag handle jumps between bidi boundaries." into mnc-dev
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/widget/Editor.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index bde8dcf..238d6c4 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -3568,13 +3568,24 @@ public class Editor { } protected void updateDrawable() { + if (mIsDragging) { + // Don't update drawable during dragging. + return; + } 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) { + final Layout layout = mTextView.getLayout(); + if (layout != null && oldDrawable != mDrawable && isShowing()) { + // Update popup window position. + mPositionX = (int) (layout.getPrimaryHorizontal(offset) - 0.5f - mHotspotX - + getHorizontalOffset() + getCursorOffset()); + mPositionX += mTextView.viewportToContentHorizontalOffset(); + mPositionHasChanged = true; + updatePosition(mLastParentX, mLastParentY, false, false); postInvalidate(); } } @@ -3848,10 +3859,12 @@ public class Editor { case MotionEvent.ACTION_UP: filterOnTouchUp(); mIsDragging = false; + updateDrawable(); break; case MotionEvent.ACTION_CANCEL: mIsDragging = false; + updateDrawable(); break; } return true; |