summaryrefslogtreecommitdiff
path: root/core/java/android/widget/TextView.java
diff options
context:
space:
mode:
authorGilles Debunne <debunne@google.com>2012-04-23 15:53:37 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-04-23 15:53:37 -0700
commitb983e27af47b6a3a6b13af0d3dd64b163f540efd (patch)
treebf98d47091738bb525a141835482fa9e0c2a4504 /core/java/android/widget/TextView.java
parentad6283e48a109dc4e40ddd65b7c18e6ef0bb3f90 (diff)
parent3473b2b1f495f0f5a31e7ed687557c423c63abff (diff)
Merge "Re-added a flag to prevent the IME from showing"
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 ed313230a8b0..f45297336be0 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -2312,6 +2312,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.
*
@@ -4981,7 +5002,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);
}
}
@@ -7014,7 +7035,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);
}