当前位置: 首页>>代码示例>>Java>>正文


Java ImageDecodeOptionsBuilder类代码示例

本文整理汇总了Java中com.facebook.imagepipeline.common.ImageDecodeOptionsBuilder的典型用法代码示例。如果您正苦于以下问题:Java ImageDecodeOptionsBuilder类的具体用法?Java ImageDecodeOptionsBuilder怎么用?Java ImageDecodeOptionsBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ImageDecodeOptionsBuilder类属于com.facebook.imagepipeline.common包,在下文中一共展示了ImageDecodeOptionsBuilder类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onViewCreated

import com.facebook.imagepipeline.common.ImageDecodeOptionsBuilder; //导入依赖的package包/类
@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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:ImageFormatOverrideExample.java

示例2: testCreatingRequestFromExistingRequest

import com.facebook.imagepipeline.common.ImageDecodeOptionsBuilder; //导入依赖的package包/类
@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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:ImageRequestTest.java

示例3: loadThumbFromUrl

import com.facebook.imagepipeline.common.ImageDecodeOptionsBuilder; //导入依赖的package包/类
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);
    }
}
 
开发者ID:PureDark,项目名称:H-Viewer,代码行数:39,代码来源:ImageLoader.java


注:本文中的com.facebook.imagepipeline.common.ImageDecodeOptionsBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。