com.facebook.imagepipeline.request.ImageRequestBuilder Java Examples

The following examples show how to use com.facebook.imagepipeline.request.ImageRequestBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CallBackgroundAvatarView.java    From actor-platform with GNU Affero General Public License v3.0 6 votes vote down vote up
public void bindRaw(String fileName) {
    if (bindedFile != null) {
        bindedFile.detach();
        bindedFile = null;
    }
    currentId = 0;

    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.fromFile(new File(fileName)))
            .setAutoRotateEnabled(true)
            .build();
    PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
            .setOldController(getController())
            .setImageRequest(request)
            .build();
    setController(controller);
}
 
Example #2
Source File: AvatarView.java    From actor-platform with GNU Affero General Public License v3.0 6 votes vote down vote up
public void bindRaw(String fileName) {
    if (bindedFile != null) {
        bindedFile.detach();
        bindedFile = null;
    }
    currentId = 0;

    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.fromFile(new File(fileName)))
            .setResizeOptions(new ResizeOptions(size, size))
            .setAutoRotateEnabled(true)
            .build();
    PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
            .setOldController(getController())
            .setImageRequest(request)
            .build();
    setController(controller);
}
 
Example #3
Source File: FrescoImageLoader.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public static void display(SimpleDraweeView view, String uri, int width, int height, ControllerListener listener) {
    if (uri != null) {
        PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder();
        controller.setOldController(view.getController());
        controller.setAutoPlayAnimations(true);
        ImageRequestBuilder imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(uri)).setCacheChoice(CacheChoice.SMALL).setLocalThumbnailPreviewsEnabled(true);
        imageRequest.setProgressiveRenderingEnabled(true);
        Log.d("Good", uri);
        if (width > 0 && height > 0) {
            imageRequest.setResizeOptions(new ResizeOptions(width, height));
        }
        controller.setImageRequest(imageRequest.build());
        controller.setControllerListener(listener);
        view.setController(controller.build());
    }
}
 
Example #4
Source File: FacebookImageUtil.java    From imsdk-android with MIT License 6 votes vote down vote up
public static void loadWithCache(String url, final SimpleDraweeView target,ImageRequest.CacheChoice type,boolean playAnim)
{
    if (target == null) return;

    Uri uri = Uri.parse(url);
    ImageRequestBuilder builder = ImageRequestBuilder.newBuilderWithSource(uri);
    ImageRequest request = builder
            .setCacheChoice(type)
            .build();
    final PipelineDraweeControllerBuilder pipelineDraweeControllerBuilder = Fresco.newDraweeControllerBuilder()
            .setImageRequest(request)
            .setAutoPlayAnimations(playAnim)
            .setOldController(target.getController());
    handler.post(new Runnable() {
        @Override
        public void run() {
            DraweeController controller = pipelineDraweeControllerBuilder.build();
            target.setController(controller);
        }
    });

}
 
Example #5
Source File: FrescoImageloadHelper.java    From nono-android with GNU General Public License v3.0 6 votes vote down vote up
public static void LoadImageFromURIAndCallBack(SimpleDraweeView destImageView , Uri uri,Context context,BaseBitmapDataSubscriber bbds)
{
    int w = destImageView.getWidth();
    int h  =destImageView.getHeight();
    if(w<1){
        w = destImageView.getLayoutParams().width;
    }
    if(h<1){
        h  =destImageView.getLayoutParams().height;
    }
    ImageRequest imageRequest =
            ImageRequestBuilder.newBuilderWithSource(uri)
                    .setResizeOptions(new ResizeOptions(w,h))
                    .setProgressiveRenderingEnabled(true)
                    .build();
    ImagePipeline imagePipeline = Fresco.getImagePipeline();
    DataSource<CloseableReference<CloseableImage>> dataSource = imagePipeline.fetchDecodedImage(imageRequest, context);
    dataSource.subscribe(bbds, CallerThreadExecutor.getInstance());
    DraweeController draweeController = Fresco.newDraweeControllerBuilder()
            .setImageRequest(imageRequest)
            .setOldController(destImageView.getController())
            .setAutoPlayAnimations(true)
            .build();
    destImageView.setController(draweeController);
}
 
