use of com.facebook.imagepipeline.image.ImageInfo 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.image.ImageInfo in project fresco by facebook.
the class ControllerListenerWrapperTest method testOnFinalImageSetNormalDrawable.
@Test
public void testOnFinalImageSetNormalDrawable() {
final Drawable drawable = mock(Drawable.class);
final ImageInfo imageInfo = mock(ImageInfo.class);
mControllerListenerWrapper.onFinalImageSet(ID, ImageOrigin.DISK, imageInfo, drawable);
verify(mControllerListener).onFinalImageSet(eq(STRING_ID), eq(imageInfo), isNull(Animatable.class));
verifyNoMoreInteractions(mControllerListener);
}
use of com.facebook.imagepipeline.image.ImageInfo in project fresco by facebook.
the class ControllerListenerWrapperTest method testOnFinalImageSetAnimatedDrawable.
@Test
public void testOnFinalImageSetAnimatedDrawable() {
final AnimatedDrawable drawable = mock(AnimatedDrawable.class);
final ImageInfo imageInfo = mock(ImageInfo.class);
mControllerListenerWrapper.onFinalImageSet(ID, ImageOrigin.DISK, imageInfo, drawable);
verify(mControllerListener).onFinalImageSet(eq(STRING_ID), eq(imageInfo), eq(drawable));
verifyNoMoreInteractions(mControllerListener);
}
Aggregations