Java 类com.facebook.imagepipeline.common.ImageDecodeOptionsBuilder 实例源码

项目:GitHub    文件:ImageFormatOverrideExample.java   
@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);
}
项目:GitHub    文件:ImageRequestTest.java   
@Test
public void testCreatingRequestFromExistingRequest() {
  ImageRequest original = ImageRequestBuilder
      .newBuilderWithSource(Uri.parse("http://frescolib.org/image.jpg"))
          .setCacheChoice(ImageRequest.CacheChoice.SMALL)
      .setImageDecodeOptions(new ImageDecodeOptionsBuilder().build())
      .setLocalThumbnailPreviewsEnabled(true)
      .setLowestPermittedRequestLevel(ImageRequest.RequestLevel.DISK_CACHE)
      .setMediaVariations(MediaVariations.forMediaId("A113"))
      .setPostprocessor(new BasePostprocessor() {
        @Override
        public String getName() {
          return super.getName();
        }
      })
      .setProgressiveRenderingEnabled(true)
      .setRequestListener(new RequestLoggingListener())
      .setResizeOptions(new ResizeOptions(20, 20))
      .setRotationOptions(RotationOptions.forceRotation(RotationOptions.ROTATE_90))
      .setRequestPriority(Priority.HIGH)
      .build();

  ImageRequest copy = ImageRequestBuilder.fromRequest(original).build();

  assertThat(copy).isEqualTo(original);
}
项目:fresco    文件:ImageRequestTest.java   
@Test
public void testCreatingRequestFromExistingRequest() {
  ImageRequest original = ImageRequestBuilder
      .newBuilderWithSource(Uri.parse("http://frescolib.org/image.jpg"))
          .setCacheChoice(ImageRequest.CacheChoice.SMALL)
      .setImageDecodeOptions(new ImageDecodeOptionsBuilder().build())
      .setLocalThumbnailPreviewsEnabled(true)
      .setLowestPermittedRequestLevel(ImageRequest.RequestLevel.DISK_CACHE)
      .setMediaVariations(MediaVariations.forMediaId("A113"))
      .setPostprocessor(new BasePostprocessor() {
        @Override
        public String getName() {
          return super.getName();
        }
      })
      .setProgressiveRenderingEnabled(true)
      .setRequestListener(new RequestLoggingListener())
      .setResizeOptions(new ResizeOptions(20, 20))
      .setRotationOptions(RotationOptions.forceRotation(RotationOptions.ROTATE_90))
      .setRequestPriority(Priority.HIGH)
      .build();

  ImageRequest copy = ImageRequestBuilder.fromRequest(original).build();

  assertThat(copy).isEqualTo(original);
}
项目:fresco    文件:ImageFormatOverrideExample.java   
@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);
}
项目:H-Viewer    文件:ImageLoader.java   
public static void loadThumbFromUrl(Context context, ImageView imageView, int resizeWidthDp, int resizeHeightDp, String url, String cookie, String referer, ControllerListener controllerListener) {
    if (TextUtils.isEmpty(url)) {
        imageView.setImageURI(null);
        return;
    }
    Uri uri = Uri.parse(url);
    JsonObject header = new JsonObject();
    header.addProperty("Cookie", cookie);
    header.addProperty("Referer", referer);
    if (url != null && url.startsWith("http")) {
        if (HProxy.isEnabled() && HProxy.isAllowPicture()) {
            HProxy proxy = new HProxy(url);
            header.addProperty(proxy.getHeaderKey(), proxy.getHeaderValue());
            MyOkHttpNetworkFetcher.headers.put(uri, getGson().toJson(header));
        }
        MyOkHttpNetworkFetcher.headers.put(uri, getGson().toJson(header));
    }
    if (imageView instanceof SimpleDraweeView) {
        ImageDecodeOptions imageDecodeOptions = new ImageDecodeOptionsBuilder()
                .setForceStaticImage(true)
                .setDecodePreviewFrame(true)
                .build();
        ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
                .setResizeOptions(new ResizeOptions(DensityUtil.dp2px(context, resizeWidthDp), DensityUtil.dp2px(context, resizeHeightDp)))
                .setImageDecodeOptions(imageDecodeOptions)
                .setLocalThumbnailPreviewsEnabled(true)
                .build();
        DraweeController controller = Fresco.newDraweeControllerBuilder()
                .setCallerContext(context)
                .setTapToRetryEnabled(true)
                .setAutoPlayAnimations(false)
                .setOldController(((SimpleDraweeView) imageView).getController())
                .setControllerListener(controllerListener)
                .setImageRequest(request)
                .build();
        ((SimpleDraweeView) imageView).setController(controller);
    }
}