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


Java ImageRequestBuilder.build方法代码示例

本文整理汇总了Java中com.facebook.imagepipeline.request.ImageRequestBuilder.build方法的典型用法代码示例。如果您正苦于以下问题:Java ImageRequestBuilder.build方法的具体用法?Java ImageRequestBuilder.build怎么用?Java ImageRequestBuilder.build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.facebook.imagepipeline.request.ImageRequestBuilder的用法示例。


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

示例1: loadBitmapFromUrl

import com.facebook.imagepipeline.request.ImageRequestBuilder; //导入方法依赖的package包/类
public static void loadBitmapFromUrl(Context context, String url, String cookie, String referer, BaseBitmapDataSubscriber dataSubscriber) {
    if (TextUtils.isEmpty(url))
        return;
    Uri uri = Uri.parse(url);
    JsonObject header = new JsonObject();
    header.addProperty("Cookie", cookie);
    header.addProperty("Referer", referer);
    if (HProxy.isEnabled() && HProxy.isAllowPicture()) {
        HProxy proxy = new HProxy(url);
        header.addProperty(proxy.getHeaderKey(), proxy.getHeaderValue());
    }
    MyOkHttpNetworkFetcher.headers.put(uri, getGson().toJson(header));
    ImagePipeline imagePipeline = Fresco.getImagePipeline();
    ImageRequestBuilder builder = ImageRequestBuilder.newBuilderWithSource(uri);
    ImageRequest request = builder.build();
    DataSource<CloseableReference<CloseableImage>>
            dataSource = imagePipeline.fetchDecodedImage(request, context);
    dataSource.subscribe(dataSubscriber, CallerThreadExecutor.getInstance());
}
 
开发者ID:PureDark,项目名称:H-Viewer,代码行数:20,代码来源:ImageLoader.java

示例2: loadResourceFromUrl

import com.facebook.imagepipeline.request.ImageRequestBuilder; //导入方法依赖的package包/类
public static void loadResourceFromUrl(Context context, Uri uri, String cookie, String referer, BaseDataSubscriber dataSubscriber) {
    if (uri.getScheme().startsWith("http")) {
        JsonObject header = new JsonObject();
        header.addProperty("Cookie", cookie);
        header.addProperty("Referer", referer);
        if (HProxy.isEnabled() && HProxy.isAllowPicture()) {
            HProxy proxy = new HProxy(uri.toString());
            header.addProperty(proxy.getHeaderKey(), proxy.getHeaderValue());
        }
        MyOkHttpNetworkFetcher.headers.put(uri, getGson().toJson(header));
    }
    ImagePipeline imagePipeline = Fresco.getImagePipeline();
    ImageRequestBuilder builder = ImageRequestBuilder.newBuilderWithSource(uri);
    ImageRequest request = builder.build();
    DataSource<CloseableReference<PooledByteBuffer>>
            dataSource = imagePipeline.fetchEncodedImage(request, context);
    dataSource.subscribe(dataSubscriber, CallerThreadExecutor.getInstance());
}
 
开发者ID:PureDark,项目名称:H-Viewer,代码行数:19,代码来源:ImageLoader.java

示例3: displayRaw

