use of com.yioks.lzclib.Data.WrapperUri in project lzc_app_lib by httplzc.
the class BigImgDataRequestHelper method getHolderData.
// 获取holder 的catch
private void getHolderData(final WrapperUri wrapperUri) {
final Uri holderUri = wrapperUri.getLowUri();
if (holderUri == null)
return;
ImagePipeline imagePipeline = Fresco.getImagePipeline();
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(holderUri).setResizeOptions(new ResizeOptions(ScreenData.widthPX / 3, ScreenData.heightPX / 3)).build();
DataSource<CloseableReference<CloseableImage>> dataSource = imagePipeline.fetchDecodedImage(request, "");
dataSource.subscribe(new BaseDataSubscriber<CloseableReference<CloseableImage>>() {
@Override
protected void onNewResultImpl(DataSource<CloseableReference<CloseableImage>> dataSource) {
if (!dataSource.isFinished()) {
return;
}
CloseableReference<CloseableImage> ref = dataSource.getResult();
if (ref != null && ref.isValid()) {
try {
if (data.get(wrapperUri.getUri()) == null) {
holderData.put(holderUri, ref.clone());
if (imgDataLoadCompleteListener != null)
imgDataLoadCompleteListener.onHolderDataLoadComplete(wrapperUri);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
CloseableReference.closeSafely(ref);
}
}
}
@Override
protected void onFailureImpl(DataSource<CloseableReference<CloseableImage>> dataSource) {
}
}, UiThreadImmediateExecutorService.getInstance());
}
Aggregations