am fee163c5: am de5cdeba: Merge "Fix Toolbar is not refreshed after Select All" into mnc-dev

* commit 'fee163c5db14b9d6df65dd7b26ab4e1f02551fd3':
  Fix Toolbar is not refreshed after Select All
This commit is contained in:
Clara Bayarri
2015-06-05 02:31:40 +00:00
committed by Android Git Automerger
2 changed files with 18 additions and 3 deletions

View File

@@ -1756,6 +1756,12 @@ public class Editor {
if (!checkFieldAndSelectCurrentWord()) {
return false;
}
// Avoid dismissing the selection if it exists.
mPreserveDetachedSelection = true;
stopTextActionMode();
mPreserveDetachedSelection = false;
getSelectionController().enterDrag();
return true;
}
@@ -3129,7 +3135,9 @@ public class Editor {
Callback customCallback = getCustomCallback();
if (customCallback != null) {
if (!customCallback.onCreateActionMode(mode, menu)) {
// The custom mode can choose to cancel the action mode
// The custom mode can choose to cancel the action mode, dismiss selection.
Selection.setSelection((Spannable) mTextView.getText(),
mTextView.getSelectionEnd());
return false;
}
}

View File

@@ -9072,9 +9072,16 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
switch (id) {
case ID_SELECT_ALL:
// This does not enter text selection mode. Text is highlighted, so that it can be
// bulk edited, like selectAllOnFocus does. Returns true even if text is empty.
// This starts an action mode if triggered from another action mode. Text is
// highlighted, so that it can be bulk edited, like selectAllOnFocus does. Returns
// true even if text is empty.
boolean shouldRestartActionMode =
mEditor != null && mEditor.mTextActionMode != null;
stopTextActionMode();
selectAllText();
if (shouldRestartActionMode) {
mEditor.startSelectionActionMode();
}
return true;
case ID_UNDO: