Java Code Examples for com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder#setImageRequest()
The following examples show how to use
com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder#setImageRequest() .
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: FrescoImageLoader.java From FimiX8-RE with MIT License | 6 votes |
public static void display(SimpleDraweeView view, String uri, int width, int height, ControllerListener listener) { if (uri != null) { PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder(); controller.setOldController(view.getController()); controller.setAutoPlayAnimations(true); ImageRequestBuilder imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(uri)).setCacheChoice(CacheChoice.SMALL).setLocalThumbnailPreviewsEnabled(true); imageRequest.setProgressiveRenderingEnabled(true); Log.d("Good", uri); if (width > 0 && height > 0) { imageRequest.setResizeOptions(new ResizeOptions(width, height)); } controller.setImageRequest(imageRequest.build()); controller.setControllerListener(listener); view.setController(controller.build()); } }
Example 2
Source File: ImageViewerAdapter.java From photo-viewer with Apache License 2.0 | 6 votes |
private void setController(String url, ReadableMap headers) { PipelineDraweeControllerBuilder controllerBuilder = Fresco.newDraweeControllerBuilder(); // controllerBuilder.setUri(url); controllerBuilder.setOldController(drawee.getController()); controllerBuilder.setControllerListener(getDraweeControllerListener(drawee)); controllerBuilder.setAutoPlayAnimations(true); if (imageRequestBuilder != null) { imageRequestBuilder.setSource(Uri.parse(url)); controllerBuilder.setImageRequest(imageRequestBuilder.build()); } // support load local image just like React Native do ImageSource imageSource = new ImageSource(getContext(), url); ImageRequestBuilder imageRequestBuilder1 = ImageRequestBuilder.newBuilderWithSource(imageSource.getUri()); // support headers ImageRequest imageRequest = ReactNetworkImageRequest.fromBuilderWithHeaders(imageRequestBuilder1, headers); controllerBuilder.setImageRequest(imageRequest); drawee.setController(controllerBuilder.build()); }
Example 3
Source File: ImageFormatGifFragment.java From fresco with MIT License | 6 votes |
private void setAnimationUri(Uri uri) { final PipelineDraweeControllerBuilder controllerBuilder = Fresco.newDraweeControllerBuilder() .setAutoPlayAnimations(true) .setOldController(mSimpleDraweeView.getController()); final ImageDecodeOptionsBuilder optionsBuilder = ImageDecodeOptions.newBuilder().setMaxDimensionPx(4000); if (mGifDecoder != null) { optionsBuilder.setCustomImageDecoder(mGifDecoder); } controllerBuilder.setImageRequest( ImageRequestBuilder.newBuilderWithSource(uri) .setImageDecodeOptions(optionsBuilder.build()) .build()); mSimpleDraweeView.setController(controllerBuilder.build()); }
Example 4
Source File: FrescoUtils.java From FimiX8-RE with MIT License | 5 votes |
public static void displayPhoto(SimpleDraweeView mSimpleDraweeView, String path, int width, int height) { if (!TextUtils.isEmpty(path)) { PipelineDraweeControllerBuilder mPipelineDraweeControllerBuilder = Fresco.newDraweeControllerBuilder(); ImageRequestBuilder mImageRequestBuilder = ImageRequestBuilder.newBuilderWithSource(Uri.parse(path)); mImageRequestBuilder.setResizeOptions(new ResizeOptions(width, height)); mPipelineDraweeControllerBuilder.setOldController(mSimpleDraweeView.getController()); mPipelineDraweeControllerBuilder.setImageRequest(mImageRequestBuilder.build()); mSimpleDraweeView.setController(mPipelineDraweeControllerBuilder.build()); } }
Example 5
Source File: FrescoUtils.java From FimiX8-RE with MIT License | 5 votes |
public static void displayPhoto(SimpleDraweeView mSimpleDraweeView, String path, int width, int height, ControllerListener mControllerListener) { if (!TextUtils.isEmpty(path)) { PipelineDraweeControllerBuilder mPipelineDraweeControllerBuilder = Fresco.newDraweeControllerBuilder(); ImageRequestBuilder mImageRequestBuilder = ImageRequestBuilder.newBuilderWithSource(Uri.parse(path)); mImageRequestBuilder.setResizeOptions(new ResizeOptions(width, height)); mPipelineDraweeControllerBuilder.setOldController(mSimpleDraweeView.getController()); mPipelineDraweeControllerBuilder.setImageRequest(mImageRequestBuilder.build()); mPipelineDraweeControllerBuilder.setControllerListener(mControllerListener); mSimpleDraweeView.setController(mPipelineDraweeControllerBuilder.build()); } }
Example 6
Source File: FrescoImageLoader.java From FimiX8-RE with MIT License | 5 votes |
public static void display(SimpleDraweeView view, String lowUri, String uri, ControllerListener listener) { if (uri != null) { ImageRequestBuilder imageRequest; int w = view.getLayoutParams().width; int h = view.getLayoutParams().height; PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder(); if (!lowUri.startsWith("file:///")) { lowUri = "file://" + lowUri; } if (lowUri != null && lowUri.length() > 0) { controller.setLowResImageRequest(ImageRequest.fromUri(lowUri)); } controller.setOldController(view.getController()); controller.setAutoPlayAnimations(true); if (uri.endsWith(".MP4")) { imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(lowUri)); } else { imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(uri)); } if (w > 0 && h > 0) { imageRequest.setResizeOptions(new ResizeOptions(w, h)); } controller.setImageRequest(imageRequest.build()); controller.setControllerListener(listener); view.setController(controller.build()); } }
Example 7
Source File: FrescoUtils.java From SprintNBA with Apache License 2.0 | 5 votes |
public static PipelineDraweeControllerBuilder getPreController(String url, final PhotoDraweeView draweeView) { ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url)) .setProgressiveRenderingEnabled(true) .build(); PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder(); controller.setImageRequest(request); controller.setOldController(draweeView.getController()); controller.setAutoPlayAnimations(true); return controller; }
Example 8
Source File: ImageFragment.java From TLint with Apache License 2.0 | 5 votes |
@Override public void initData() { showContent(true); ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url)) .setProgressiveRenderingEnabled(true) .build(); GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(getResources()).setProgressBarImage( new ImageLoadProgressBar(new ImageLoadProgressBar.OnLevelChangeListener() { @Override public void onChange(int level) { if (level > 100 && progress.getVisibility() == View.VISIBLE) { progress.setVisibility(View.GONE); } } }, ResourceUtil.getThemeColor(getActivity()))).build(); hierarchy.setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER); PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder(); controller.setControllerListener(listener); controller.setImageRequest(request); controller.setOldController(image.getController()); controller.setAutoPlayAnimations(true); image.setHierarchy(hierarchy); image.setController(controller.build()); }