Merge "Fix: replace terminates extract mode (floating toolbar)" into mnc-dev

This commit is contained in:
Andrei Stingaceanu
2015-05-14 09:33:56 +00:00
committed by Android (Google) Code Review
2 changed files with 13 additions and 11 deletions

View File

@@ -286,6 +286,13 @@ public class Editor {
mUndoManager.redo(owners, 1); // Redo 1 action. mUndoManager.redo(owners, 1); // Redo 1 action.
} }
void replace() {
int middle = (mTextView.getSelectionStart() + mTextView.getSelectionEnd()) / 2;
stopSelectionActionMode();
Selection.setSelection((Spannable) mTextView.getText(), middle);
showSuggestions();
}
void onAttachedToWindow() { void onAttachedToWindow() {
if (mShowErrorAfterAttach) { if (mShowErrorAfterAttach) {
showError(); showError();
@@ -3117,10 +3124,6 @@ public class Editor {
mCustomSelectionActionModeCallback.onActionItemClicked(mode, item)) { mCustomSelectionActionModeCallback.onActionItemClicked(mode, item)) {
return true; return true;
} }
if (item.getItemId() == TextView.ID_REPLACE) {
onReplace();
return true;
}
return mTextView.onTextContextMenuItem(item.getItemId()); return mTextView.onTextContextMenuItem(item.getItemId());
} }
@@ -3194,13 +3197,6 @@ public class Editor {
} }
} }
private void onReplace() {
int middle = (mTextView.getSelectionStart() + mTextView.getSelectionEnd()) / 2;
stopSelectionActionMode();
Selection.setSelection((Spannable) mTextView.getText(), middle);
showSuggestions();
}
/** /**
* A listener to call {@link InputMethodManager#updateCursorAnchorInfo(View, CursorAnchorInfo)} * A listener to call {@link InputMethodManager#updateCursorAnchorInfo(View, CursorAnchorInfo)}
* while the input method is requesting the cursor/anchor position. Does nothing as long as * while the input method is requesting the cursor/anchor position. Does nothing as long as

View File

@@ -9051,6 +9051,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
stopSelectionActionMode(); stopSelectionActionMode();
return true; return true;
case ID_REPLACE:
if (mEditor != null) {
mEditor.replace();
}
return true;
case ID_SHARE: case ID_SHARE:
shareSelectedText(); shareSelectedText();
return true; return true;