diff options
| author | 2011-11-09 09:48:40 +0100 | |
|---|---|---|
| committer | 2011-11-09 09:48:43 +0100 | |
| commit | 61ddbbae71f4a3be2e03cd6c040c5f722dbe2b51 (patch) | |
| tree | 2270a886667b5fe6657958b321257833e4647f44 | |
| parent | da738d638cc2fee29d5936f21c6eadbcf173a718 (diff) | |
Visual glitches when starting extracted text
Partially addresses Bug 5547923
In landscape, tapping on the text
1. starts extracted text mode
2. displays the cursor handle or the selection popup window.
As a result, some ghost effects and race conditions create an
unpleasing visual experience.
Fixed this by not doing 2. in case extracted mode will start.
The drawback of this quicl fix is that the user will have to
tap again to get the handle/suggestion. That can be fixed later
if needed.
Change-Id: I10e1d8399bb35e5b2cd5cba1295f7d29d051cae0
| -rw-r--r-- | core/java/android/widget/TextView.java | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 5833afd8ffe7..70b594acbbcd 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -36,7 +36,6 @@ import android.graphics.RectF; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.inputmethodservice.ExtractEditText; -import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.os.Message; @@ -101,7 +100,6 @@ import android.util.Log; import android.util.TypedValue; import android.view.ActionMode; import android.view.ActionMode.Callback; -import android.view.ContextMenu; import android.view.DragEvent; import android.view.Gravity; import android.view.HapticFeedbackConstants; @@ -8355,10 +8353,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener // When the cursor moves, the word that was typed may need spell check mSpellChecker.onSelectionChanged(); } - if (isCursorInsideEasyCorrectionSpan()) { - showSuggestions(); - } else if (hasInsertionController()) { - getInsertionController().show(); + if (!extractedTextModeWillBeStarted()) { + if (isCursorInsideEasyCorrectionSpan()) { + showSuggestions(); + } else if (hasInsertionController()) { + getInsertionController().show(); + } } } @@ -10113,27 +10113,35 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } } - final InputMethodManager imm = InputMethodManager.peekInstance(); - boolean extractedTextModeWillBeStartedFullScreen = !(this instanceof ExtractEditText) && - imm != null && imm.isFullscreenMode(); + boolean willExtract = extractedTextModeWillBeStarted(); // Do not start the action mode when extracted text will show up full screen, thus // immediately hiding the newly created action bar, which would be visually distracting. - if (!extractedTextModeWillBeStartedFullScreen) { + if (!willExtract) { ActionMode.Callback actionModeCallback = new SelectionActionModeCallback(); mSelectionActionMode = startActionMode(actionModeCallback); } - final boolean selectionStarted = mSelectionActionMode != null || - extractedTextModeWillBeStartedFullScreen; - if (selectionStarted && !mTextIsSelectable && imm != null && mSoftInputShownOnFocus) { + final boolean selectionStarted = mSelectionActionMode != null || willExtract; + if (selectionStarted && !mTextIsSelectable && mSoftInputShownOnFocus) { // Show the IME to be able to replace text, except when selecting non editable text. - imm.showSoftInput(this, 0, null); + final InputMethodManager imm = InputMethodManager.peekInstance(); + if (imm != null) { + imm.showSoftInput(this, 0, null); + } } return selectionStarted; } + private boolean extractedTextModeWillBeStarted() { + if (!(this instanceof ExtractEditText)) { + final InputMethodManager imm = InputMethodManager.peekInstance(); + return imm != null && imm.isFullscreenMode(); + } + return false; + } + private void stopSelectionActionMode() { if (mSelectionActionMode != null) { // This will hide the mSelectionModifierCursorController |