Example #6
Source File: ImageFormatOverrideExample.java    From fresco with MIT License 6 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
  SimpleDraweeView simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view);

  ImageDecodeOptions imageDecodeOptionsWithCustomDecoder =
      new ImageDecodeOptionsBuilder().setCustomImageDecoder(CUSTOM_COLOR_DECODER).build();

  AbstractDraweeController controller =
      Fresco.newDraweeControllerBuilder()
          .setImageRequest(
              ImageRequestBuilder.newBuilderWithResourceId(R.raw.custom_color1)
                  .setImageDecodeOptions(imageDecodeOptionsWithCustomDecoder)
                  .build())
          .build();
  simpleDraweeView.setController(controller);
}
 
Example #7
Source File: PipelineUtil.java    From fresco with MIT License 6 votes vote down vote up
/**
 * Utility method which adds optional configuration to ImageRequest
 *
 * @param imageRequestBuilder The Builder for ImageRequest
 * @param config The Config
 */
public static void addOptionalFeatures(ImageRequestBuilder imageRequestBuilder, Config config) {
  if (config.usePostprocessor) {
    final Postprocessor postprocessor;
    switch (config.postprocessorType) {
      case "use_slow_postprocessor":
        postprocessor = DelayPostprocessor.getMediumPostprocessor();
        break;
      case "use_fast_postprocessor":
        postprocessor = DelayPostprocessor.getFastPostprocessor();
        break;
      default:
        postprocessor = DelayPostprocessor.getMediumPostprocessor();
    }
    imageRequestBuilder.setPostprocessor(postprocessor);
  }
  if (config.rotateUsingMetaData) {
    imageRequestBuilder.setRotationOptions(RotationOptions.autoRotateAtRenderTime());
  } else {
    imageRequestBuilder.setRotationOptions(
        RotationOptions.forceRotation(config.forcedRotationAngle));
  }
}
 
Example #8
Source File: CanPhotoHelper.java    From CanPhotos with Apache License 2.0 6 votes vote down vote up
/**
 * 设置图片
 *
 * @param image
 * @param url
 * @param width
 * @param heigth
 */
public void setDraweeImage(SimpleDraweeView image, String url, int width, int heigth) {


    if (width <= 0) {
        width = dp2Px(image.getContext(), 50);
    }
    if (heigth <= 0) {
        heigth = dp2Px(image.getContext(), 50);
    }

    ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url)).setLocalThumbnailPreviewsEnabled(true).setResizeOptions(new ResizeOptions(width, heigth)).build();
    DraweeController draweeController = Fresco.newDraweeControllerBuilder()
            .setImageRequest(imageRequest)
            .setAutoPlayAnimations(true)
            .build();
    image.setController(draweeController);

}
 
Example #9
Source File: AMapMarker.java    From react-native-amap with MIT License 6 votes vote down vote up
public void setImage(String uri) {
    if (uri == null) {
        iconBitmapDescriptor = null;
        update();
    } else if (uri.startsWith("http://") || uri.startsWith("https://") ||
            uri.startsWith("file://")) {
        ImageRequest imageRequest = ImageRequestBuilder
                .newBuilderWithSource(Uri.parse(uri))
                .build();

        ImagePipeline imagePipeline = Fresco.getImagePipeline();
        dataSource = imagePipeline.fetchDecodedImage(imageRequest, this);
        DraweeController controller = Fresco.newDraweeControllerBuilder()
                .setImageRequest(imageRequest)
                .setControllerListener(mLogoControllerListener)
                .setOldController(logoHolder.getController())
                .build();
        logoHolder.setController(controller);
    } else {
        iconBitmapDescriptor = getBitmapDescriptorByName(uri);
        update();
    }
}
 
Example #10
Source File: FrescoUtils.java    From droidddle with Apache License 2.0 6 votes vote down vote up
public static final void setShotUrl(DraweeView view, String url, String thumbnail/*, BaseControllerListener listener*/) {
        ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url))
