use of com.facebook.imagepipeline.common.ImageDecodeOptionsBuilder in project fresco by facebook.
the class DraweeRotationFragment method setRotationOptions.
private void setRotationOptions(RotationOptions rotationOptions) {
ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(mUri).setRotationOptions(rotationOptions).setImageDecodeOptions(new ImageDecodeOptionsBuilder().build()).build();
mSimpleDraweeView.setImageRequest(imageRequest);
}
use of com.facebook.imagepipeline.common.ImageDecodeOptionsBuilder in project fresco by facebook.
the class ImageFormatGifFragment method setAnimationUri.
private void setAnimationUri(Uri uri) {
final PipelineDraweeControllerBuilder controllerBuilder = Fresco.newDraweeControllerBuilder().setAutoPlayAnimations(mAutoPlayEnabled).setOldController(mSimpleDraweeView.getController());
final ImageDecodeOptionsBuilder optionsBuilder = ImageDecodeOptions.newBuilder().setMaxDimensionPx(4000);
if (mGifDecoder != null) {
optionsBuilder.setCustomImageDecoder(mGifDecoder);
}
controllerBuilder.setImageRequest(ImageRequestBuilder.newBuilderWithSource(uri).setImageDecodeOptions(optionsBuilder.build()).build());
if (!mAutoPlayEnabled) {
controllerBuilder.setControllerListener(new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(String id, @Nullable ImageInfo imageInfo, @Nullable final Animatable animatable) {
if (animatable != null) {
mSimpleDraweeView.getHierarchy().setOverlayImage(getPlayOverlayDrawable());
mSimpleDraweeView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (animatable.isRunning()) {
animatable.stop();
mSimpleDraweeView.getHierarchy().setOverlayImage(getPlayOverlayDrawable());
} else {
animatable.start();
mSimpleDraweeView.getHierarchy().setOverlayImage(null);
}
}
});
}
}
});
} else {
mSimpleDraweeView.getHierarchy().setOverlayImage(null);
}
mSimpleDraweeView.setController(controllerBuilder.build());
}
use of com.facebook.imagepipeline.common.ImageDecodeOptionsBuilder in project fresco by facebook.
the class ImageFormatOverrideExample method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
SimpleDraweeView simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view);
ImageDecodeOptions imageDecodeOptionsWithCustomDecoder = new ImageDecodeOptionsBuilder().setCustomImageDecoder(CUSTOM_COLOR_DECODER).build();
AbstractDraweeController controller = Fresco.newDraweeControllerBuilder().setImageRequest(ImageRequestBuilder.newBuilderWithResourceId(R.raw.custom_color1).setImageDecodeOptions(imageDecodeOptionsWithCustomDecoder).build()).build();
simpleDraweeView.setController(controller);
}
use of com.facebook.imagepipeline.common.ImageDecodeOptionsBuilder 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.common.ImageDecodeOptionsBuilder in project fresco by facebook.
the class ImageRequestTest method testCreatingRequestFromExistingRequest.
@Test
public void testCreatingRequestFromExistingRequest() {
ImageRequest original = ImageRequestBuilder.newBuilderWithSource(Uri.parse("http://frescolib.org/image.jpg")).setCacheChoice(ImageRequest.CacheChoice.SMALL).setImageDecodeOptions(new ImageDecodeOptionsBuilder().build()).setLocalThumbnailPreviewsEnabled(true).setLowestPermittedRequestLevel(ImageRequest.RequestLevel.DISK_CACHE).setPostprocessor(new BasePostprocessor() {
@Override
public String getName() {
return super.getName();
}
}).setProgressiveRenderingEnabled(true).setRequestListener(new RequestLoggingListener()).setResizeOptions(new ResizeOptions(20, 20)).setRotationOptions(RotationOptions.forceRotation(RotationOptions.ROTATE_90)).setRequestPriority(Priority.HIGH).build();
ImageRequest copy = ImageRequestBuilder.fromRequest(original).build();
assertThat(copy).isEqualTo(original);
}
Aggregations