Loading core/java/android/app/SearchDialog.java +32 −14 Original line number Diff line number Diff line Loading @@ -19,23 +19,25 @@ package android.app; import static android.app.SuggestionsAdapter.getColumnString; import java.util.WeakHashMap; import java.util.concurrent.atomic.AtomicLong; import android.content.ActivityNotFoundException; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Configuration; import android.content.res.Resources; import android.database.Cursor; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.os.IBinder; import android.os.RemoteException; import android.os.SystemClock; import android.provider.Browser; import android.speech.RecognizerIntent; Loading @@ -43,11 +45,8 @@ import android.text.Editable; import android.text.InputType; import android.text.TextUtils; import android.text.TextWatcher; import android.util.AndroidRuntimeException; import android.util.AttributeSet; import android.util.Log; import android.util.Patterns; import android.view.ContextThemeWrapper; import android.view.Gravity; import android.view.KeyEvent; import android.view.MotionEvent; Loading @@ -69,10 +68,6 @@ import android.widget.TextView; import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemSelectedListener; import java.util.ArrayList; import java.util.WeakHashMap; import java.util.concurrent.atomic.AtomicLong; /** * Search dialog. This is controlled by the * SearchManager and runs in the current foreground process. Loading Loading @@ -154,6 +149,16 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS mVoiceAppSearchIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); mVoiceAppSearchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mSearchManager = searchManager; IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED); context.registerReceiver(new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Intent.ACTION_CONFIGURATION_CHANGED)) { onConfigurationChanged(); } } }, filter); } /** Loading Loading @@ -394,10 +399,18 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS updateSearchAppIcon(); updateSearchBadge(); updateQueryHint(); if (isLandscapeMode(getContext())) { mSearchAutoComplete.ensureImeVisible(true); } mSearchAutoComplete.showDropDownAfterLayout(); } } static boolean isLandscapeMode(Context context) { return context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; } /** * Update the UI according to the info in the current value of {@link #mSearchable}. */ Loading Loading @@ -983,7 +996,7 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS mSearchAutoComplete.setSelection(selPoint); mSearchAutoComplete.setListSelection(0); mSearchAutoComplete.clearListSelection(); mSearchAutoComplete.ensureImeVisible(); mSearchAutoComplete.ensureImeVisible(true); return true; } Loading Loading @@ -1362,6 +1375,11 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS InputMethodManager inputManager = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.showSoftInput(this, 0); // If in landscape mode, then make sure that // the ime is in front of the dropdown. if (isLandscapeMode(getContext())) { ensureImeVisible(true); } } } Loading core/java/android/widget/AutoCompleteTextView.java +11 −7 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); } } Loading Loading @@ -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(); } Loading Loading
core/java/android/app/SearchDialog.java +32 −14 Original line number Diff line number Diff line Loading @@ -19,23 +19,25 @@ package android.app; import static android.app.SuggestionsAdapter.getColumnString; import java.util.WeakHashMap; import java.util.concurrent.atomic.AtomicLong; import android.content.ActivityNotFoundException; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Configuration; import android.content.res.Resources; import android.database.Cursor; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.os.IBinder; import android.os.RemoteException; import android.os.SystemClock; import android.provider.Browser; import android.speech.RecognizerIntent; Loading @@ -43,11 +45,8 @@ import android.text.Editable; import android.text.InputType; import android.text.TextUtils; import android.text.TextWatcher; import android.util.AndroidRuntimeException; import android.util.AttributeSet; import android.util.Log; import android.util.Patterns; import android.view.ContextThemeWrapper; import android.view.Gravity; import android.view.KeyEvent; import android.view.MotionEvent; Loading @@ -69,10 +68,6 @@ import android.widget.TextView; import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemSelectedListener; import java.util.ArrayList; import java.util.WeakHashMap; import java.util.concurrent.atomic.AtomicLong; /** * Search dialog. This is controlled by the * SearchManager and runs in the current foreground process. Loading Loading @@ -154,6 +149,16 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS mVoiceAppSearchIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); mVoiceAppSearchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mSearchManager = searchManager; IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED); context.registerReceiver(new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Intent.ACTION_CONFIGURATION_CHANGED)) { onConfigurationChanged(); } } }, filter); } /** Loading Loading @@ -394,10 +399,18 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS updateSearchAppIcon(); updateSearchBadge(); updateQueryHint(); if (isLandscapeMode(getContext())) { mSearchAutoComplete.ensureImeVisible(true); } mSearchAutoComplete.showDropDownAfterLayout(); } } static boolean isLandscapeMode(Context context) { return context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; } /** * Update the UI according to the info in the current value of {@link #mSearchable}. */ Loading Loading @@ -983,7 +996,7 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS mSearchAutoComplete.setSelection(selPoint); mSearchAutoComplete.setListSelection(0); mSearchAutoComplete.clearListSelection(); mSearchAutoComplete.ensureImeVisible(); mSearchAutoComplete.ensureImeVisible(true); return true; } Loading Loading @@ -1362,6 +1375,11 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS InputMethodManager inputManager = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.showSoftInput(this, 0); // If in landscape mode, then make sure that // the ime is in front of the dropdown. if (isLandscapeMode(getContext())) { ensureImeVisible(true); } } } Loading
core/java/android/widget/AutoCompleteTextView.java +11 −7 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); } } Loading Loading @@ -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(); } Loading