summaryrefslogtreecommitdiff
path: root/core/java/android/app/SuggestionsAdapter.java
Commit message (Collapse)AuthorAgeFilesLines
* Use SearchView in SearchDialog for legacy apps using the old model.Amith Yamasani2010-12-031-653/+0
| | | | | | | | | | | | | | | Bug: 3140925 Removed all the code from SearchDialog that is already in SearchView and moved more stuff into SearchView. SearchDialog layout changed to be more like a Holo.Light themed action mode. Search field is right justified and limited to 500dip. Zero query dropdown added to SearchView (causing some problems with Gmail, but that may be an existing issue that's only now showing up due to this change) Holo.Light search views assets still need to be updated, as the contrast is too low.
* Query refinement feature in SearchView.Amith Yamasani2010-09-161-54/+1
| | | | | | New method : setQueryRefinementEnabled() which will either enable all suggestions to have the little query refinement icon in the right or just the ones that have a bit set in the new SUGGEST_FLAGS column of the suggestion provider cursor.
* For search suggestions in the search dialog, allow the 'title'Mike LeBeau2010-04-151-0/+14
| | | | | | | line of text to be up to 2 lines (rather than the usual 1) if no 'description' line is provided. Change-Id: Ibc60d72868a4ad9630d38ee9b8cfe3f37c736e64
* don't assume Cursor.getExtras returns non-nullMark Wagner2010-03-051-7/+9
|
* Show AutoCompleteTextView dropdown in Search dialog when cursor updates. ↵Amith Yamasani2010-03-041-0/+2
| | | | | | | Fixes b/2426929 Calls onFilterComplete when the data set changes, so that it can recompute whether the dropdown should be shown or not.
* Feature to return an extra in the cursor that keeps the spinny going.Amith Yamasani2010-03-031-7/+45
| | | | | | | | | If a search provider returns an extra in the cursor with the key SearchManager.CURSOR_EXTRA_KEY_IN_PROGRESS, and the value true, then the spinny in the search dialog will not stop, but the cursor contents will still be used to update the results. This way, partial search results can be sent while the user is informed that the search is still in progress.
* Add SearchManager.SUGGEST_COLUMN_TEXT_2_URLBjorn Bringert2010-03-031-29/+46
| | | | | | | | | | This column overrides SUGGEST_COLUMN_TEXT_2. SearchDialog and QuickSearchBox render the value of this column as a URL in green. Part of the fix for http://b/issue?id=2380681 Change-Id: I6735e0eba90e24c81f9e72520f257e5e61796d7a
* Cleanup of global search references in SearchDialog and SearchManager.Amith Yamasani2010-02-171-145/+9
|
* Move android.server.search.SearchableInfo to android.appBjorn Bringert2009-12-041-1/+0
| | | | | | | | | | | | | | | We need to expose SearchableInfo in the SDK in order to unbundle Quick Search Box. Since the android.server.search package is hidden, I'm moving SearchableInfo to android.app, where SearchManager lives. This change doesn't actually expose SearchableInfo. I'll do that in a separate change to keep the change that api-council needs to review small. This is part of the fix for: http://b/issue?id=2270838 Change-Id: I9589f9c2c11d36c958beedff8245fe0c3319c6ba
* Pass limit=50 to all suggestion sources.Bjorn Bringert2009-09-281-1/+2
| | | | | | | | Should mitigate http://b/issue?id=2149158 "Bad suggestions behavior within contacts app search for 10k contact db" Change-Id: Ida50e9157c3ce46fc7892ef09a67da9f4008e665
* Use icon URI as icon cache key in search dialogBjorn Bringert2009-09-211-53/+73
| | | | | | | Fixes http://b/issue?id=2131078 "Incorrect icons shown in in-app search" Change-Id: I88282d6323333796e66ca704390ad16016b846eb
* Send action key and msg with GlobalSearch clicksBjorn Bringert2009-09-211-2/+7
| | | | | | Needed for QSB logging, http://b/issue?id=2097469 Change-Id: I817e5b26c9739ab05bd873675854478ce601d234
* Use Resources to load search icons with android.resource URIsBjorn Bringert2009-09-161-16/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before, all icon URIs were opened with ContentResolver.openInputStream(Uri), but that does not include the density information from the source application. Now, if the URI uses the android.resource scheme, we resolve the URI to a Resources and a resource ID, and load it with Resources.getDrawable(int). This requires making OpenResourceIdResult and getResourceId() in ContentResolver public (but hidden). This change also caches icons that were specified using just a resource ID. Since loading a Drawable from a URI is a generally useful operation, it would be good to make it easy for apps to do it in the proper density-independent way. We could add a getDrawable(Uri) method to the framework. The question is where. It would be easiest to add it to ContentResolver, but that may be a bit odd since there is no other code for dealing with Drawables in ContentResolver. Another alternative is in Resources, since getDrawable(int) is there, but that class deals with the resources for a single app, whereas getDrawable(Uri) can open a drawable from any app. Putting it in Context may be the best choice, since that's in android.content, and can thus access package private members in ContentResolver, and since it's already a dumping place for random useful high-level methods. Opinions? Fixes http://b/issue?id=2034526 "Icons on search do not scale for wide VGA" Change-Id: I44de0b74826e5560141a3174bcbba991ba6264ac
* Fix issue #2116977: buttons are huge and bentDianne Hackborn2009-09-141-3/+3
| | | | | | | | Now that we are using preloaded drawables in compatibilty mode, when constructing them from their constant state we need to set the new drawable's target density appropriately. Change-Id: I3665cbea09d38b9ac5f45f8c380dc8641f86b266
* Tell GlobalSearch about searches without a suggestionBjorn Bringert2009-09-111-1/+18
| | | | | | | | This is the framework part of http://b/issue?id=2099399 "executing a search in QSB should create a shortcut (like when you click on a search suggestion)" Change-Id: I2d07d9bfc808112948629ca16b24bc870fbd5fa6
* Close suggestion cursors that arrive after adapter is closedBjorn Bringert2009-08-261-0/+13
| | | | | | | | | | | | | | | | | | | | | Before, after using the Browser, memory-hungry apps could become very sluggish. This was because the search dialog in the system process had the BrowserProvider open, which in turn had EnhancedGoogleSearch open. Since EhancedGoogleSearch runs in acore, the system would keep both the Browser process and acore to stay around forever. The cause (or at least one common cause) for this was that if the user types quickly, and clicks on a suggestion before the displayed suggestions have caught up, some suggestion cursors are not be closed. This change solves this problem by adding a close() method to SuggestionsAdapter. SuggestionsAdapter now closes any cursors that are passed to it after close() is called. Fixes http://b/issue?id=2078226 "global search holding reference to browser: system -> browser -> acore = :("
* Send a special respond to the cursor in SuggestionsAdapter to tell it toMike LeBeau2009-08-061-0/+26
| | | | | | | close itself directly because it may not happen correctly for some cursors currently. This fixes http://b/2036290, which is being caused by http://b/2015069 which we are not fixing for Donut, so this is a hack around that for the time being.
* Guard against remote process dying when retrieving column from cursor.Karl Rosaen2009-08-051-1/+8
| | | | Fixes bug 2035791.
* Remove search dialog PRE_CLOSE eventBjorn Bringert2009-07-271-20/+0
| | | | This is part of the fix for http://b/issue?id=2000655
* Send max displayed position in search dialog click eventBjorn Bringert2009-07-271-0/+2
| | | | This is part of the fix for http://b/issue?id=2000655
* add some more defensiveness to SuggestionsAdapter to avoid system process ↵Karl Rosaen2009-07-231-8/+14
| | | | crashes.
* Remove background padding workaround from SuggestionsAdapterBjorn Bringert2009-07-221-4/+0
| | | | | | | | | | Romain has checked in a framework fix, https://android-git.corp.google.com/g/8218 so the workaround added in https://android-git.corp.google.com/g/8209 is no longer needed. Fixes http://b/issue?id=1996635
* Work around StateListDrawable padding in search suggestionsBjorn Bringert2009-07-221-0/+5
| | | | | | | | | | | | | | | | | | Sometimes when searching, some of the suggestions had no left padding. The left-hand side icons were flush with the left edge of the screen. The problems was that setting a StateListDrawable as a background will always set the padding of a View, because of a problem in DrawableContainer. DrawableContainer.DrawableContainerState.getConstantPadding() will always return a Rect if mVariablePadding is false, which makes DrawableContainer.getPadding() return true, which causes View to change the padding. As a workaround, we use setVariablePadding(true) on the background that we create. Fixes http://b/editIssue?id=1984813
* Copy cached drawables in search dialog.Bjorn Bringert2009-07-171-15/+19
| | | | | | | | | Before, Drawables for cached icons were reused. This is not good, since they can then share mutable state information. This change copies all Drawables when getting them from the cache, storing only the constant state in the cache. Hopefully fixes http://b/issue?id=1984813
* Add ability to delay messages in Filter based on constraint. Use this to ↵Karl Rosaen2009-07-161-0/+19
| | | | | | delay 500ms for delete keys in the search dialog. Holding down delete is nice and zippy in the browser now :)
* Only parse search suggestions that look like HTMLBjorn Bringert2009-07-161-1/+10
| | | | | | | | HTML parsing of search suggestions is still a major CPU hog in the search dialog. This change first checks if the text contains any HTML markup (by looking for < and &) before bothering to treat it as HTML.
* Get rid of drawing hacks for search dialog suggestionsBjorn Bringert2009-07-161-191/+62
| | | | | | | | | | | | | | | | | | | Before, SuggestionsAdapter parsed every HTML formatted string three times, to support state-dependent colors in <font> tags. Now that there is support in Html for color resources (added in https://android-git.corp.google.com/g/7441), we can get rid of this code. Also, SuggestionsAdapter had a special purpose view for drawing background colors when suggestion items were not selected or pressed. This change replaces that code with a StateListDrawable of ColorDrawables. Before this change, HTML parsing used ~17% (uncontrolled benchmark, just did some random searching) of the system_process CPU. This change should reduce that by 2/3, i.e. about ~11% total system_process reduction.
* Use activity icon when search suggestion icon is missingBjorn Bringert2009-07-141-11/+116
| | | | | | | | | | | | | | | | | | | | New left-hand side icon fallback logic in search dialog: 1. If the search dialog gets no icon column, it shows no icon (like before). This would handle the case of in-app search where the provider does not include icons. 2. If the icon column is empty, or there is an error converting the icon id or URI to a drawable, the search dialog identifies the suggestion source by looking at the SUGGEST_COLUMN_INTENT_COMPONENT_NAME. 3. If SUGGEST_COLUMN_INTENT_COMPONENT_NAME is empty or not set, the current searchable activity is considered the suggestion source. 4. Try to get the activity icon of the suggestion source. 5. Fall back to the application icon of the suggestion source if there is no activity icon. 6. Fall back to some generic icon if there is no application icon. Fixes http://b/issue?id=1905757
* Make suggestion text color change based on the item state.Satish Sampath2009-07-091-23/+122
| | | | | | | | | | | | We support a ColorStateList reference now as a valid font color value in the given html and manage html strings for all supported states which we dynamically set while drawing the items. This will get checked in along with changes to GlobalSearch, EnhancedGoogleSearchProvider and Browser to make them use the new model. Bug: http://b/issue?id=1865037
* Fix NPE in SuggestionsAdapter when cursor is null.Bjorn Bringert2009-06-241-1/+1
| | | | Fixes http://b/issue?id=1940013
* Make all static methods in SearchManager non-static.Bjorn Bringert2009-06-221-1/+3
| | | | | | | They were only static because of a now removed restriction that only activity contexts could instantiate SearchManager. This only changes hidden APIs, but all users of the changed methods must be updated to use them non-statically before this is submitted.
* Show proper suggestion item hilite on selection.Satish Sampath2009-06-121-12/+2
| | | | With the new implementation of using a SuggestionItemView, we no longer need to draw a solid background for all items in the suggestion listview. Hence removing the code to draw a default white background, and make the item transparent so the listview-drawn selection hilite shows through.
* Fix display of the selection background for search results.Satish Sampath2009-06-111-2/+69
| | | | I've used a simple approach of not drawing the solid background color for the selected item, thereby letting the default selection background to show through properly. This works by using the item's 'pressed' state and redraw code which are used by the listview during the tapping operation.
* Show progress spinner while waiting for results in in app search.Karl Rosaen2009-06-101-1/+32
|
* Adds UI support for custom search widget item backgrounds.Satish Sampath2009-06-091-35/+55
| | | | | | - A new column was added to SearchManager cursors to specify background color (optional) - Two new colour references added to the theme for normal and search widget corpus items (we need both to be opaque for the items to render properly) - SuggestionAdapter was updated to choose the right theme colour for each item
* SearchDialog should only do DialogCursorProtocol stuff when in global search ↵Karl Rosaen2009-06-041-1/+4
| | | | mode.
* Detect impressions, and cleanup the SearchDialog / SuggestionCursor ↵Karl Rosaen2009-06-041-39/+85
| | | | | | | | | | | | | | | | | | | | | 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.
* Remove support for bitmap icons in search suggestions.Bjorn Bringert2009-06-041-25/+7
| | | | | | | | This is no longer needed, since content providers can now return AssetFileDescriptors for in-memory data. Bitmaps in the suggestion cursor was resopnsible for lots of unnecessary copying, since all rows are copied out of the database regardless of how many are displayed in the UI.
* Close icon input stream in SuggestionsAdapter.Bjorn Bringert2009-06-031-4/+14
| | | | | | Before, SuggestionsAdapter would not close input streams after reading icons from them. This leaks file descriptors and, in the case of MemoryFiles, virtual address space.
* progress towards impression and click stats on all sources, plus some ↵Karl Rosaen2009-06-021-13/+13
| | | | | | | | | | | | | | | internal cleanup (framework portion) suggestionCursor has new callbacks for impressions and clicks - impressions now used to trigger "more" UI, cleanup apis around that search dialog reports which position was clicked on via cursor#respond - can now detect when sources under "more results" are clicked - also used to simplify existing stuff: - can detect when "more results" entry is clicked and toggle base on that (no longer need INTENT_ACTION_CURSOR_RESPOND one off) - use response from click reporting to instruct which position should be selected
* Added some icon debug logging to SuggestionsAdapter.Bjorn Bringert2009-06-021-2/+8
| | | | Good for checking that lazy contact photos works.
* Add framework support for scrolling to the "More results..." list itemMike LeBeau2009-06-011-0/+25
| | | | when it is clicked.
* Cause the icon drawables to animate automatically by calling setVisibleMike LeBeau2009-05-261-0/+8
| | | | | | | | | false and then true on the drawables. For an AnimationDrawable, this will trigger the desired behavior of 'automatically' starting the animation, which should have been working to begin with according to the intended design of AnimationDrawable (see http://b/1878430 for my description of my correspondence with Romain). For Donut we'll just do this to work around it, but for a later release we need to decide a better story.
* Add support to SuggestionsAdapter to query the 'working' statusMike LeBeau2009-05-201-2/+33
| | | | | of its underlying cursor and update a spinner in the search dialog accordingly.
* Refactor SearchableInfo.Bjorn Bringert2009-05-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | - Removes the mSearchable field which was only for communication between the constructor and getActivityMetaData(). - Removes the badge and query rewriting fields, since their values can be efficiently computed on the fly. - Makes all the other public fields private and adds getters for them. - Makes all fields final, except mActionKeys. - Removes the DBG_INHIBIT_SUGGESTIONS_CONSTANT. I don't see why we would every want that, and it complicated making the fields final. - Makes all fields in ActionKeyInfo final. - Makes all fields in ActionKeyInfo private and adds getters. - Removes the use of ActioKeyInfo.mKeyCode for failure signalling. Uses IllegalArgumentException instead. - Replaces the ad hoc linked list for looking up action keys by a HashMap. This is needed to make the fields in ActionkeyInfo final, and also avoids O(N) lookup in the (unlikely) case that an activity has lots of action keys. - Don't throw exceptions when reading searchable meta-data, since that could crash SearchManagerService. - Adds debug logging.
* AI 147681: Fix SearchDialog crash on missing FORMAT suggestion column.Bjorn Bringert2009-04-241-3/+6
| | | | | | | | | | | | CL 147456 introduced support for HTML formatted search suggestions. This is triggered by the value "html" in the SUGGEST_COLUMN_FORMAT column. However, the code failed to check that the SUGGEST_COLUMN_FORMAT column was present before trying to read it. This resulted in an IllegalStateException being thrown when searching with a suggestion provider that does not include the SUGGEST_COLUMN_FORMAT column. This broke search at least in the Contacts and Music apps. Automated import of CL 147681
* AI 147564: Merge back from search branch to donut. Notes:Karl Rosaen2009-04-231-0/+344
- all public apis and framework changes have been reviewed by relevant folks in our branch (e.g romainguy) - all new public apis are @hidden; they will still get reviewed by api council once we're in git - other than that, it's mostly GlobalSearch and search dialog stuff, a new apps provider, and some tweaks to the contacts provider that was reviewed by jham Automated import of CL 147564