diff options
Diffstat (limited to 'core/java/android/widget/TextView.java')
| -rw-r--r-- | core/java/android/widget/TextView.java | 25 |
1 files changed, 23 insertions, 2 deletions
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); } |
