diff options
author | Clara Bayarri <clarabayarri@google.com> | 2015-06-05 02:05:43 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-05 02:05:46 +0000 |
commit | de5cdebac7b50871c3ece6ccd0b2a4d7a4b384bc (patch) | |
tree | 3a969f06d4f39ff31830010e69767956cdb3a0b2 | |
parent | 6b717c66a70663ea9d8b972289a8d4d74d90bc5a (diff) | |
parent | 01243ac57e7be3c409c1238eff352c0e8acbe9ef (diff) | |
download | frameworks_base-de5cdebac7b50871c3ece6ccd0b2a4d7a4b384bc.zip frameworks_base-de5cdebac7b50871c3ece6ccd0b2a4d7a4b384bc.tar.gz frameworks_base-de5cdebac7b50871c3ece6ccd0b2a4d7a4b384bc.tar.bz2 |
Merge "Fix Toolbar is not refreshed after Select All" into mnc-dev
-rw-r--r-- | core/java/android/widget/Editor.java | 10 | ||||
-rw-r--r-- | core/java/android/widget/TextView.java | 11 |
2 files changed, 18 insertions, 3 deletions
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index 4c98abf..0c4b1e1 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -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; } } diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 6872caa..b0411c9 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -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: |