From 3473b2b1f495f0f5a31e7ed687557c423c63abff Mon Sep 17 00:00:00 2001 From: Gilles Debunne Date: Fri, 20 Apr 2012 16:21:10 -0700 Subject: Re-added a flag to prevent the IME from showing Revert of CL 161404 This flag will be used by the dialer. It prevents any IME from showing as a result of a focus given to a TextView through a tap or a D-Pad click. Change-Id: Ifa5bfcbff124b300780f76dea443d26cf172f5e3 --- core/java/android/widget/TextView.java | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'core/java/android/widget/TextView.java') diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 37d9db7..ba0f0a9 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -2314,6 +2314,27 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } /** + * Sets whether the soft input method will be made visible when this + * TextView gets focused. The default is true. + * @hide + */ + @android.view.RemotableViewMethod + public final void setShowSoftInputOnFocus(boolean show) { + createEditorIfNeeded("setShowSoftInputOnFocus"); + mEditor.mShowSoftInputOnFocus = show; + } + + /** + * Returns whether the soft input method will be made visible when this + * TextView gets focused. The default is true. + * @hide + */ + public final boolean getShowSoftInputOnFocus() { + // When there is no Editor, return default true value + return mEditor == null || mEditor.mShowSoftInputOnFocus; + } + + /** * Gives the text a shadow of the specified radius and color, the specified * distance from its normal position. * @@ -5030,7 +5051,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener && mLayout != null && onCheckIsTextEditor()) { InputMethodManager imm = InputMethodManager.peekInstance(); viewClicked(imm); - if (imm != null) { + if (imm != null && getShowSoftInputOnFocus()) { imm.showSoftInput(this, 0); } } @@ -7060,7 +7081,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener // Show the IME, except when selecting in read-only text. final InputMethodManager imm = InputMethodManager.peekInstance(); viewClicked(imm); - if (!textIsSelectable) { + if (!textIsSelectable && mEditor.mShowSoftInputOnFocus) { handled |= imm != null && imm.showSoftInput(this, 0); } -- cgit v1.1