From e507a9e4af9cd8a7333e2951649ac106829f7a45 Mon Sep 17 00:00:00 2001 From: Gilles Debunne Date: Sun, 10 Oct 2010 12:44:18 -0700 Subject: Voice input replaces selected text. Bug 3068128 Hiding controllers no longer stops text selection. Change-Id: Ie00c99948b3a14ce8a4a2a93c064c0635cadc993 --- core/java/android/widget/TextView.java | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 138aefa..5be52c4 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -6668,10 +6668,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener if (mInputContentType != null) { mInputContentType.enterDown = false; } - hideInsertionPointCursorController(); - if (mSelectionModifierCursorController != null) { - mSelectionModifierCursorController.hide(); - } + hideControllers(); } startStopMarquee(hasWindowFocus); @@ -6681,10 +6678,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener protected void onVisibilityChanged(View changedView, int visibility) { super.onVisibilityChanged(changedView, visibility); if (visibility != VISIBLE) { - hideInsertionPointCursorController(); - if (mSelectionModifierCursorController != null) { - mSelectionModifierCursorController.hide(); - } + hideControllers(); } } @@ -7643,10 +7637,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener private void stopTextSelectionMode() { if (mIsInTextSelectionMode) { Selection.setSelection((Spannable) mText, getSelectionEnd()); - if (mSelectionModifierCursorController != null) { - mSelectionModifierCursorController.hide(); - } - + hideSelectionModifierCursorController(); mIsInTextSelectionMode = false; } } @@ -8182,9 +8173,15 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } } + private void hideSelectionModifierCursorController() { + if (mSelectionModifierCursorController != null) { + mSelectionModifierCursorController.hide(); + } + } + private void hideControllers() { hideInsertionPointCursorController(); - stopTextSelectionMode(); + hideSelectionModifierCursorController(); } private int getOffsetForHorizontal(int line, int x) { -- cgit v1.1