summaryrefslogtreecommitdiffstats
path: root/core/java/android/widget/TextView.java
diff options
context:
space:
mode:
authorGilles Debunne <debunne@google.com>2012-04-20 16:21:10 -0700
committerGilles Debunne <debunne@google.com>2012-04-20 16:21:13 -0700
commit3473b2b1f495f0f5a31e7ed687557c423c63abff (patch)
tree2a03c0ffd7d6be2074afdada1401bdbe6fbd3f83 /core/java/android/widget/TextView.java
parent70c8723e63e2c58115c356bd4e9525b823b7bf28 (diff)
downloadframeworks_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
Diffstat (limited to 'core/java/android/widget/TextView.java')
-rw-r--r--core/java/android/widget/TextView.java25
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);
}