Loading core/java/android/widget/Editor.java +29 −7 Original line number Diff line number Diff line Loading @@ -1009,14 +1009,14 @@ public class Editor { stopSelectionActionMode(); } else { stopSelectionActionMode(); startSelectionActionModeWithSelection(); startSelectionActionModeWithSelectionAndStartDrag(); } handled = true; } // Start a new selection if (!handled) { handled = startSelectionActionModeWithSelection(); handled = startSelectionActionModeWithSelectionAndStartDrag(); } return handled; Loading Loading @@ -1686,9 +1686,34 @@ public class Editor { } /** * Starts a Selection Action Mode with the current selection and enters drag mode. This should * be used whenever the mode is started from a touch event. * * @return true if the selection mode was actually started. */ private boolean startSelectionActionModeWithSelectionAndStartDrag() { boolean selectionStarted = startSelectionActionModeWithSelectionInternal(); if (selectionStarted) { getSelectionController().enterDrag(); } return selectionStarted; } /** * Starts a Selection Action Mode with the current selection and ensures the selection handles * are shown. This should be used when the mode is started from a non-touch event. * * @return true if the selection mode was actually started. */ boolean startSelectionActionModeWithSelection() { boolean selectionStarted = startSelectionActionModeWithSelectionInternal(); if (selectionStarted) { getSelectionController().show(); } return selectionStarted; } private boolean startSelectionActionModeWithSelectionInternal() { if (mSelectionActionMode != null) { // Selection action mode is already started mSelectionActionMode.invalidate(); Loading Loading @@ -1727,10 +1752,6 @@ public class Editor { imm.showSoftInput(mTextView, 0, null); } } if (selectionStarted) { getSelectionController().enterDrag(); } return selectionStarted; } Loading Loading @@ -3099,6 +3120,7 @@ public class Editor { if (item.getIntent() != null && item.getIntent().getAction().equals(Intent.ACTION_PROCESS_TEXT)) { item.getIntent().putExtra(Intent.EXTRA_PROCESS_TEXT, mTextView.getSelectedText()); mPreserveDetachedSelection = true; mTextView.startActivityForResult( item.getIntent(), TextView.PROCESS_TEXT_REQUEST_CODE); return true; Loading Loading @@ -4237,7 +4259,7 @@ public class Editor { boolean stayedInArea = distanceSquared < doubleTapSlop * doubleTapSlop; if (stayedInArea && isPositionOnText(x, y)) { startSelectionActionModeWithSelection(); startSelectionActionModeWithSelectionAndStartDrag(); mDiscardNextActionUp = true; } } Loading core/java/android/widget/TextView.java +1 −0 Original line number Diff line number Diff line Loading @@ -9202,6 +9202,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener void replaceSelectionWithText(CharSequence text) { ((Editable) mText).replace(getSelectionStart(), getSelectionEnd(), text); mEditor.startSelectionActionModeWithSelection(); } /** Loading Loading
core/java/android/widget/Editor.java +29 −7 Original line number Diff line number Diff line Loading @@ -1009,14 +1009,14 @@ public class Editor { stopSelectionActionMode(); } else { stopSelectionActionMode(); startSelectionActionModeWithSelection(); startSelectionActionModeWithSelectionAndStartDrag(); } handled = true; } // Start a new selection if (!handled) { handled = startSelectionActionModeWithSelection(); handled = startSelectionActionModeWithSelectionAndStartDrag(); } return handled; Loading Loading @@ -1686,9 +1686,34 @@ public class Editor { } /** * Starts a Selection Action Mode with the current selection and enters drag mode. This should * be used whenever the mode is started from a touch event. * * @return true if the selection mode was actually started. */ private boolean startSelectionActionModeWithSelectionAndStartDrag() { boolean selectionStarted = startSelectionActionModeWithSelectionInternal(); if (selectionStarted) { getSelectionController().enterDrag(); } return selectionStarted; } /** * Starts a Selection Action Mode with the current selection and ensures the selection handles * are shown. This should be used when the mode is started from a non-touch event. * * @return true if the selection mode was actually started. */ boolean startSelectionActionModeWithSelection() { boolean selectionStarted = startSelectionActionModeWithSelectionInternal(); if (selectionStarted) { getSelectionController().show(); } return selectionStarted; } private boolean startSelectionActionModeWithSelectionInternal() { if (mSelectionActionMode != null) { // Selection action mode is already started mSelectionActionMode.invalidate(); Loading Loading @@ -1727,10 +1752,6 @@ public class Editor { imm.showSoftInput(mTextView, 0, null); } } if (selectionStarted) { getSelectionController().enterDrag(); } return selectionStarted; } Loading Loading @@ -3099,6 +3120,7 @@ public class Editor { if (item.getIntent() != null && item.getIntent().getAction().equals(Intent.ACTION_PROCESS_TEXT)) { item.getIntent().putExtra(Intent.EXTRA_PROCESS_TEXT, mTextView.getSelectedText()); mPreserveDetachedSelection = true; mTextView.startActivityForResult( item.getIntent(), TextView.PROCESS_TEXT_REQUEST_CODE); return true; Loading Loading @@ -4237,7 +4259,7 @@ public class Editor { boolean stayedInArea = distanceSquared < doubleTapSlop * doubleTapSlop; if (stayedInArea && isPositionOnText(x, y)) { startSelectionActionModeWithSelection(); startSelectionActionModeWithSelectionAndStartDrag(); mDiscardNextActionUp = true; } } Loading
core/java/android/widget/TextView.java +1 −0 Original line number Diff line number Diff line Loading @@ -9202,6 +9202,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener void replaceSelectionWithText(CharSequence text) { ((Editable) mText).replace(getSelectionStart(), getSelectionEnd(), text); mEditor.startSelectionActionModeWithSelection(); } /** Loading