本文整理汇总了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);
}
示例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);
}
示例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);
}
}