use of com.facebook.imagepipeline.request.ImageRequest in project fresco by facebook.
the class ImagePipelineUtilsImplTest method testBuildImageRequest_whenUriNotNull_thenReturnRequest.
@Test
public void testBuildImageRequest_whenUriNotNull_thenReturnRequest() {
ImageRequest imageRequest = mImagePipelineUtils.buildImageRequest(URI, ImageOptions.defaults());
assertThat(imageRequest).isNotNull();
assertThat(imageRequest.getSourceUri()).isEqualTo(URI);
}
use of com.facebook.imagepipeline.request.ImageRequest in project fresco by facebook.
the class ImagePipelineUtilsImplTest method testBuildImageRequest_whenRotatingEnabled_thenSetRotateOptions.
@Test
public void testBuildImageRequest_whenRotatingEnabled_thenSetRotateOptions() {
RotationOptions rotationOptions = RotationOptions.forceRotation(RotationOptions.ROTATE_270);
final ImageOptions imageOptions = ImageOptions.create().rotate(rotationOptions).build();
ImageRequest imageRequest = mImagePipelineUtils.buildImageRequest(URI, imageOptions);
assertThat(imageRequest).isNotNull();
assertThat(imageRequest.getSourceUri()).isEqualTo(URI);
assertThat(imageRequest.getRotationOptions()).isEqualTo(rotationOptions);
}
use of com.facebook.imagepipeline.request.ImageRequest in project fresco by facebook.
the class VitoImagePipelineImpl method createImageRequest.
@Override
public VitoImageRequest createImageRequest(Resources resources, ImageSource imageSource, @Nullable ImageOptions options) {
if (options == null) {
options = ImageOptions.defaults();
}
if (!(imageSource instanceof VitoImageSource)) {
throw new IllegalArgumentException("ImageSource not supported: " + imageSource);
}
VitoImageSource vitoImageSource = (VitoImageSource) imageSource;
CacheKey finalImageCacheKey = null;
ImageRequest finalImageRequest = vitoImageSource.maybeExtractFinalImageRequest(mImagePipelineUtils, options);
if (finalImageRequest != null) {
finalImageCacheKey = mImagePipeline.getCacheKey(finalImageRequest, null);
}
return new VitoImageRequest(resources, imageSource, options, finalImageRequest, finalImageCacheKey);
}
use of com.facebook.imagepipeline.request.ImageRequest in project gl-react-native by ProjectSeptemberInc.
the class GLImage method reloadImage.
private void reloadImage() {
if (pending != null && !pending.isFinished())
pending.close();
final Uri uri = src;
ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(uri).setAutoRotateEnabled(// I don't really understand why need to disable this. but it actually fixes the image is properly rotated according to EXIF data
false).build();
pending = Fresco.getImagePipeline().fetchDecodedImage(imageRequest, null);
pending.subscribe(new BaseBitmapDataSubscriber() {
@Override
protected void onNewResultImpl(@Nullable Bitmap bitmap) {
onLoad(bitmap);
}
@Override
protected void onFailureImpl(DataSource<CloseableReference<CloseableImage>> dataSource) {
Log.e("GLImage", "Failed to load '" + uri.getPath() + "'", dataSource.getFailureCause());
}
}, decodeExecutor);
}
use of com.facebook.imagepipeline.request.ImageRequest in project teaTime by ancfdy.
the class FrescoUtils method loadGif.
/**
* 加载gif图
* @param draweeView
* @param uriString
*/
public static void loadGif(SimpleDraweeView draweeView, String uriString) {
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(uriString)).build();
DraweeController controller = Fresco.newDraweeControllerBuilder().setImageRequest(request).setAutoPlayAnimations(true).build();
draweeView.setController(controller);
}
Aggregations