Drag handles persist after lost focus in extracted mode

If extracted mode is to be started and we already had a
selection made do not start the action mode but only the
selection. Non-extracted mode keeps the current behavior.

Bug: 22100966
Change-Id: Iad9a95c28474a68dc4fbc7032cbab1dc6e234d45
This commit is contained in:
Andrei Stingaceanu
2015-06-30 16:57:03 +01:00
parent 2bc8485ba7
commit 99d3bbdcbf
2 changed files with 7 additions and 4 deletions

View File

@@ -1115,7 +1115,6 @@ public class Editor {
if (mTemporaryDetach) mPreserveDetachedSelection = false;
downgradeEasyCorrectionSpans();
}
// No need to create the controller
if (mSelectionModifierCursorController != null) {
mSelectionModifierCursorController.resetTouchOffsets();
@@ -1787,7 +1786,7 @@ public class Editor {
*
* @return true if there already was a selection or if the current word was selected.
*/
private boolean checkFieldAndSelectCurrentWord() {
boolean checkFieldAndSelectCurrentWord() {
if (!mTextView.canSelectText() || !mTextView.requestFocus()) {
Log.w(TextView.LOG_TAG,
"TextView does not support text selection. Selection cancelled.");
@@ -1834,7 +1833,7 @@ public class Editor {
return selectionStarted;
}
private boolean extractedTextModeWillBeStarted() {
boolean extractedTextModeWillBeStarted() {
if (!(mTextView.isInExtractedMode())) {
final InputMethodManager imm = InputMethodManager.peekInstance();
return imm != null && imm.isFullscreenMode();

View File

@@ -5226,7 +5226,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
// - onFocusChanged cannot start it when focus is given to a view with selected text (after
// a screen rotation) since layout is not yet initialized at that point.
if (mEditor != null && mEditor.mCreatedWithASelection) {
mEditor.startSelectionActionMode();
if (mEditor.extractedTextModeWillBeStarted()) {
mEditor.checkFieldAndSelectCurrentWord();
} else {
mEditor.startSelectionActionMode();
}
mEditor.mCreatedWithASelection = false;
}