use of org.aisen.weibo.sina.ui.activity.picture.PhotosActivity in project AisenWeiBo by wangdan.
the class PictureFragment method loadPicture.
void loadPicture(View v) {
// 下载路径
String url = null;
ImageConfig config = new ImageConfig();
File file = origFile;
// 原图存在,就下载原图
if (file.exists()) {
url = getOrigImage();
} else // 原图不存在,就下载中图
{
file = BitmapLoader.getInstance().getCacheFile(getImage());
config.setId("Picture");
url = getImage();
pictureSize = SinaDB.getDB().selectById(null, PictureSize.class, getOrigImage());
if (pictureSize == null)
new LoadPictureSizeTask().execute();
}
if (!file.exists()) {
progressView.setVisibility(View.VISIBLE);
// 如果网络不是WIFI,且原图和中图都没缓存,那么只加载当前看的那个图片
if (SystemUtils.NetWorkType.wifi != SystemUtils.getNetworkType(getActivity())) {
if (getActivity() instanceof PicsActivity) {
PicsActivity picsActivity = (PicsActivity) getActivity();
if (!picsActivity.getCurrent().getThumbnail_pic().equalsIgnoreCase(image.getThumbnail_pic()))
return;
} else if (getActivity() instanceof PhotosActivity) {
PhotosActivity picsActivity = (PhotosActivity) getActivity();
if (!picsActivity.getCurrent().getThumbnail_pic().equalsIgnoreCase(image.getThumbnail_pic()))
return;
}
}
}
viewFailure.setVisibility(View.GONE);
ImageView imgView = new ImageView(getActivity());
config.setProgress(new PictureDownloadProgress(file));
BitmapLoader.getInstance().display(null, url, imgView, config);
}
Aggregations