Gallery概述
来源:互联网 发布:容祖儿 知乎 编辑:程序博客网 时间:2024/06/03 14:15
原文地址:http://letsgoustc.spaces.live.com/blog/cns!89AD27DFB5E249BA!492.entry?_c=BlogPart
If the “picture” icon is clicked on Launcher activity, it brings up GalleryPicker activity. The GalleryPicker activity calls ImageManager to query folders which contains image files from MediaProvider. (When reading source code, remember that the gallery and bucket symbol equals to folder.) For each folder, it generates a 142*142 mini thumbnail to represent the folder according to the number of images in the folder. For a single image, that image draws over the whole folder. For four or more images, only the first four photos are selected to make the image.
If no or only one image folders, it automatically launches ImageGallery2 activity to view the folder.
If more than one image folders, it uses GridView to display these auto-generated 142*142 mini thumbnails, when user clicks on any item, it also launches ImageGallery2 activity to view the corresponding folder.
ImageGallery2 creates a background thread to call ImageManager to retrieve a 96*96(defined by MINI_THUMB_TARGET_SIZE) mini thumbnail for any image in the folder. ImageManager first queries whether the mini thumbnail has generated before from MediaProver. If not, it will generate one and update to MediaProvider. The generated method has a special performance consideration: If original image file contains thumbnail picture, it will be used(For some JPEG EXIF file, it may have). All these thumbnails will be saved into one random file in the folder “$(EXTERNAL_STORAGE)/dcim/.thumbnails” by ImageManager. One thumbnail occupies exactly 10000 bytes(defined by sBytesPerMiniThumb) in the file. The file name’s format is “.thumbdata3-XXX”. 3 is MINI_THUMB_DATA_FILE_VERSION. XXX is some kind of hash code corresponding to a folder.
ImageGallery2 implements an important feature just like Windows: It tracks the current position and only fetches these mini thumbnails can be seen at the current position. Other unseen pictures won’t be fetched. So that user can quickly see mini thumbnails when he scrolls down or up. The feature is implemented in GridViewSpecial and ImageBlockManager.
If a mini thumbnail icon is clicked in ImageGallery2, the ViewImage activity will be launched to view the corresponding image. Here's the loading strategy. For any given image, load the thumbnail into memory and post a callback to display the resulting bitmap. Then proceed to load the full image bitmap. All these are implemented in ImageGetter. The thumbnail also is generated only once, as long as generated by ImageManager, it will be saved into “$(EXTERNAL_STORAGE)/dcim/.thumbnails/YYY.jpg”. YYY is some kind of hash code corresponding to an image file. ImageManager also updates to MediaProvider for history use. The maximum thumbnail size is 320*320(define by THUMBNAIL_TARGET_SIZE).
For sliding show feature, it’s implemented in SlideShow activity which will be started from ImageGallery2 and GalleryPicker as the result of one menu item click.
- Gallery概述
- Gallery
- Gallery
- Gallery
- gallery
- gallery
- Gallery
- gallery
- Gallery
- Gallery
- Gallery
- Gallery
- Gallery
- Gallery
- gallery
- gallery
- Gallery
- Gallery
- preparedStatement实现批量处理及Oracle数据库中“;”的问题
- SQL 按月查询
- 自学日语
- 魔兽显血
- 绞车提升能力及钢丝绳验算软件验算结果如下
- Gallery概述
- PHP调用MFC ActiveX控件接口时产生致命错误原因分析
- 数组下标的本质
- Display Tag 的使用(转)
- ul中设置里元素右对齐的方法
- 蜗居的经典台词
- 善用系统监视器,确定系统瓶颈
- div 显示与隐藏
- JavaScript的内置对象和浏览器对象