use of com.facebook.imagepipeline.request.ImageRequest in project fresco by facebook.
the class ImagePipelinePostProcessorFragment method setPostprocessor.
private void setPostprocessor(Postprocessor postprocessor) {
final ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(mUri).setPostprocessor(postprocessor).build();
final DraweeController draweeController = Fresco.newDraweeControllerBuilder().setOldController(mDraweeMain.getController()).setImageRequest(imageRequest).build();
mDraweeMain.setController(draweeController);
}
use of com.facebook.imagepipeline.request.ImageRequest in project fresco by facebook.
the class ImagePipelineResizingFragment method reloadImage.
private void reloadImage(Uri imageUri, @Nullable ResizeOptions resizeOptions) {
final ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(imageUri).setResizeOptions(resizeOptions).setImageDecodeOptions(new ImageDecodeOptionsBuilder().build()).build();
final DraweeController draweeController = Fresco.newDraweeControllerBuilder().setOldController(mDraweeMain.getController()).setImageRequest(imageRequest).build();
mDraweeMain.setController(draweeController);
}
use of com.facebook.imagepipeline.request.ImageRequest in project fresco by facebook.
the class ImageFormatProgressiveJpegFragment method setImageUri.
private void setImageUri(Uri uri) {
mDebugOutput.setText("");
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri).setProgressiveRenderingEnabled(mProgressiveRenderingEnabled).build();
DraweeController controller = Fresco.newDraweeControllerBuilder().setImageRequest(request).setRetainImageOnFailure(true).setPerfDataListener(mImagePerfDataListener).setControllerListener(new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(String id, @javax.annotation.Nullable ImageInfo imageInfo, @javax.annotation.Nullable Animatable animatable) {
if (imageInfo != null) {
QualityInfo qualityInfo = imageInfo.getQualityInfo();
logScan(qualityInfo, true);
}
}
@Override
public void onIntermediateImageSet(String id, @javax.annotation.Nullable ImageInfo imageInfo) {
if (imageInfo != null) {
QualityInfo qualityInfo = imageInfo.getQualityInfo();
logScan(qualityInfo, false);
}
}
@Override
public void onIntermediateImageFailed(String id, Throwable throwable) {
mDebugOutput.append(String.format(Locale.getDefault(), "onIntermediateImageFailed, %s\n", throwable.getMessage()));
}
}).build();
mSimpleDraweeView.setController(controller);
}
use of com.facebook.imagepipeline.request.ImageRequest in project fresco by facebook.
the class PipelineDraweeControllerBuilder method getCacheKey.
@Nullable
private CacheKey getCacheKey() {
final ImageRequest imageRequest = getImageRequest();
final CacheKeyFactory cacheKeyFactory = mImagePipeline.getCacheKeyFactory();
CacheKey cacheKey = null;
if (cacheKeyFactory != null && imageRequest != null) {
if (imageRequest.getPostprocessor() != null) {
cacheKey = cacheKeyFactory.getPostprocessedBitmapCacheKey(imageRequest, getCallerContext());
} else {
cacheKey = cacheKeyFactory.getBitmapCacheKey(imageRequest, getCallerContext());
}
}
return cacheKey;
}
use of com.facebook.imagepipeline.request.ImageRequest in project fresco by facebook.
the class ImagePipeline method submitFetchRequest.
private <T> DataSource<CloseableReference<T>> submitFetchRequest(Producer<CloseableReference<T>> producerSequence, ImageRequest imageRequest, ImageRequest.RequestLevel lowestPermittedRequestLevelOnSubmit, @Nullable Object callerContext, @Nullable RequestListener requestListener, @Nullable String uiComponentId) {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection("ImagePipeline#submitFetchRequest");
}
final RequestListener2 requestListener2 = new InternalRequestListener(getRequestListenerForRequest(imageRequest, requestListener), mRequestListener2);
if (mCallerContextVerifier != null) {
mCallerContextVerifier.verifyCallerContext(callerContext, false);
}
try {
ImageRequest.RequestLevel lowestPermittedRequestLevel = ImageRequest.RequestLevel.getMax(imageRequest.getLowestPermittedRequestLevel(), lowestPermittedRequestLevelOnSubmit);
SettableProducerContext settableProducerContext = new SettableProducerContext(imageRequest, generateUniqueFutureId(), uiComponentId, requestListener2, callerContext, lowestPermittedRequestLevel, /* isPrefetch */
false, imageRequest.getProgressiveRenderingEnabled() || !UriUtil.isNetworkUri(imageRequest.getSourceUri()), imageRequest.getPriority(), mConfig);
return CloseableProducerToDataSourceAdapter.create(producerSequence, settableProducerContext, requestListener2);
} catch (Exception exception) {
return DataSources.immediateFailedDataSource(exception);
} finally {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.endSection();
}
}
}
Aggregations