diff options
author | Karl Rosaen <krosaen@android.com> | 2009-06-04 15:58:36 +0100 |
---|---|---|
committer | Karl Rosaen <krosaen@android.com> | 2009-06-04 16:11:47 +0100 |
commit | 1c54cf0903cd81467ca41ec6733c459e10b22763 (patch) | |
tree | bb128d935c2241b02371a0c0e003ff99e3314e06 /core/java/android/app/SearchDialog.java | |
parent | 241b4c74aab82c07de36479053509f9b27b0f0bb (diff) | |
download | frameworks_base-1c54cf0903cd81467ca41ec6733c459e10b22763.zip frameworks_base-1c54cf0903cd81467ca41ec6733c459e10b22763.tar.gz frameworks_base-1c54cf0903cd81467ca41ec6733c459e10b22763.tar.bz2 |
Detect impressions, and cleanup the SearchDialog / SuggestionCursor communication.
(framework portion)
There are now 4 times the search dialog will check with the cursor:
- after data set changed
- when an item is clicked
- when the cursor is about to be closed
- when an item at a particular position is detected as showing
these are now the points where we can add data in either direction, which we use to accomplish:
- finding out whether there are any pending results
- find out if there is a position at which to notify when it is displayed (the "more results" triggering)
- toggling the "more results" button
- sending the max position that was displayed when the cursor is done
the new behavior (in addition to the refactoring) is improved detection of "more results" to trigger the additional sources
(it is now precise), and detection of which items were displayed to the user.
Diffstat (limited to 'core/java/android/app/SearchDialog.java')
-rw-r--r-- | core/java/android/app/SearchDialog.java | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java index bcb2791..0bb483b 100644 --- a/core/java/android/app/SearchDialog.java +++ b/core/java/android/app/SearchDialog.java @@ -1202,16 +1202,7 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS protected boolean launchSuggestion(int position, int actionKey, String actionMsg) { Cursor c = mSuggestionsAdapter.getCursor(); if ((c != null) && c.moveToPosition(position)) { - // let the cursor know which position was clicked - final Bundle clickResponse = new Bundle(1); - clickResponse.putInt(SearchManager.RESPOND_EXTRA_POSITION_CLICKED, position); - final Bundle response = c.respond(clickResponse); - - // the convention is to send a position to select in response to a click (if applicable) - final int posToSelect = response.getInt( - SearchManager.RESPOND_EXTRA_POSITION_SELECTED, - SuggestionsAdapter.NO_ITEM_TO_SELECT); - mSuggestionsAdapter.setListItemToSelect(posToSelect); + mSuggestionsAdapter.callCursorOnClick(c, position); // launch the intent Intent intent = createIntentFromSuggestion(c, actionKey, actionMsg); |