diff options
| author | Satish Sampath <satish@android.com> | 2009-07-02 15:23:32 -0700 |
|---|---|---|
| committer | The Android Open Source Project <initial-contribution@android.com> | 2009-07-02 15:23:32 -0700 |
| commit | ed9f4c4c2fb764de14660432a9f04539b4373726 (patch) | |
| tree | 98de056eee9d159e0f154803ae3a044bfcec7f8c /core/java/android/widget/AutoCompleteTextView.java | |
| parent | ec0ab537a8c2dd78f065ef7299ef2dc83c2c9828 (diff) | |
| parent | fef8d3e4d8f6f46c098d04b3a57409c947ec1c75 (diff) | |
am fef8d3e4: Make search UI open up quicker to the user.
Merge commit 'fef8d3e4d8f6f46c098d04b3a57409c947ec1c75'
* commit 'fef8d3e4d8f6f46c098d04b3a57409c947ec1c75':
Make search UI open up quicker to the user.
Diffstat (limited to 'core/java/android/widget/AutoCompleteTextView.java')
| -rw-r--r-- | core/java/android/widget/AutoCompleteTextView.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/core/java/android/widget/AutoCompleteTextView.java b/core/java/android/widget/AutoCompleteTextView.java index ba47df531517..f2250d828b2a 100644 --- a/core/java/android/widget/AutoCompleteTextView.java +++ b/core/java/android/widget/AutoCompleteTextView.java @@ -124,6 +124,7 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe private boolean mBlockCompletion; private AutoCompleteTextView.ListSelectorHider mHideSelector; + private Runnable mShowDropDownRunnable; private AutoCompleteTextView.PassThroughClickListener mPassThroughClickListener; @@ -1066,6 +1067,13 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe } /** + * Issues a runnable to show the dropdown as soon as possible. + */ + public void showDropDownAfterLayout() { + post(mShowDropDownRunnable); + } + + /** * <p>Displays the drop down on screen.</p> */ public void showDropDown() { @@ -1173,6 +1181,22 @@ public class AutoCompleteTextView extends EditText implements Filter.FilterListe mHideSelector = new ListSelectorHider(); + /** + * This Runnable exists for the sole purpose of checking if the view layout has got + * completed and if so call showDropDown to display the drop down. This is used to show + * the drop down as soon as possible after user opens up the search dialog, without + * waiting for the normal UI pipeline to do it's job which is slower than this method. + */ + mShowDropDownRunnable = new Runnable() { + public void run() { + // View layout should be all done before displaying the drop down. + View view = getDropDownAnchorView(); + if (view != null && view.getWindowToken() != null) { + showDropDown(); + } + } + }; + mDropDownList = new DropDownListView(context); mDropDownList.setSelector(mDropDownListHighlight); mDropDownList.setAdapter(mAdapter); |
