[Download Home] Add image thumbnail support
First pass at making a basic thumbnail cache for Download Home.
Still a little janky, but that can be fixed once the skeleton is
in.
Screenshot that enforces that the biggest size is at least X and then crops out the rest:
https://drive.google.com/open?id=0B7c8ZkXVwskDN2FTTmEwOVdWekE
* Add a new ThumbnailProvider[Impl] class that produces thumbnails
for files displayed in Download Home.
- The Java ThumbnailProviderImpl maintains a queue of thumbnail
requests to process and a cache of thumbnails that have already
been processed.
- The native ThumbnailProvider uses the ImageDecoder class to
resize images in the utility process into bite-sized thumbnails
for display. It is owned by the Java class.
- Thumbnails are retrieved asynchronously and sent back via a
callback in ThumbnailRequest.
- The LRU thumbnail cache is statically shared amongst all
instances of the ThumbnailProviderImpl and is garbage collected
whenever Android deems necessary. It's capped at 5 MB to
prevent the cache size from spiralling out of control.
* DownloadManagerUi now maintains a ThumbnailProviderImpl in its
BackendProvider and destroys it when necessary.
* DownloadHistoryAdapter's ItemViewHolder now implements
ThumbnailRequest, which lets it update any ImageViews that have
placeholders for the thumbnails.
X Tests are still forthcoming. Want to make sure the class looks
like it makes sense before writing them.
BUG=616324
TBR=sky
Review-Url: https://codereview.chromium.org/2294983002
Cr-Commit-Position: refs/heads/master@{#415836}
13 files changed