Java Code Examples for com.facebook.imagepipeline.core.ImagePipeline#fetchDecodedImage()
The following examples show how to use
com.facebook.imagepipeline.core.ImagePipeline#fetchDecodedImage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AMapMarker.java From react-native-amap with MIT License | 6 votes |
public void setImage(String uri) { if (uri == null) { iconBitmapDescriptor = null; update(); } else if (uri.startsWith("http://") || uri.startsWith("https://") || uri.startsWith("file://")) { ImageRequest imageRequest = ImageRequestBuilder .newBuilderWithSource(Uri.parse(uri)) .build(); ImagePipeline imagePipeline = Fresco.getImagePipeline(); dataSource = imagePipeline.fetchDecodedImage(imageRequest, this); DraweeController controller = Fresco.newDraweeControllerBuilder() .setImageRequest(imageRequest) .setControllerListener(mLogoControllerListener) .setOldController(logoHolder.getController()) .build(); logoHolder.setController(controller); } else { iconBitmapDescriptor = getBitmapDescriptorByName(uri); update(); } }
Example 2
Source File: FrescoImageloadHelper.java From nono-android with GNU General Public License v3.0 | 6 votes |
public static void LoadImageFromURLAndCallBack(SimpleDraweeView destImageView , String URL,Context context,BaseBitmapDataSubscriber bbds) { int w = destImageView.getWidth(); int h =destImageView.getHeight(); if(w<1){ w = destImageView.getLayoutParams().width; } if(h<1){ h =destImageView.getLayoutParams().height; } ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(URL)) .setResizeOptions(new ResizeOptions(w,h)) .setProgressiveRenderingEnabled(true) .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); }
Example 3
Source File: FrescoImageloadHelper.java From nono-android with GNU General Public License v3.0 | 6 votes |
public static void LoadImageFromURIAndCallBack(SimpleDraweeView destImageView , Uri uri,Context context,BaseBitmapDataSubscriber bbds) { int w = destImageView.getWidth(); int h =destImageView.getHeight(); if(w<1){ w = destImageView.getLayoutParams().width; } if(h<1){ h =destImageView.getLayoutParams().height; } ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(uri) .setResizeOptions(new ResizeOptions(w,h)) .setProgressiveRenderingEnabled(true) .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); }
Example 4
Source File: FrescoController.java From base-module with Apache License 2.0 | 5 votes |
/** * 加载图片获取 Bitmap 对象 * @param subscriber */ public void intoTarget(BaseBitmapDataSubscriber subscriber) { ImageRequestBuilder builder = ImageRequestBuilder.newBuilderWithSource(mUri) .setProgressiveRenderingEnabled(true); if (mWidth > 0 && mHeight > 0) { builder.setResizeOptions(new ResizeOptions(mWidth, mHeight)); } ImageRequest imageRequest = builder.build(); ImagePipeline imagePipeline = Fresco.getImagePipeline(); DataSource<CloseableReference<CloseableImage>> dataSource = imagePipeline.fetchDecodedImage(imageRequest, this); dataSource.subscribe(subscriber, UiThreadImmediateExecutorService.getInstance()); }
Example 5
Source File: ApplicationActivity.java From react-native-turbolinks with MIT License | 5 votes |
private void bitmapFor(Bundle image, Context context, BaseBitmapDataSubscriber baseBitmapDataSubscriber) { ImageSource source = new ImageSource(context, image.getString("uri")); ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(source.getUri()).build(); ImagePipeline imagePipeline = Fresco.getImagePipeline(); DataSource<CloseableReference<CloseableImage>> dataSource = imagePipeline.fetchDecodedImage(imageRequest, context); dataSource.subscribe(baseBitmapDataSubscriber, UiThreadImmediateExecutorService.getInstance()); }
Example 6
Source File: OverlayMarker.java From react-native-baidu-map with MIT License | 5 votes |
public void setIcon(IconInfo iconInfo) { if (iconInfo.getUri() == null || iconInfo.getUri().length() == 0) { return; } if (BITMAP_DESCRIPTOR_MAP.containsKey(iconInfo.getUri())) { iconBitmapDescriptor = BITMAP_DESCRIPTOR_MAP.get(iconInfo.getUri()); return; } Log.i("download", iconInfo.getUri()); this.iconInfo = iconInfo; String uri = iconInfo.getUri(); if (uri == null) { iconBitmapDescriptor = null; } else if (uri.startsWith("http://") || uri.startsWith("https://") || uri.startsWith("file://") || uri.startsWith("asset://")) { loadingImage = true; ImageRequest imageRequest = ImageRequestBuilder .newBuilderWithSource(Uri.parse(uri)) .build(); ImagePipeline imagePipeline = Fresco.getImagePipeline(); dataSource = imagePipeline.fetchDecodedImage(imageRequest, this); DraweeController controller = Fresco.newDraweeControllerBuilder() .setImageRequest(imageRequest) .setControllerListener(imageControllerListener) .setOldController(imageHolder.getController()) .build(); imageHolder.setController(controller); } else { iconBitmapDescriptor = getBitmapDescriptorByName(uri); } }
Example 7
Source File: FrescoImageloadHelper.java From nono-android with GNU General Public License v3.0 | 5 votes |
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); }
Example 8
Source File: FrescoImageLoader.java From ScrollGalleryView with MIT License | 5 votes |
@Override public void loadMedia(Context context, final ImageView imageView, SuccessCallback callback) { if (!Fresco.hasBeenInitialized()) { Fresco.initialize(context); } ImagePipeline pipeline = Fresco.getImagePipeline(); DataSubscriber subscriber = getSubscriber(imageView, callback); DataSource<CloseableReference<CloseableImage>> dataSource = pipeline.fetchDecodedImage(createImageRequest(), context); dataSource.subscribe(subscriber, UiThreadImmediateExecutorService.getInstance()); }
Example 9
Source File: FrescoImageLoader.java From ScrollGalleryView with MIT License | 5 votes |
@Override public void loadThumbnail(Context context, ImageView thumbnailView, SuccessCallback callback) { if (!Fresco.hasBeenInitialized()){ Fresco.initialize(context); } ImagePipeline pipeline = Fresco.getImagePipeline(); DataSubscriber subscriber = getSubscriber(thumbnailView, callback); DataSource<CloseableReference<CloseableImage>> dataSource = pipeline.fetchDecodedImage(createImageRequest(thumbnailWidth, thumbnailHeight), context); dataSource.subscribe(subscriber, UiThreadImmediateExecutorService.getInstance()); }
Example 10
Source File: ImageViewActivity.java From Fishing with GNU General Public License v3.0 | 5 votes |
@Override public View instantiateItem(ViewGroup container, int position) { View view = LayoutInflater.from(ImageViewActivity.this).inflate(R.layout.item_imagepage, container, false); final PhotoView photoView = (PhotoView) view.findViewById(R.id.photoview); final View wheel = view.findViewById(R.id.wheel); photoView.setOnPhotoTapListener((view1, v, v1) -> finish()); ImagePipeline imagePipeline = Fresco.getImagePipeline(); ImageRequest request = ImageRequestBuilder.newBuilderWithSource(urls.get(position)) .setResizeOptions(new ResizeOptions(768, 768)) .build(); DataSource<CloseableReference<CloseableImage>> dataSource = imagePipeline.fetchDecodedImage(request,this); DataSubscriber dataSubscriber = new BaseBitmapDataSubscriber() { @Override protected void onNewResultImpl(Bitmap bitmap) { photoView.setImageBitmap(bitmap); wheel.setVisibility(View.GONE); } @Override protected void onFailureImpl(DataSource<CloseableReference<CloseableImage>> closeableReferenceDataSource) { } }; dataSource.subscribe(dataSubscriber, new Executor() { @Override public void execute(Runnable command) { handler.post(command); } }); container.addView(view); return view; }
Example 11
Source File: ImagePipelineMultiUriHelper.java From fresco with MIT License | 5 votes |
public static DataSource<CloseableReference<CloseableImage>> getImageRequestDataSource( ImagePipeline imagePipeline, ImageRequest imageRequest, Object callerContext, @Nullable RequestListener requestListener, @Nullable String uiComponentId) { return imagePipeline.fetchDecodedImage( imageRequest, callerContext, ImageRequest.RequestLevel.FULL_FETCH, requestListener, uiComponentId); }
Example 12
Source File: SingleImageSource.java From fresco with MIT License | 5 votes |
@Override public Supplier<DataSource<CloseableReference<CloseableImage>>> createDataSourceSupplier( final ImagePipeline imagePipeline, final ImagePipelineUtils imagePipelineUtils, final ImageOptions imageOptions, final @Nullable Object callerContext, final @Nullable RequestListener requestListener, final String uiComponentId) { return new Supplier<DataSource<CloseableReference<CloseableImage>>>() { @Override public DataSource<CloseableReference<CloseableImage>> get() { final ImageRequest imageRequest = maybeExtractFinalImageRequest(imagePipelineUtils, imageOptions); if (imageRequest != null) { return imagePipeline.fetchDecodedImage( imageRequest, callerContext, ImageRequest.RequestLevel.FULL_FETCH, requestListener, // TODO: Check if this is correct !! uiComponentId); } else { return DataSources.immediateFailedDataSource( new NullPointerException( "Could not extract image request from: " + SingleImageSource.this)); } } }; }
Example 13
Source File: FrescoUtils.java From materialup with Apache License 2.0 | 4 votes |
private static final void setSubscribe(Context context, ImageRequest request, BaseDataSubscriber subscriber) { ImagePipeline imagePipeline = Fresco.getImagePipeline(); DataSource<CloseableReference<CloseableImage>> dataSource = imagePipeline.fetchDecodedImage(request, context); dataSource.subscribe(subscriber, CallerThreadExecutor.getInstance()); }