use of com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder in project DevRing by LJYcoder.
the class FrescoManager method getController.
/**
* 构建、获取Controller
*
* @param request
* @param oldController
* @return
*/
private DraweeController getController(ImageRequest request, @Nullable DraweeController oldController) {
PipelineDraweeControllerBuilder builder = Fresco.newDraweeControllerBuilder();
builder.setImageRequest(request);
// 设置是否允许加载失败时点击再次加载
builder.setTapToRetryEnabled(false);
// 设置是否允许动画图自动播放
builder.setAutoPlayAnimations(true);
builder.setOldController(oldController);
return builder.build();
}
use of com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder 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.drawee.backends.pipeline.PipelineDraweeControllerBuilder in project ride-read-android by Ride-Read.
the class ImgLoader method displayImage.
public void displayImage(String photoUrl, SimpleDraweeView simpleDraweeView, DisplayImageOptions displayImageOptions, ControllerListener controllerListener) {
if (simpleDraweeView == null)
return;
if (displayImageOptions != null) {
simpleDraweeView.getHierarchy().setPlaceholderImage(displayImageOptions.getDefaultPlaceHolder());
simpleDraweeView.getHierarchy().setRoundingParams(displayImageOptions.getRoundingParams());
}
PipelineDraweeControllerBuilder draweeControllerBuilder = Fresco.newDraweeControllerBuilder();
if (!TextUtils.isEmpty(photoUrl))
draweeControllerBuilder.setUri(Uri.parse(photoUrl));
if (controllerListener != null) {
draweeControllerBuilder.setControllerListener(controllerListener);
}
simpleDraweeView.setController(draweeControllerBuilder.build());
// ImgFrescoLoadBuilder.start(simpleDraweeView, photoUrl).build();
}
use of com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder in project ride-read-android by Ride-Read.
the class ImageActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
imageUrl = getIntent().getStringExtra(IMAGE);
if (imageUrl.startsWith("/")) {
imageUrl = "file://" + imageUrl;
}
final PhotoDraweeView photoDraweeView = (PhotoDraweeView) findViewById(R.id.iv_image_activity);
photoDraweeView.setOnViewTapListener(new OnViewTapListener() {
@Override
public void onViewTap(View view, float x, float y) {
onBackPressed();
}
});
PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder();
controller.setUri(Uri.parse(imageUrl));
controller.setOldController(photoDraweeView.getController());
controller.setControllerListener(new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
super.onFinalImageSet(id, imageInfo, animatable);
if (imageInfo == null) {
return;
}
photoDraweeView.update(imageInfo.getWidth(), imageInfo.getHeight());
}
});
photoDraweeView.setController(controller.build());
}
use of com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder in project DevRing by LJYcoder.
the class FrescoManager method getController.
/**
* 构建、获取Controller
*
* @param request
* @param oldController
* @return
*/
private DraweeController getController(ImageRequest request, @Nullable DraweeController oldController) {
PipelineDraweeControllerBuilder builder = Fresco.newDraweeControllerBuilder();
builder.setImageRequest(request);
// 设置是否允许加载失败时点击再次加载
builder.setTapToRetryEnabled(false);
// 设置是否允许动画图自动播放
builder.setAutoPlayAnimations(true);
builder.setOldController(oldController);
return builder.build();
}
Aggregations