diff options
| author | Gilles Debunne <debunne@google.com> | 2010-08-31 15:55:31 -0700 |
|---|---|---|
| committer | Gilles Debunne <debunne@google.com> | 2010-08-31 16:02:18 -0700 |
| commit | e67b58a347109b444070a34e86e81ce119f266b3 (patch) | |
| tree | 27c4c3ac1e03b97fab78633a55030d5930a6a93e /core | |
| parent | 6aacad66eba2b51251f7e2dfb8c005b5242326ca (diff) | |
| download | frameworks_base-e67b58a347109b444070a34e86e81ce119f266b3.zip frameworks_base-e67b58a347109b444070a34e86e81ce119f266b3.tar.gz frameworks_base-e67b58a347109b444070a34e86e81ce119f266b3.tar.bz2 | |
Fixed single line state on TextView.
singleLine flag is set to false by default. However, when no singleLine or input
type is provided, the inputType of the TextView is not set to
EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE for edit texts.
Change-Id: Id747d3319afcddb3ab6ae0463947e8b3e470ef73
Diffstat (limited to 'core')
| -rw-r--r-- | core/java/android/inputmethodservice/ExtractEditText.java | 7 | ||||
| -rw-r--r-- | core/java/android/widget/TextView.java | 12 |
2 files changed, 10 insertions, 9 deletions
diff --git a/core/java/android/inputmethodservice/ExtractEditText.java b/core/java/android/inputmethodservice/ExtractEditText.java index b7d53e2..22968b0 100644 --- a/core/java/android/inputmethodservice/ExtractEditText.java +++ b/core/java/android/inputmethodservice/ExtractEditText.java @@ -109,6 +109,7 @@ public class ExtractEditText extends EditText { /** * We are always considered to be an input method target. */ + @Override public boolean isInputMethodTarget() { return true; } @@ -125,7 +126,7 @@ public class ExtractEditText extends EditText { * highlight and cursor will be displayed. */ @Override public boolean hasWindowFocus() { - return this.isEnabled() ? true : false; + return this.isEnabled(); } /** @@ -133,7 +134,7 @@ public class ExtractEditText extends EditText { * highlight and cursor will be displayed. */ @Override public boolean isFocused() { - return this.isEnabled() ? true : false; + return this.isEnabled(); } /** @@ -141,6 +142,6 @@ public class ExtractEditText extends EditText { * highlight and cursor will be displayed. */ @Override public boolean hasFocus() { - return this.isEnabled() ? true : false; + return this.isEnabled(); } } diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index d1a14d2..1e8023c 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -710,10 +710,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener BufferType bufferType = BufferType.EDITABLE; - if ((inputType&(EditorInfo.TYPE_MASK_CLASS - |EditorInfo.TYPE_MASK_VARIATION)) - == (EditorInfo.TYPE_CLASS_TEXT - |EditorInfo.TYPE_TEXT_VARIATION_PASSWORD)) { + if ((inputType & (EditorInfo.TYPE_MASK_CLASS | EditorInfo.TYPE_MASK_VARIATION)) + == (EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_PASSWORD)) { password = true; } @@ -801,6 +799,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } else if (editable) { mInput = TextKeyListener.getInstance(); mInputType = EditorInfo.TYPE_CLASS_TEXT; + if (!singleLine) { + mInputType |= EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE; + } } else { mInput = null; @@ -2961,8 +2962,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener final int cls = type & EditorInfo.TYPE_MASK_CLASS; KeyListener input; if (cls == EditorInfo.TYPE_CLASS_TEXT) { - boolean autotext = (type & EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT) - != 0; + boolean autotext = (type & EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT) != 0; TextKeyListener.Capitalize cap; if ((type & EditorInfo.TYPE_TEXT_FLAG_CAP_CHARACTERS) != 0) { cap = TextKeyListener.Capitalize.CHARACTERS; |
