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


Java ImageRequest.fromUri方法代码示例

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


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

示例1: setUri

import com.facebook.imagepipeline.request.ImageRequest; //导入方法依赖的package包/类
@Override
public PipelineDraweeControllerBuilder setUri(@Nullable String uriString) {
  if (uriString == null || uriString.isEmpty()) {
    return super.setImageRequest(ImageRequest.fromUri(uriString));
  }
  return setUri(Uri.parse(uriString));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:PipelineDraweeControllerBuilder.java

示例2: save

import com.facebook.imagepipeline.request.ImageRequest; //导入方法依赖的package包/类
public static void save(Uri uri, String action) {
    ImageRequest request = ImageRequest.fromUri(uri);
    ImagePipeline pipeline = Fresco.getImagePipeline();
    DataSource<CloseableReference<PooledByteBuffer>> dataSource =
            pipeline.fetchEncodedImage(request, null);

    ImageSubscriber dataSubscriber = new ImageSubscriber(uri, action);

    dataSource.subscribe(dataSubscriber,
            ExpressApplication.getApplication().getImagePipelineConfig()
                    .getExecutorSupplier().forLocalStorageWrite());
}
 
开发者ID:mingdroid,项目名称:tumbviewer,代码行数:13,代码来源:FrescoUtils.java

示例3: buildLowImageRequest

import com.facebook.imagepipeline.request.ImageRequest; //导入方法依赖的package包/类
public static ImageRequest buildLowImageRequest(BaseFrescoImageView fresco){
    String lowThumbnail = null;
    if(TextUtils.isEmpty(fresco.getLowThumbnailUrl())){
        return null;
    }
    lowThumbnail = fresco.getLowThumbnailUrl();
    Uri uri = Uri.parse(lowThumbnail);
    return ImageRequest.fromUri(uri);
}
 
开发者ID:sciage,项目名称:FinalProject,代码行数:10,代码来源:FrescoFactory.java

示例4: intercept

import com.facebook.imagepipeline.request.ImageRequest; //导入方法依赖的package包/类
@Override
public BitmapRegionDecoder intercept(Chain chain) throws IOException {
    final Uri uri = chain.uri();
    BitmapRegionDecoder decoder = chain.chain(uri);
    if (decoder != null){
        return decoder;
    }

    if (UriUtil.isNetworkUri(uri)){
        ImagePipeline imagePipeline = ImagePipelineFactory.getInstance().getImagePipeline();

        ImageRequest request = ImageRequest.fromUri(uri);
        DataSource<CloseableReference<PooledByteBuffer>> dataSource = imagePipeline.fetchEncodedImage(request,null);
        try {
            CloseableReference<PooledByteBuffer> ref = DataSources.waitForFinalResult(dataSource);
            if (ref == null){
                return null;
            }
            PooledByteBuffer result = ref.get();
            if (BuildConfig.DEBUG) {
                Log.d("FrescoInterceptor", "从我这加载");
            }
            try {
                InputStream inputStream = new PooledByteBufferInputStream(result);
                Closeables.closeQuietly(inputStream);
                return BitmapRegionDecoder.newInstance(inputStream,false);
            } catch (IOException e) {
                ImageRequest imageRequest=ImageRequest.fromUri(uri);
                CacheKey cacheKey= DefaultCacheKeyFactory.getInstance().getEncodedCacheKey(imageRequest,null);
                BinaryResource resource = ImagePipelineFactory.getInstance().getMainFileCache().getResource(cacheKey);
                File file=((FileBinaryResource)resource).getFile();
                if (BuildConfig.DEBUG) {
                    Log.d("FrescoInterceptor", file.getName());
                }
                return Interceptors.fixJPEGDecoder(file,e);
            }
        } catch (Throwable throwable) {
            if (BuildConfig.DEBUG) {
                Log.d("FrescoInterceptor", "intercept: 加载失败了");
            }
            throwable.printStackTrace();
            return null;
        }
    }

    return null;
}
 
开发者ID:EvilBT,项目名称:HDImageView,代码行数:48,代码来源:FrescoInterceptor.java


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