zoukankan      html  css  js  c++  java
  • GalleryNote(转)

    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.

  • 相关阅读:
    胡昊—第9次作业--接口及接口回调
    胡昊—第8次作业--继承
    软件工程第三次作业——关于软件质量保障初探
    胡昊—第7次作业--访问权限、对象使用
    胡昊—第6次作业—static关键字、对象
    20194670自动生成四则运算题第一版报告
    《现代软件工程—构建之法》第一章总结
    第四次博客作业-结对项目
    第9次作业--接口及接口回调
    第八次作业--继承
  • 原文地址:https://www.cnblogs.com/leon19870907/p/1967005.html
Copyright © 2011-2022 走看看