From d25eb35b6b80b6f8065ab39b1cf1abb1fd801234 Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Wed, 10 Mar 2010 21:09:28 -0800 Subject: Fix for 2175289 : Can't get keyboard in search dialog after switching to landscape The auto complete drop down was obscuring the keyboard. This fix checks if the screen is in landscape mode and forces the keyboard in front when necessary. --- core/java/android/widget/AutoCompleteTextView.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'core/java/android/widget/AutoCompleteTextView.java') diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java index ed6378737606..65f7cdbee3ce 100644 --- a/core/java/android/widget/AutoCompleteTextView.java +++ b/core/java/android/widget/AutoCompleteTextView.java @@ -17,9 +17,11 @@ package android.widget; import android.content.Context; +import android.content.res.Configuration; import android.content.res.TypedArray; import android.graphics.Rect; import android.graphics.drawable.Drawable; +import android.graphics.drawable.GradientDrawable.Orientation; import android.text.Editable; import android.text.Selection; import android.text.TextUtils; @@ -210,10 +212,10 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe * Private hook into the on click event, dispatched from {@link PassThroughClickListener} */ private void onClickImpl() { - // If the dropdown is showing, bring it back in front of the soft - // keyboard when the user touches the text field. - if (mPopup.isShowing() && isInputMethodNotNeeded()) { - ensureImeVisible(); + // If the dropdown is showing, bring the keyboard to the front + // when the user touches the text field. + if (mPopup.isShowing()) { + ensureImeVisible(true); } } @@ -1114,11 +1116,13 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe /** * Ensures that the drop down is not obscuring the IME. - * + * @param visible whether the ime should be in front. If false, the ime is pushed to + * the background. * @hide internal used only here and SearchDialog */ - public void ensureImeVisible() { - mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED); + public void ensureImeVisible(boolean visible) { + mPopup.setInputMethodMode(visible + ? PopupWindow.INPUT_METHOD_NEEDED : PopupWindow.INPUT_METHOD_NOT_NEEDED); showDropDown(); } -- cgit v1.2.3