//                .setResizeOptions(
//                        new ResizeOptions(300, 400))
                .setProgressiveRenderingEnabled(true)
                .build();
        ImageRequest lowRequest = null;
        if (!TextUtils.isEmpty(thumbnail)) {
            lowRequest = ImageRequest.fromUri(thumbnail);
        }
        DraweeController draweeController = Fresco.newDraweeControllerBuilder()
                .setImageRequest(imageRequest)
                .setLowResImageRequest(lowRequest)
                .setOldController(view.getController())
                .setAutoPlayAnimations(true)
//                .setControllerListener(listener)
                .build();
        view.setController(draweeController);
    }
 
Example #11
Source File: ImageFormatGifFragment.java    From fresco with MIT License 6 votes vote down vote up
private void setAnimationUri(Uri uri) {
  final PipelineDraweeControllerBuilder controllerBuilder =
      Fresco.newDraweeControllerBuilder()
          .setAutoPlayAnimations(true)
          .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());
  mSimpleDraweeView.setController(controllerBuilder.build());
}
 
Example #12
Source File: FrescoImageloadHelper.java    From nono-android with GNU General Public License v3.0 6 votes vote down vote up
public static void LoadImageFromURLAndCallBack(SimpleDraweeView destImageView , String URL,Context context,BaseBitmapDataSubscriber bbds)
{
    int w = destImageView.getWidth();
    int h  =destImageView.getHeight();
    if(w<1){
        w = destImageView.getLayoutParams().width;
    }
    if(h<1){
        h  =destImageView.getLayoutParams().height;
    }
    ImageRequest imageRequest =
            ImageRequestBuilder.newBuilderWithSource(Uri.parse(URL))
                    .setResizeOptions(new ResizeOptions(w,h))
                    .setProgressiveRenderingEnabled(true)
                    .build();
    ImagePipeline imagePipeline = Fresco.getImagePipeline();
    DataSource<CloseableReference<CloseableImage>> dataSource = imagePipeline.fetchDecodedImage(imageRequest, context);
    dataSource.subscribe(bbds, CallerThreadExecutor.getInstance());
    DraweeController draweeController = Fresco.newDraweeControllerBuilder()
            .setImageRequest(imageRequest)
            .setOldController(destImageView.getController())
            .setAutoPlayAnimations(true)
            .build();
    destImageView.setController(draweeController);
}
 
Example #13
Source File: CommentImageGrid.java    From CommentGallery with Apache License 2.0 6 votes vote down vote up
private void refreshImageChild() {
    int childrenCount = getChildCount();
    if (childrenCount > 0) {
        for (int i = 0; i < childrenCount; i++) {
            ViewGroup childImageLayout = (ViewGroup) getChildAt(i);
            SimpleDraweeView childImageView = (SimpleDraweeView) childImageLayout.getChildAt(0);
            if (mOnItemClickListener != null) {
                final int finalI = i;
                childImageLayout.setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        mOnItemClickListener.OnItemClick(finalI);
                    }
                });
            }
            ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(mImageUrls.get(i)))
                    .setResizeOptions(new ResizeOptions(mItemWidth, mItemWidth))
                    .build();
            DraweeController controller = Fresco.newDraweeControllerBuilder()
                    .setImageRequest(request)
                    .setOldController(childImageView.getController())
                    .build();
            childImageView.setController(controller);
        }
    }
}
 
Example #14
Source File: ImagePipelineUtilsImpl.java    From fresco with MIT License 5 votes vote down vote up
@Override
@Nullable
public ImageRequest buildImageRequest(@Nullable Uri uri, DecodedImageOptions imageOptions) {
  if (uri == null) {
    return null;
  }
  final ImageRequestBuilder imageRequestBuilder =
      createEncodedImageRequestBuilder(uri, imageOptions);
  ImageRequestBuilder builder =
      createDecodedImageRequestBuilder(imageRequestBuilder, imageOptions);
  return builder != null ? builder.build() : null;
}
 
