https://source.codeaurora.org/quic/la/platform/packages/apps/SnapdragonGallery/?h=caf/android_ui.lnx.2.0.1-rel-base
TimeLinePage下的数据加载:
GalleryAcitivity.initializeByIntent()
GalleryAcitivity.startTimelinePage()在这里组装media path “/cluster/{/combo/{/local/all,/picasa/all}}/time”传到TimeLinePage里,然后启动TimeLinePage
TimeLinePage.initializeData(Bundle data)中获取media path
mMediaSet = mActivity.getDataManager().getMediaSet(mMediaSetPath);
DataManager.getMediaSet(Path path)
DataManager.getMediaObject(Path path) 这里的mSourceMap.get(path.getPrefix());通过path的prefix来获取具体是哪个MediaSource的子类;
在initializeSourceMap()里将mSourceMap初始化出来,每个子类初始化时会设置自己的prefix
ClusterSource.createMediaObject(Path path)这里使用ClusterSource子类的createMediaObject(Path path),通过匹配出来的matchType,来创建对应的MediaSource子类ClusterAlbumSet;
DataManager.getMediaSetsFromString(String segment)这里会通过匹配出来的字串,再创建出其他的MediaSource子类ComboSource,LocalSource,PicasaSource,然后在通过matchType创建子类:ComboAlbumSet,LocalAlbumSet,EmptyAlbumSet
mAlbumDataAdapter = new TimeLineDataLoader(mActivity, mMediaSet);这里的mMediaSet是ClusterAlbumSet
TimeLInePage.onResume()中 mAlbumDataAdapter.resume();
TimeLineDataLoader.resume()中启动ReloadTask
ClusterAlbumSet.reload()
ComboAlbumSet.reload()
LocalAlbumSet.reload()
PicasaSource.reload()
updateClusters()
TimeClustering.run(MediaSet baseSet)
MediaSet.enumerateTotalMediaItems(ItemConsumer consumer)
MediaSet.enumerateTotalMediaItems(ItemConsumer consumer, int startIndex)
ClusterAlbum.enumerateMediaItems(ItemConsumer consumer, int startIndex)
DataManager.mapMediaItems(ArrayList<Path> list, ItemConsumer consumer, int startIndex)
LocalSource.mapMediaItems(ArrayList<PathId> list, ItemConsumer consumer)
processMapMediaItems(ArrayList<PathId> list, ItemConsumer consumer, boolean isImage)
getMediaItemById(GalleryApp application, boolean isImage, ArrayList<Integer> ids)
loadOrUpdateItem(Path path, Cursor cursor, DataManager dataManager, GalleryApp app, boolean isImage)
Thumbnail加载:
TimeLinePage.initializeData(Bundle data)中
mAlbumView.setModel(mAlbumDataAdapter);
TimeLineSlotRender.setModel(TimeLineDataLoader model)中
mDataWindow = new TimeLineSlidingWindow(mActivity, model, CACHE_SIZE, mLabelSpec,
mSlotView);
TimeLinePage.onResume()中
mAlbumView.resume();
TimeLineSlotRender.resume中
mDataWindow.resume();
TimeLineSlidingWindow.resume()中
prepareSlotContent(i);
TimeLineSlidingWindow.prepareSlotContent(int slotIndex)中
entry.contentLoader = new ThumbnailLoader(slotIndex, entry.item);
TimeLineSlidingWindow.resume()中
updateAllImageRequests();
TimeLineSlidingWindow.updateAllImageRequests()中
for (int i = mActiveStart, n = mActiveEnd; i < n; ++i) {
if (requestSlotImage(i)) ++mActiveRequestCount;
}
TimeLineSlidingWindow.requestSlotImage(int slotIndex)
entry.contentLoader.startLoad();
ThumbnailLoader.submitBitmapTask(FutureListener<Bitmap> l)中
LocalVideo.requestImage(int type)
ImageCacheRequest.run()中
通过MPath等信息在ImageCacheService中查找图片,如果cache中存在,直接冲cache中获取,如果不存在,则通过localFilePath去解析图片,并将图片保存到cache中