import com.facebook.imagepipeline.request.ImageRequestBuilder; //导入方法依赖的package包/类
@Override
public void displayRaw(@NonNull ImageView img, @NonNull String absPath, int width, int height,  IBoxingCallback callback) {
    absPath = "file://" + absPath;
    ImageRequestBuilder requestBuilder = ImageRequestBuilder.newBuilderWithSource(Uri.parse(absPath));
    if (width > 0 && height > 0) {
        requestBuilder.setResizeOptions(new ResizeOptions(width, height));
    }
    ImageRequest request = requestBuilder.build();
    loadImage(request, img, callback);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:BoxingFrescoLoader.java

示例4: setImageURI

import com.facebook.imagepipeline.request.ImageRequestBuilder; //导入方法依赖的package包/类
@Override
public void setImageURI(Uri uri) {
    ImageRequestBuilder imageRequestBuilder = ImageRequestBuilder.newBuilderWithSource(uri)
            .setAutoRotateEnabled(true)
            .setLocalThumbnailPreviewsEnabled(true)
            .setResizeOptions(resizeOptions);
    ImageRequest request = imageRequestBuilder.build();
    DraweeController controller = Fresco.newDraweeControllerBuilder()
            .setAutoPlayAnimations(true)
            .setImageRequest(request)
            .setTapToRetryEnabled(false)//加载失败时点击重新加载
            .setOldController(getController())
            .build();
    setController(controller);
}
 
开发者ID:Jusenr,项目名称:androidtools,代码行数:16,代码来源:FrescoImageView.java

示例5: bindImage

import com.facebook.imagepipeline.request.ImageRequestBuilder; //导入方法依赖的package包/类
@Override
public void bindImage(ImageView photoImageView, Uri uri, int width, int height) {
    DraweeView draweeView = (DraweeView) photoImageView;
    final ImageRequestBuilder requestBuilder = ImageRequestBuilder.newBuilderWithSource(uri);
    if (width > 0 && height > 0) {
        requestBuilder.setResizeOptions(new ResizeOptions(width, height));
    }
    ImageRequest imageRequest = requestBuilder.build();
    DraweeController controller = Fresco.newDraweeControllerBuilder()
            .setOldController(draweeView.getController())
            .setImageRequest(imageRequest).build();
    draweeView.setController(controller);
}
 
开发者ID:nowandfurure,项目名称:richeditor,代码行数:14,代码来源:FrescoImageLoader.java

示例6: loadImageFromUrl

import com.facebook.imagepipeline.request.ImageRequestBuilder; //导入方法依赖的package包/类
public static void loadImageFromUrl(Context context, ImageView imageView, String url, String cookie, String referer, boolean noCache, 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));
    }
    if (imageView instanceof SimpleDraweeView) {
        SimpleDraweeView draweeView = ((SimpleDraweeView) imageView);
        ImageRequestBuilder requestBuilder = ImageRequestBuilder.newBuilderWithSource(uri)
                .setResizeOptions(new ResizeOptions(1080, 1920));
        if (noCache)
            requestBuilder.disableDiskCache();
        ImageRequest request = requestBuilder.build();
        DraweeController controller = Fresco.newDraweeControllerBuilder()
                .setCallerContext(context)
                .setTapToRetryEnabled(true)
                .setAutoPlayAnimations(true)
                .setOldController(draweeView.getController())
                .setControllerListener(controllerListener)
                .setImageRequest(request)
                .build();
        draweeView.setController(controller);
    }
}
 
开发者ID:PureDark,项目名称:H-Viewer,代码行数:35,代码来源:ImageLoader.java

示例7: loadImageFromUrlRetainingImage

import com.facebook.imagepipeline.request.ImageRequestBuilder; //导入方法依赖的package包/类
public static RetainingDataSourceSupplier loadImageFromUrlRetainingImage(Context context, ImageView imageView, String url, String cookie, String referer, boolean noCache, ControllerListener controllerListener) {
    if (TextUtils.isEmpty(url)) {
        imageView.setImageURI(null);
        return null;
    }
    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));
    }
    if (imageView instanceof SimpleDraweeView) {
        SimpleDraweeView draweeView = ((SimpleDraweeView) imageView);
        RetainingDataSourceSupplier<CloseableReference<CloseableImage>> retainingSupplier = new RetainingDataSourceSupplier<>();
        PipelineDraweeControllerBuilder draweeControllerBuilder = Fresco.newDraweeControllerBuilder();
        draweeControllerBuilder.setDataSourceSupplier(retainingSupplier);
        DraweeController controller = draweeControllerBuilder
                .setCallerContext(context)
                .setTapToRetryEnabled(true)
                .setAutoPlayAnimations(true)
                .setOldController(draweeView.getController())
                .setControllerListener(controllerListener)
                .build();
        draweeView.setController(controller);
        ImageRequestBuilder requestBuilder = ImageRequestBuilder.newBuilderWithSource(uri)
                .setResizeOptions(new ResizeOptions(1080, 1920));
        if (noCache)
            requestBuilder.disableDiskCache();
        ImageRequest request = requestBuilder.build();
        retainingSupplier.setSupplier(Fresco.getImagePipeline().getDataSourceSupplier(request, null, ImageRequest.RequestLevel.FULL_FETCH));
        return retainingSupplier;
    }
    return null;
}
 
