Java Code Examples for com.facebook.drawee.backends.pipeline.Fresco#newDraweeControllerBuilder()
The following examples show how to use
com.facebook.drawee.backends.pipeline.Fresco#newDraweeControllerBuilder() .
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: PhotoShowActivity.java From Elephant with Apache License 2.0 | 6 votes |
@Override public void initLoad() { super.initLoad(); if (!TextUtils.isEmpty(mImageUrl)) { PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder(); controller.setUri(mImageUrl); controller.setOldController(mPhotoIv.getController()); controller.setControllerListener(new BaseControllerListener<ImageInfo>() { @Override public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) { super.onFinalImageSet(id, imageInfo, animatable); if (imageInfo == null || mPhotoIv == null) { return; } mPhotoIv.update(imageInfo.getWidth(), imageInfo.getHeight()); } }); mPhotoIv.setController(controller.build()); } }
Example 4
Source File: GalleryActivity.java From phphub-android with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String imageUrl = getIntent().getStringExtra(IMAGE_URL); if (!TextUtils.isEmpty(imageUrl)) { PipelineDraweeControllerBuilder builder = Fresco.newDraweeControllerBuilder(); builder.setUri(Uri.parse(imageUrl)); builder.setOldController(photoView.getController()); builder.setControllerListener(new BaseControllerListener<ImageInfo>() { @Override public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) { super.onFinalImageSet(id, imageInfo, animatable); if (imageInfo == null || photoView == null) { return; } photoView.update(imageInfo.getWidth(), imageInfo.getHeight()); } }); photoView.setController(builder.build()); } }
Example 5
Source File: ViewPagerActivity.java From PhotoDraweeView with Apache License 2.0 | 6 votes |
@Override public Object instantiateItem(ViewGroup viewGroup, int position) { final PhotoDraweeView photoDraweeView = new PhotoDraweeView(viewGroup.getContext()); PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder(); controller.setUri(Uri.parse("res:///" + mDrawables[position])); controller.setOldController(photoDraweeView.getController()); controller.setControllerListener(new BaseControllerListener<ImageInfo>() { @Override public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) { super.onFinalImageSet(id, imageInfo, animatable); if (imageInfo == null) { return; } photoDraweeView.update(imageInfo.getWidth(), imageInfo.getHeight()); } }); photoDraweeView.setController(controller.build()); try { viewGroup.addView(photoDraweeView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); } catch (Exception e) { e.printStackTrace(); } return photoDraweeView; }
Example 6
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 7
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 8
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 9
Source File: FrescoBasedReactTextInlineImageViewManager.java From react-native-GPay with MIT License | 5 votes |
@Override public FrescoBasedReactTextInlineImageShadowNode createShadowNodeInstance() { return new FrescoBasedReactTextInlineImageShadowNode( (mDraweeControllerBuilder != null) ? mDraweeControllerBuilder : Fresco.newDraweeControllerBuilder(), mCallerContext ); }
Example 10
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 11
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()); }
Example 12
Source File: ReactImageManager.java From react-native-GPay with MIT License | 4 votes |
public AbstractDraweeControllerBuilder getDraweeControllerBuilder() { if (mDraweeControllerBuilder == null) { mDraweeControllerBuilder = Fresco.newDraweeControllerBuilder(); } return mDraweeControllerBuilder; }
Example 13
Source File: ImageManager.java From redgram-for-reddit with GNU General Public License v3.0 | 4 votes |
private static PipelineDraweeControllerBuilder getControllerBuilderInstance(){ return Fresco.newDraweeControllerBuilder(); }