diff options
| author | Gilles Debunne <debunne@google.com> | 2012-04-20 16:21:10 -0700 |
|---|---|---|
| committer | Gilles Debunne <debunne@google.com> | 2012-04-20 16:21:13 -0700 |
| commit | 3473b2b1f495f0f5a31e7ed687557c423c63abff (patch) | |
| tree | 2a03c0ffd7d6be2074afdada1401bdbe6fbd3f83 | |
| parent | 70c8723e63e2c58115c356bd4e9525b823b7bf28 (diff) | |
| download | frameworks_base-3473b2b1f495f0f5a31e7ed687557c423c63abff.zip frameworks_base-3473b2b1f495f0f5a31e7ed687557c423c63abff.tar.gz frameworks_base-3473b2b1f495f0f5a31e7ed687557c423c63abff.tar.bz2 | |
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
| -rw-r--r-- | core/java/android/widget/Editor.java | 3 | ||||
| -rw-r--r-- | core/java/android/widget/TextView.java | 25 |
2 files changed, 25 insertions, 3 deletions
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index 900f0d3..779a2f1 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -151,6 +151,7 @@ public class Editor { boolean mShowErrorAfterAttach; boolean mInBatchEditControllers; + boolean mShowSoftInputOnFocus = true; SuggestionsPopupWindow mSuggestionsPopupWindow; SuggestionRangeSpan mSuggestionRangeSpan; @@ -1407,7 +1408,7 @@ public class Editor { } final boolean selectionStarted = mSelectionActionMode != null || willExtract; - if (selectionStarted && !mTextView.isTextSelectable()) { + if (selectionStarted && !mTextView.isTextSelectable() && mShowSoftInputOnFocus) { // Show the IME to be able to replace text, except when selecting non editable text. final InputMethodManager imm = InputMethodManager.peekInstance(); if (imm != null) { 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); } |
