Loading core/java/android/widget/TextView.java +24 −8 Original line number Diff line number Diff line Loading @@ -8738,11 +8738,14 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener return false; } if (!hasSelection()) { // There may already be a selection on device rotation boolean currentWordSelected = selectCurrentWord(); if (!currentWordSelected) { // No word found under cursor or text selection not permitted. return false; } } ActionMode.Callback actionModeCallback = new SelectionActionModeCallback(); mSelectionActionMode = startActionMode(actionModeCallback); Loading Loading @@ -9057,6 +9060,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener private int mContainerPositionX, mContainerPositionY; // Visible or not (scrolled off screen), whether or not this handle should be visible private boolean mIsActive = false; // Used to detect that setFrame was called private boolean mNeedsUpdate = true; public HandleView() { super(TextView.this.mContext); Loading @@ -9074,6 +9079,15 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener mIdealVerticalOffset = 0.7f * handleHeight; } @Override protected boolean setFrame(int left, int top, int right, int bottom) { boolean changed = super.setFrame(left, top, right, bottom); // onPreDraw is called for PhoneWindow before the layout of this view is // performed. Make sure to update position, even if container didn't move. if (changed) mNeedsUpdate = true; return changed; } protected abstract void initDrawable(); // Touch-up filter: number of previous positions remembered Loading Loading @@ -9222,7 +9236,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener mPositionY += viewportToContentVerticalOffset(); } protected boolean updateContainerPosition() { private void checkForContainerPositionChange() { positionAtCursorOffset(getCurrentCursorOffset()); final int previousContainerPositionX = mContainerPositionX; Loading @@ -9232,12 +9246,13 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener mContainerPositionX = mTempCoords[0] + mPositionX; mContainerPositionY = mTempCoords[1] + mPositionY; return (previousContainerPositionX != mContainerPositionX || previousContainerPositionY != mContainerPositionY); mNeedsUpdate |= previousContainerPositionX != mContainerPositionX; mNeedsUpdate |= previousContainerPositionY != mContainerPositionY; } public boolean onPreDraw() { if (updateContainerPosition()) { checkForContainerPositionChange(); if (mNeedsUpdate) { if (mIsDragging) { if (mTempCoords[0] != mLastParentX || mTempCoords[1] != mLastParentY) { mTouchToWindowOffsetX += mTempCoords[0] - mLastParentX; Loading @@ -9261,6 +9276,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener dismiss(); } } mNeedsUpdate = false; } return true; } Loading Loading
core/java/android/widget/TextView.java +24 −8 Original line number Diff line number Diff line Loading @@ -8738,11 +8738,14 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener return false; } if (!hasSelection()) { // There may already be a selection on device rotation boolean currentWordSelected = selectCurrentWord(); if (!currentWordSelected) { // No word found under cursor or text selection not permitted. return false; } } ActionMode.Callback actionModeCallback = new SelectionActionModeCallback(); mSelectionActionMode = startActionMode(actionModeCallback); Loading Loading @@ -9057,6 +9060,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener private int mContainerPositionX, mContainerPositionY; // Visible or not (scrolled off screen), whether or not this handle should be visible private boolean mIsActive = false; // Used to detect that setFrame was called private boolean mNeedsUpdate = true; public HandleView() { super(TextView.this.mContext); Loading @@ -9074,6 +9079,15 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener mIdealVerticalOffset = 0.7f * handleHeight; } @Override protected boolean setFrame(int left, int top, int right, int bottom) { boolean changed = super.setFrame(left, top, right, bottom); // onPreDraw is called for PhoneWindow before the layout of this view is // performed. Make sure to update position, even if container didn't move. if (changed) mNeedsUpdate = true; return changed; } protected abstract void initDrawable(); // Touch-up filter: number of previous positions remembered Loading Loading @@ -9222,7 +9236,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener mPositionY += viewportToContentVerticalOffset(); } protected boolean updateContainerPosition() { private void checkForContainerPositionChange() { positionAtCursorOffset(getCurrentCursorOffset()); final int previousContainerPositionX = mContainerPositionX; Loading @@ -9232,12 +9246,13 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener mContainerPositionX = mTempCoords[0] + mPositionX; mContainerPositionY = mTempCoords[1] + mPositionY; return (previousContainerPositionX != mContainerPositionX || previousContainerPositionY != mContainerPositionY); mNeedsUpdate |= previousContainerPositionX != mContainerPositionX; mNeedsUpdate |= previousContainerPositionY != mContainerPositionY; } public boolean onPreDraw() { if (updateContainerPosition()) { checkForContainerPositionChange(); if (mNeedsUpdate) { if (mIsDragging) { if (mTempCoords[0] != mLastParentX || mTempCoords[1] != mLastParentY) { mTouchToWindowOffsetX += mTempCoords[0] - mLastParentX; Loading @@ -9261,6 +9276,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener dismiss(); } } mNeedsUpdate = false; } return true; } Loading