use of com.facebook.drawee.interfaces.DraweeController in project fresco by facebook.
the class ImageFormatKeyframesFragment method initAnimation.
private void initAnimation(View view) {
mSimpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view);
mSimpleDraweeView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
DraweeController controller = Fresco.newDraweeControllerBuilder().setOldController(mSimpleDraweeView.getController()).setUri(sampleUris().createKeyframesUri()).setAutoPlayAnimations(true).build();
mSimpleDraweeView.setController(controller);
final SwitchCompat switchBackground = (SwitchCompat) view.findViewById(R.id.switch_background);
switchBackground.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mSimpleDraweeView.getHierarchy().setBackgroundImage(isChecked ? new CheckerBoardDrawable(getResources()) : null);
}
});
}
use of com.facebook.drawee.interfaces.DraweeController 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.drawee.interfaces.DraweeController 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.drawee.interfaces.DraweeController 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.drawee.interfaces.DraweeController in project fresco by facebook.
the class ToggleAnimationClickListener method onClick.
@Override
public void onClick(View v) {
DraweeController controller = mDraweeView.getController();
if (controller == null) {
return;
}
Animatable animatable = controller.getAnimatable();
if (animatable == null) {
return;
}
if (animatable.isRunning()) {
animatable.stop();
} else {
animatable.start();
}
}
Aggregations