Example #15
Source File: DecodeProducerTest.java    From fresco with MIT License 5 votes vote down vote up
private void setupNetworkUri(@Nullable ResizeOptions resizeOptions) {
  setupImageRequest(
      "networkRequest1",
      ImageRequestBuilder.newBuilderWithSource(Uri.parse("http://www.fb.com/image"))
          .setProgressiveRenderingEnabled(true)
          .setImageDecodeOptions(IMAGE_DECODE_OPTIONS)
          .setResizeOptions(resizeOptions)
          .build());
}
 
Example #16
Source File: ImageFragment.java    From TLint with Apache License 2.0 5 votes vote down vote up
@Override
public void initData() {
    showContent(true);
    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url))
            .setProgressiveRenderingEnabled(true)
            .build();

    GenericDraweeHierarchy hierarchy =
            new GenericDraweeHierarchyBuilder(getResources()).setProgressBarImage(
                    new ImageLoadProgressBar(new ImageLoadProgressBar.OnLevelChangeListener() {
                        @Override
                        public void onChange(int level) {
                            if (level > 100 && progress.getVisibility() == View.VISIBLE) {
                                progress.setVisibility(View.GONE);
                            }
                        }
                    }, ResourceUtil.getThemeColor(getActivity()))).build();
    hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER);

    PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder();
    controller.setControllerListener(listener);
    controller.setImageRequest(request);
    controller.setOldController(image.getController());
    controller.setAutoPlayAnimations(true);
    image.setHierarchy(hierarchy);
    image.setController(controller.build());
}
 
Example #17
Source File: ThreadListFragment.java    From TLint with Apache License 2.0 5 votes vote down vote up
@Override
public void renderThreadInfo(Forum forum) {
    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(forum.getBackImg()))
            .setResizeOptions(new ResizeOptions(500, 500))
            .build();
    DraweeController draweeController = Fresco.newDraweeControllerBuilder()
            .setImageRequest(request)
            .setOldController(backdrop.getController())
            .setAutoPlayAnimations(true)
            .build();
    backdrop.setController(draweeController);
    collapsingToolbar.setTitle(forum.getName());
    tvSubTitle.setText(forum.getDescription());
}
 
Example #18
Source File: ImagePipelineConfigTest.java    From fresco with MIT License 5 votes vote down vote up
@Test
public void testImageRequestWhenChangedAndOverriden() {
  ImagePipelineConfig.resetDefaultRequestConfig();
  final ImageRequest imageRequest =
      ImageRequestBuilder.newBuilderWithSource(mUri).setProgressiveRenderingEnabled(true).build();
  assertTrue(imageRequest.getProgressiveRenderingEnabled());
  final ImageRequest imageRequest2 =
      ImageRequestBuilder.newBuilderWithSource(mUri)
          .setProgressiveRenderingEnabled(false)
          .build();
  assertFalse(imageRequest2.getProgressiveRenderingEnabled());
}
 
Example #19
Source File: PipelineDraweeControllerBuilder.java    From fresco with MIT License 5 votes vote down vote up
@Override
public PipelineDraweeControllerBuilder setUri(@Nullable Uri uri) {
  if (uri == null) {
    return super.setImageRequest(null);
  }
  ImageRequest imageRequest =
      ImageRequestBuilder.newBuilderWithSource(uri)
          .setRotationOptions(RotationOptions.autoRotateAtRenderTime())
          .build();
  return super.setImageRequest(imageRequest);
}
 
Example #20
Source File: ImagePipelineUtilsImpl.java    From fresco with MIT License 5 votes vote down vote up
@Override
@Nullable
public ImageRequest buildEncodedImageRequest(
    @Nullable Uri uri, EncodedImageOptions imageOptions) {
  ImageRequestBuilder builder = createEncodedImageRequestBuilder(uri, imageOptions);
  return builder != null ? builder.build() : null;
}
 
Example #21
Source File: ImagePipelineUtilsImpl.java    From fresco with MIT License 5 votes vote down vote up
@Nullable
protected ImageRequestBuilder createEncodedImageRequestBuilder(
    @Nullable Uri uri, EncodedImageOptions imageOptions) {
  if (uri == null) {
    return null;
  }
  return ImageRequestBuilder.newBuilderWithSource(uri)
      .setRequestPriority(imageOptions.getPriority());
}
 
