本文整理匯總了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));
}
示例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());
}
示例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);
}
示例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;
}