开发者ID:PureDark,项目名称:H-Viewer,代码行数:40,代码来源:ImageLoader.java

示例8: LoadImageFromURLAndCallBack

import com.facebook.imagepipeline.request.ImageRequestBuilder; //导入方法依赖的package包/类
public static void LoadImageFromURLAndCallBack(SimpleDraweeView destImageView , String URL, Context context, BaseBitmapDataSubscriber bbds
, BasePostprocessor postprocessor)
{
    int w = destImageView.getWidth();
    int h  =destImageView.getHeight();
    if(w<1){
        w = destImageView.getLayoutParams().width;
    }
    if(h<1){
        h  =destImageView.getLayoutParams().height;
    }
    ImageRequestBuilder builder = ImageRequestBuilder.newBuilderWithSource(Uri.parse(URL))
            .setResizeOptions(new ResizeOptions(w,h))
            .setProgressiveRenderingEnabled(true);
    if(postprocessor!=null){
        builder.setPostprocessor(postprocessor);
    }
    ImageRequest imageRequest =
            builder
                    .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);
}
 
开发者ID:tianyuan168326,项目名称:nono-android,代码行数:31,代码来源:FrescoImageloadHelper.java

示例9: buildRequest

import com.facebook.imagepipeline.request.ImageRequestBuilder; //导入方法依赖的package包/类
private ImageRequest buildRequest(ImageConfig config) {
    Uri uri = buildUriByType(config);

    ImageRequestBuilder builder =   ImageRequestBuilder.newBuilderWithSource(uri);
    Postprocessor postprocessor=null;


    ResizeOptions resizeOptions = getResizeOption(config);


    builder.setPostprocessor(postprocessor)
            .setResizeOptions(resizeOptions)//缩放,在解码前修改内存中的图片大小, 配合Downsampling可以处理所有图片,否则只能处理jpg,
            // 开启Downsampling:在初始化时设置.setDownsampleEnabled(true)
            .setAutoRotateEnabled(true);




    return builder.build();
}
 
开发者ID:BaoBaoJianqiang,项目名称:CustomListView,代码行数:21,代码来源:FrescoImageLoaderStrategy.java

示例10: displayImage

import com.facebook.imagepipeline.request.ImageRequestBuilder; //导入方法依赖的package包/类
@Override
public void displayImage(Context context,
                         String path,
                         FixImageView imageView,
                         Drawable defaultDrawable,
                         Bitmap.Config config,
                         boolean resize, boolean isGif,
                         int width,
                         int height,
                         int rotate) {
    init(context, defaultDrawable);

    imageView.setOnImageViewListener(new FixImageView.OnImageViewListener() {
        @Override
        public void onDetach() {
            draweeHolder.onDetach();
        }

        @Override
        public void onAttach() {
            draweeHolder.onAttach();
        }

        @Override
        public boolean verifyDrawable(Drawable dr) {
            return dr == draweeHolder.getHierarchy().getTopLevelDrawable();
        }

        @Override
        public void onDraw(Canvas canvas) {
            Drawable drawable = draweeHolder.getHierarchy().getTopLevelDrawable();
            if (drawable == null) {
                imageView.setImageDrawable(defaultDrawable);
            } else {
                imageView.setImageDrawable(drawable);
            }
        }

        @Override
        public boolean onTouchEvent(MotionEvent event) {
            return draweeHolder.onTouchEvent(event);
        }
    });
    Uri uri = new Uri.Builder()
            .scheme(UriUtil.LOCAL_FILE_SCHEME)
            .path(path)
            .build();
    ImageRequestBuilder builder = ImageRequestBuilder.newBuilderWithSource(uri)
            .setAutoRotateEnabled(true);
    if (resize) {
        builder.setResizeOptions(new ResizeOptions(width, height));
    }
    ImageRequest request = builder.build();
    DraweeController controller = Fresco.newDraweeControllerBuilder()
            .setOldController(draweeHolder.getController())
            .setImageRequest(request)
            .build();
    draweeHolder.setController(controller);
}
 