Example #22
Source File: MineFragment.java    From fingerpoetry-android with Apache License 2.0 5 votes vote down vote up
private void   updateData() {
    user = AccountLogic.getInstance().getNowUser();
    if(user == null){
        return;
    }
    tvName.setText(user.getName());
    String url = ActivityUtil.genPic(user.getId().hashCode());
    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url))
            .setPostprocessor(postprocessor)
            .build();

    PipelineDraweeController controller =
            (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
                    .setImageRequest(request)
                    .setOldController(ivBg.getController())
                    .build();
    ivBg.setController(controller);
    String avartar = "https://second.imdao.cn"+user.getAvatar();
    Timber.i("avatar:"+avartar);
    ivAvatar.setImageURI(Uri.parse(avartar));
    StringBuilder desc = new StringBuilder();
    desc.append(getString(R.string.readed)).append(" ")
            .append(user.getReadCount())
            .append("  ").append(getString(R.string.collected))
            .append(" ").append(user.getCollectCount())
            .append("  ").append(getString(R.string.share))
            .append(" ").append(user.getShareCount());
    tvSig.setText(desc);
    registerAt.setText("加入时间:"+DateUtil.getFriendlyTimeSpanByNow(user.getCreateAt()));
}
 
Example #23
Source File: FrescoImageloadHelper.java    From nono-android with GNU General Public License v3.0 5 votes vote down vote up
public static void LoadFullImageFromURL(final SimpleDraweeView destImageView , final String URL)
{
    destImageView.post(new Runnable() {
        @Override
        public void run() {
            int w = destImageView.getWidth();
            int h  =destImageView.getHeight();
            ViewGroup.LayoutParams  params = destImageView.getLayoutParams();
            if(w<1){
                w = params.width;
            }
            if(h<1){
                h  = params.height;
            }
            ImageRequest imageRequest =
                    ImageRequestBuilder.newBuilderWithSource(Uri.parse(URL))
                            .setResizeOptions(new ResizeOptions(w, h))
                            .setProgressiveRenderingEnabled(true)
                            .build();
            DraweeController draweeController = Fresco.newDraweeControllerBuilder()
                    .setImageRequest(imageRequest)
                    .setOldController(destImageView.getController())
                    .setAutoPlayAnimations(true)
                    .build();
            destImageView.setController(draweeController);
        }
    });

}
 
Example #24
Source File: FrescoUtil.java    From AndroidPlayground with MIT License 5 votes vote down vote up
public static void loadWithSize(ShapedDraweeView draweeView, Uri uri, int width, int height) {
    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
            .setResizeOptions(new ResizeOptions(width, height))
            .setProgressiveRenderingEnabled(true)
            .setAutoRotateEnabled(true)
            .build();
    AbstractDraweeController controller = Fresco.newDraweeControllerBuilder()
            .setImageRequest(request)
            .setAutoPlayAnimations(true)
            .build();
    draweeView.setController(controller);
}
 
Example #25
Source File: FrescoUtils.java    From droidddle with Apache License 2.0 5 votes vote down vote up
public static final void setShotImage(DraweeView view, Uri uri) {
        ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(uri)
                .setProgressiveRenderingEnabled(true)
//                        .setResizeOptions(new ResizeOptions(1024,1024))
                .build();
        DraweeController draweeController = Fresco.newDraweeControllerBuilder()
                .setImageRequest(imageRequest)
                .setOldController(view.getController())
                .setAutoPlayAnimations(true)
                .build();
        view.setController(draweeController);
    }
 
