summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Rosaen <krosaen@google.com>2009-08-06 16:40:13 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2009-08-06 16:40:13 -0700
commit332aaaf92fb0bae521006907db9559b8e14f1b96 (patch)
treec0403d3c195babd781ce79308c397c6f12d194bb
parent6a411bbb132e9cdf72ab7600eb29399ffe768f14 (diff)
parenta7a3b6ef0fdaf6b17993642b76baf90a03ae0077 (diff)
downloadframeworks_base-332aaaf92fb0bae521006907db9559b8e14f1b96.zip
frameworks_base-332aaaf92fb0bae521006907db9559b8e14f1b96.tar.gz
frameworks_base-332aaaf92fb0bae521006907db9559b8e14f1b96.tar.bz2
am a7a3b6ef: Dismiss both the soft keyboard and the search dialog on back if there is no text entered and no shortcuts are being obscured by the soft keyboard.
Merge commit 'a7a3b6ef0fdaf6b17993642b76baf90a03ae0077' * commit 'a7a3b6ef0fdaf6b17993642b76baf90a03ae0077': Dismiss both the soft keyboard and the search dialog on back if there is no text entered and no shortcuts are being obscured by the soft keyboard.
-rw-r--r--core/java/android/app/SearchDialog.java9
-rw-r--r--core/java/android/widget/AutoCompleteTextView.java10
2 files changed, 18 insertions, 1 deletions
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index 70aceeb..9c20a4b 100644
--- a/core/java/android/app/SearchDialog.java
+++ b/core/java/android/app/SearchDialog.java
@@ -1743,7 +1743,14 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS
}
// 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()) {
+ //
+ // also: if there is no text entered, we also want to dismiss the whole dialog,
+ // not just the soft keyboard. the exception to this is if there are shortcuts
+ // that aren't displayed (e.g are being obscured by the soft keyboard); in that
+ // case we want to dismiss the soft keyboard so the user can see the rest of the
+ // shortcuts.
+ if (isInputMethodNotNeeded() ||
+ (isEmpty() && getDropDownChildCount() >= getAdapter().getCount())) {
mSearchDialog.cancel();
return true;
}
diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java
index ea88b5b..d821a7d 100644
--- a/core/java/android/widget/AutoCompleteTextView.java
+++ b/core/java/android/widget/AutoCompleteTextView.java
@@ -848,6 +848,16 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe
return ListView.INVALID_POSITION;
}
+
+ /**
+ * @hide
+ * @return {@link android.widget.ListView#getChildCount()} of the drop down if it is showing,
+ * otherwise 0.
+ */
+ protected int getDropDownChildCount() {
+ return mDropDownList == null ? 0 : mDropDownList.getChildCount();
+ }
+
/**
* <p>Starts filtering the content of the drop down list. The filtering
* pattern is the content of the edit box. Subclasses should override this