Search in sources :

Example 1 with PipelineDraweeControllerBuilder

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();
}
Also used : PipelineDraweeControllerBuilder(com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder)

Example 2 with PipelineDraweeControllerBuilder

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());
}
Also used : Animatable(android.graphics.drawable.Animatable) ImageInfo(com.facebook.imagepipeline.image.ImageInfo) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ImageDecodeOptionsBuilder(com.facebook.imagepipeline.common.ImageDecodeOptionsBuilder) PipelineDraweeControllerBuilder(com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder)

Example 3 with PipelineDraweeControllerBuilder

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();
}
Also used : PipelineDraweeControllerBuilder(com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder)

Example 4 with PipelineDraweeControllerBuilder

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());
}
Also used : OnViewTapListener(me.relex.photodraweeview.OnViewTapListener) Animatable(android.graphics.drawable.Animatable) PhotoDraweeView(me.relex.photodraweeview.PhotoDraweeView) ImageInfo(com.facebook.imagepipeline.image.ImageInfo) View(android.view.View) PhotoDraweeView(me.relex.photodraweeview.PhotoDraweeView) PipelineDraweeControllerBuilder(com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder)

Example 5 with PipelineDraweeControllerBuilder

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();
}
Also used : PipelineDraweeControllerBuilder(com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder)

Aggregations

PipelineDraweeControllerBuilder (com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder)8 Animatable (android.graphics.drawable.Animatable)2 View (android.view.View)2 ResizeOptions (com.facebook.imagepipeline.common.ResizeOptions)2 ImageInfo (com.facebook.imagepipeline.image.ImageInfo)2 ImageRequestBuilder (com.facebook.imagepipeline.request.ImageRequestBuilder)2 Context (android.content.Context)1 Uri (android.net.Uri)1 AdapterView (android.widget.AdapterView)1 TextView (android.widget.TextView)1 GenericDraweeHierarchy (com.facebook.drawee.generic.GenericDraweeHierarchy)1 SimpleDraweeView (com.facebook.drawee.view.SimpleDraweeView)1 ImageDecodeOptionsBuilder (com.facebook.imagepipeline.common.ImageDecodeOptionsBuilder)1 InstrumentedDraweeView (com.facebook.samples.scrollperf.instrumentation.InstrumentedDraweeView)1 FileVMCallback (im.actor.core.viewmodel.FileVMCallback)1 FileSystemReference (im.actor.runtime.files.FileSystemReference)1 File (java.io.File)1 OnViewTapListener (me.relex.photodraweeview.OnViewTapListener)1 PhotoDraweeView (me.relex.photodraweeview.PhotoDraweeView)1