summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorBjorn Bringert <bringert@android.com>2009-07-28 12:03:29 +0100
committerBjorn Bringert <bringert@android.com>2009-07-28 17:39:17 +0100
commit003ad48380fe90556da408fedba7dfc1a37790b9 (patch)
tree516e79f2c30da093e1e9b4cb9beea3294c4ce43b /core
parent738b4c000bab8414fa2969db489d7abce20e0af6 (diff)
downloadframeworks_base-003ad48380fe90556da408fedba7dfc1a37790b9.zip
frameworks_base-003ad48380fe90556da408fedba7dfc1a37790b9.tar.gz
frameworks_base-003ad48380fe90556da408fedba7dfc1a37790b9.tar.bz2
Cancel search on BACK if IME is obscured.
This adds a hidden method AutoCompleteTextView.isImeHidden(), and uses that in SearchDialog to cancel the search dialog when BACK is pressed, if there is no previous search component to return to. mlebeau says: If we fill the whole screen then it makes the issue of the back button a little more important. Specifically, right now if you have the list expanded and you press back, the keyboard hides but it's not really showing any more anyway so it seems like pressing the button does nothing. We rationalized this by saying "part of the keyboard will be showing so it won't be completely non-obvious that it was hidden". But since really the right UX is to fill the screen, as part of this we should probably also add logic to the back button such that if it is pressed when the list is obscuring the keyboard (i.e. softInputMode on the PopupWindow is INPUT_METHOD_NOT_NEEDED) then we should hide the dialog entirely rather than closing the keyboard. This is part of the fix for http://b/issue?id=2014450
Diffstat (limited to 'core')
-rw-r--r--core/java/android/app/SearchDialog.java6
-rw-r--r--core/java/android/widget/AutoCompleteTextView.java12
2 files changed, 15 insertions, 3 deletions
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index 34429fa..dd24a75 100644
--- a/core/java/android/app/SearchDialog.java
+++ b/core/java/android/app/SearchDialog.java
@@ -1709,6 +1709,12 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS
if (mSearchDialog.backToPreviousComponent()) {
return true;
}
+ // If the drop-down obscures the keyboard, the user wouldn't see anything
+ // happening when pressing back, so we dismiss the entire dialog instead.
+ if (isInputMethodNotNeeded()) {
+ mSearchDialog.cancel();
+ return true;
+ }
return false; // will dismiss soft keyboard if necessary
}
return false;
diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java
index 6848a55..a998072 100644
--- a/core/java/android/widget/AutoCompleteTextView.java
+++ b/core/java/android/widget/AutoCompleteTextView.java
@@ -209,8 +209,7 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
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() &&
- mPopup.getInputMethodMode() == PopupWindow.INPUT_METHOD_NOT_NEEDED) {
+ if (mPopup.isShowing() && isInputMethodNotNeeded()) {
ensureImeVisible();
}
}
@@ -1103,6 +1102,13 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
}
/**
+ * @hide internal used only here and SearchDialog
+ */
+ public boolean isInputMethodNotNeeded() {
+ return mPopup.getInputMethodMode() == PopupWindow.INPUT_METHOD_NOT_NEEDED;
+ }
+
+ /**
* <p>Displays the drop down on screen.</p>
*/
public void showDropDown() {
@@ -1111,7 +1117,7 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
int widthSpec = 0;
int heightSpec = 0;
- boolean noInputMethod = mPopup.getInputMethodMode() == PopupWindow.INPUT_METHOD_NOT_NEEDED;
+ boolean noInputMethod = isInputMethodNotNeeded();
if (mPopup.isShowing()) {
if (mDropDownWidth == ViewGroup.LayoutParams.FILL_PARENT) {