Example #26
Source File: UniversalDraweeView.java    From JianshuApp with GNU General Public License v3.0 5 votes vote down vote up
private void loadImageURI(Uri uri, @Nullable Object callerContext, int width, int height) {
    // 对URL做格式转换、尺寸限制等处理
    uri = Uri.parse(ImageUtils.format(uri.toString(), DisplayInfo.getWidthPixels()));

    ImageRequestBuilder imageRequestBuilder = ImageRequestBuilder.newBuilderWithSource(uri);
    imageRequestBuilder.setProgressiveRenderingEnabled(true);

    imageRequestBuilder.setRotationOptions(RotationOptions.autoRotateAtRenderTime());
    if (width > 0 && height > 0) {
        imageRequestBuilder.setResizeOptions(new ResizeOptions(width, height));
    }

    PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder()
            .setCallerContext(callerContext)
            .setImageRequest(imageRequestBuilder.build())
            .setOldController(getController())
            .setAutoPlayAnimations(true)  // 自动播放动态图
            .setTapToRetryEnabled(true)  // 在加载失败时,可以点击重新加载
            .setControllerListener(new BaseControllerListener<ImageInfo>() {
                @Override
                public void onFinalImageSet(String id,
                                            ImageInfo imageInfo,
                                            Animatable animatable) {
                    super.onFinalImageSet(id, imageInfo, animatable);
                    onUpdateImage(imageInfo);
                }
            });
    if (AppUtils.isMainThread()) {
        setController(controller.build());
    } else {
        Observable.just(0)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(it -> setController(controller.build()));
    }
}
 
Example #27
Source File: FrescoFactory.java    From FrescoUtils with Apache License 2.0 5 votes vote down vote up
public static ImageRequest buildImageRequestWithSource(BaseFrescoImageView fresco, Point size){
    String thumbnail = null;
    if(TextUtils.isEmpty(fresco.getThumbnailUrl())){
        thumbnail = fresco.getThumbnailPath();
    }else{
        thumbnail = fresco.getThumbnailUrl();
    }
    Uri uri = Uri.parse(thumbnail);
    return  ImageRequestBuilder.newBuilderWithSource(uri)
            .setPostprocessor(fresco.getPostProcessor())
            .setAutoRotateEnabled(fresco.getAutoRotateEnabled())
            .setResizeOptions(new ResizeOptions(size.x, size.y))
            .setLocalThumbnailPreviewsEnabled(true)
            .build();
}
 
Example #28
Source File: FrescoFactory.java    From FrescoUtils with Apache License 2.0 5 votes vote down vote up
public static ImageRequest buildImageRequestWithResource(BaseFrescoImageView fresco, Point size){
    return  ImageRequestBuilder.newBuilderWithResourceId(fresco.getDefaultResID())
            .setPostprocessor(fresco.getPostProcessor())
            .setAutoRotateEnabled(fresco.getAutoRotateEnabled())
            .setLocalThumbnailPreviewsEnabled(true)
            .setResizeOptions(new ResizeOptions(size.x, size.y))
            .build();
}
 
Example #29
Source File: FrescoFactory.java    From FrescoUtils with Apache License 2.0 5 votes vote down vote up
public static ImageRequest buildImageRequestWithResource(BaseFrescoImageView fresco){
    return  ImageRequestBuilder.newBuilderWithResourceId(fresco.getDefaultResID())
            .setPostprocessor(fresco.getPostProcessor())
            .setAutoRotateEnabled(fresco.getAutoRotateEnabled())
            .setLocalThumbnailPreviewsEnabled(true)
            .build();
}
 
Example #30
Source File: FrescoUtils.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public static void displayPhoto(SimpleDraweeView mSimpleDraweeView, String path, int width, int height, ControllerListener mControllerListener) {
    if (!TextUtils.isEmpty(path)) {
        PipelineDraweeControllerBuilder mPipelineDraweeControllerBuilder = Fresco.newDraweeControllerBuilder();
        ImageRequestBuilder mImageRequestBuilder = ImageRequestBuilder.newBuilderWithSource(Uri.parse(path));
        mImageRequestBuilder.setResizeOptions(new ResizeOptions(width, height));
        mPipelineDraweeControllerBuilder.setOldController(mSimpleDraweeView.getController());
        mPipelineDraweeControllerBuilder.setImageRequest(mImageRequestBuilder.build());
        mPipelineDraweeControllerBuilder.setControllerListener(mControllerListener);
        mSimpleDraweeView.setController(mPipelineDraweeControllerBuilder.build());
    }
}