开发者ID:Loofer,项目名称:Watermark,代码行数:60,代码来源:FrescoImageLoader.java

示例11: fetchImage

import com.facebook.imagepipeline.request.ImageRequestBuilder; //导入方法依赖的package包/类
/**
 * @param frescoPlusView The draweeView is to display the bitmap
 * @param uri         The source uri
 * @param callback    Listening to the success or failure
 */
private void fetchImage(FrescoPlusView frescoPlusView, Uri uri, FPFetchCallback<ImageInfo> callback) {
    GenericDraweeHierarchyBuilder hierarchyBuilder = new GenericDraweeHierarchyBuilder(null);
    hierarchyBuilder.setFadeDuration(fadeDuration);
    hierarchyBuilder.setRoundingParams(RoundingParams.fromCornersRadius(radius));
    hierarchyBuilder.setActualImageScaleType(scaleType);
    if (defaultDrawable != null)
        hierarchyBuilder.setPlaceholderImage(defaultDrawable, scaleType);
    if (pressedDrawable != null)
        hierarchyBuilder.setPressedStateOverlay(pressedDrawable);
    if (retryDrawable != null)
        hierarchyBuilder.setRetryImage(retryDrawable);
    if (overlayDrawable != null)
        hierarchyBuilder.setOverlay(overlayDrawable);
    if (failureDrawable != null)
        hierarchyBuilder.setFailureImage(failureDrawable, scaleType);
    if (progressDrawable != null)
        hierarchyBuilder.setProgressBarImage(progressDrawable);
    GenericDraweeHierarchy hierarchy = hierarchyBuilder.build();

    ImageRequestBuilder requestBuilder = ImageRequestBuilder.newBuilderWithSource(uri);
    requestBuilder.setLowestPermittedRequestLevel(requestLevel);
    requestBuilder.setAutoRotateEnabled(autoRotateEnabled);
    if (postprocessor != null)
        requestBuilder.setPostprocessor(postprocessor);
    Priority priority = requestPriority == FrescoPriority.HIGH ? Priority.HIGH : Priority.MEDIUM;
    requestBuilder.setRequestPriority(priority);
    if (resizeWidth > 0 && resizeHeight > 0)
        requestBuilder.setResizeOptions(new ResizeOptions(resizeWidth, resizeHeight));
    ImageRequest imageRequest = requestBuilder.build();

    DraweeController draweeController = FrescoPlusCore.newDraweeControllerBuilder()
            .setOldController(frescoPlusView.getController())
            .setAutoPlayAnimations(true)
            .setRetainImageOnFailure(true)
            .setTapToRetryEnabled(true)
            .setImageRequest(imageRequest)
            .setControllerListener(FetchImageControllerListenerSupplier.newInstance(callback))
            .build();
    frescoPlusView.setHierarchy(hierarchy);
    frescoPlusView.setController(draweeController);
}
 
开发者ID:Sunzxyong,项目名称:FrescoPlus,代码行数:47,代码来源:FrescoPlusFetcher.java


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