com.facebook.drawee.interfaces.DraweeController Java Examples
The following examples show how to use
com.facebook.drawee.interfaces.DraweeController.
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: SplashActivity.java From RunMap with Apache License 2.0 | 6 votes |
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); GradleButterKnife.bind(this); Uri uri = Uri.parse("asset:///splash.webp"); mSplashPresenter = new SplashPresenterImpl(this); DraweeController controller = Fresco.newDraweeControllerBuilder() .setUri(uri) .setAutoPlayAnimations(true) .setControllerListener(new BaseControllerListener<ImageInfo>(){ @Override public void onFinalImageSet(String id, @Nullable ImageInfo imageInfo, @Nullable Animatable animatable) { super.onFinalImageSet(id, imageInfo, animatable); mSplashPresenter.startCountDown(1); } }) .build(); splashDraweee.setController(controller); }
Example #2
Source File: FacebookImageUtil.java From imsdk-android with MIT License | 6 votes |
public static void loadWithCache(String url, final SimpleDraweeView target,ImageRequest.CacheChoice type,boolean playAnim) { if (target == null) return; Uri uri = Uri.parse(url); ImageRequestBuilder builder = ImageRequestBuilder.newBuilderWithSource(uri); ImageRequest request = builder .setCacheChoice(type) .build(); final PipelineDraweeControllerBuilder pipelineDraweeControllerBuilder = Fresco.newDraweeControllerBuilder() .setImageRequest(request) .setAutoPlayAnimations(playAnim) .setOldController(target.getController()); handler.post(new Runnable() { @Override public void run() { DraweeController controller = pipelineDraweeControllerBuilder.build(); target.setController(controller); } }); }
Example #3
Source File: ImagePageViewAdapter.java From imsdk-android with MIT License | 6 votes |
@Override public Object instantiateItem(ViewGroup container,int position) { IBrowsingConversationImageView.PreImage data = datas.get(position); ZoomableDraweeView mImageView = new ZoomableDraweeView(context); final DraweeController ctrl = Fresco.newDraweeControllerBuilder() .setImageRequest(ImageRequest.fromUri(data.originUrl)) .setLowResImageRequest(ImageRequest.fromUri(data.smallUrl)) .setTapToRetryEnabled(false).setAutoPlayAnimations(true).build(); GenericDraweeHierarchyBuilder hierarchyBuilder = new GenericDraweeHierarchyBuilder( context.getResources()) .setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER) .setProgressBarImage(new ProgressBarDrawable()); mImageView.setHierarchy(hierarchyBuilder.build()); mImageView.setController(ctrl); mImageView.setOnCreateContextMenuListener(listener); // mImageView.setOnClickListener(onClickListener); mImageView.setOnTouchListener(onTouchListener); viewSparseArray.append(position,mImageView); container.addView(mImageView); return mImageView; }
Example #4
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 #5
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 #6
Source File: DraweeHolder.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 6 votes |
/** * Sets a new controller. */ public void setController(@Nullable DraweeController draweeController) { boolean wasAttached = mIsControllerAttached; if (wasAttached) { detatchController(); } // Clear the old controller if (mController != null) { mEventTracker.recordEvent(Event.ON_CLEAR_OLD_CONTROLLER); mController.setHierarchy(null); } mController = draweeController; if (mController != null) { mEventTracker.recordEvent(Event.ON_SET_CONTROLLER); mController.setHierarchy(mHierarchy); } else { mEventTracker.recordEvent(Event.ON_CLEAR_CONTROLLER); } if (wasAttached) { attachController(); } }
Example #7
Source File: VolleyDraweeControllerBuilder.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 6 votes |
@Override protected VolleyDraweeController obtainController() { DraweeController oldController = getOldController(); VolleyDraweeController controller; if (oldController instanceof VolleyDraweeController) { controller = (VolleyDraweeController) oldController; controller.initialize( obtainDataSourceSupplier(), generateUniqueControllerId(), getCallerContext()); } else { controller = mVolleyDraweeControllerFactory.newController( obtainDataSourceSupplier(), generateUniqueControllerId(), getCallerContext()); } return controller; }
Example #8
Source File: VideoListCell.java From YcShareElement with Apache License 2.0 | 6 votes |
public void showWebp(final SimpleDraweeView simpleDraweeView, final String url, boolean autoplay) { simpleDraweeView.getHierarchy().setBackgroundImage(new ColorDrawable(Color.GRAY)); simpleDraweeView.getHierarchy().setActualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP); DraweeController controller = Fresco.newDraweeControllerBuilder() .setOldController(simpleDraweeView.getController()) .setControllerListener(new DeliveryControllerListener<ImageInfo>(null) { @Override public void onFinalImageSet(String s, @Nullable ImageInfo imageInfo, @Nullable Animatable animatable) { super.onFinalImageSet(s, imageInfo, animatable); simpleDraweeView.getHierarchy().setBackgroundImage(null); } }) .setAutoPlayAnimations(autoplay) .setUri(url) .build(); simpleDraweeView.setController(controller); }
Example #9
Source File: ReactToolbar.java From react-native-GPay with MIT License | 6 votes |
/** * Sets an icon for a specific icon source. If the uri indicates an icon * to be somewhere remote (http/https) or on the local filesystem, it uses fresco to load it. * Otherwise it loads the Drawable from the Resources and directly returns it via a callback */ private void setIconSource(ReadableMap source, IconControllerListener controllerListener, DraweeHolder holder) { String uri = source != null ? source.getString(PROP_ICON_URI) : null; if (uri == null) { controllerListener.setIconImageInfo(null); controllerListener.setDrawable(null); } else if (uri.startsWith("http://") || uri.startsWith("https://") || uri.startsWith("file://")) { controllerListener.setIconImageInfo(getIconImageInfo(source)); DraweeController controller = Fresco.newDraweeControllerBuilder() .setUri(Uri.parse(uri)) .setControllerListener(controllerListener) .setOldController(holder.getController()) .build(); holder.setController(controller); holder.getTopLevelDrawable().setVisible(true, true); } else { controllerListener.setDrawable(getDrawableByName(uri)); } }
Example #10
Source File: CommentImageGrid.java From CommentGallery with Apache License 2.0 | 6 votes |
private void refreshImageChild() { int childrenCount = getChildCount(); if (childrenCount > 0) { for (int i = 0; i < childrenCount; i++) { ViewGroup childImageLayout = (ViewGroup) getChildAt(i); SimpleDraweeView childImageView = (SimpleDraweeView) childImageLayout.getChildAt(0); if (mOnItemClickListener != null) { final int finalI = i; childImageLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mOnItemClickListener.OnItemClick(finalI); } }); } ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(mImageUrls.get(i))) .setResizeOptions(new ResizeOptions(mItemWidth, mItemWidth)) .build(); DraweeController controller = Fresco.newDraweeControllerBuilder() .setImageRequest(request) .setOldController(childImageView.getController()) .build(); childImageView.setController(controller); } } }
Example #11
Source File: BigImageLoader.java From ImageLoader with Apache License 2.0 | 6 votes |
@Override public View showThumbnail(BigImageView parent, Uri thumbnail, int scaleType) { SimpleDraweeView thumbnailView = (SimpleDraweeView) LayoutInflater.from(parent.getContext()) .inflate(R.layout.ui_fresco_thumbnail, parent, false); DraweeController controller = Fresco.newDraweeControllerBuilder() .setUri(thumbnail) .build(); switch (scaleType) { case BigImageView.INIT_SCALE_TYPE_CENTER_CROP: thumbnailView.getHierarchy() .setActualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP); break; case BigImageView.INIT_SCALE_TYPE_CENTER_INSIDE: thumbnailView.getHierarchy() .setActualImageScaleType(ScalingUtils.ScaleType.CENTER_INSIDE); default: break; } thumbnailView.setController(controller); return thumbnailView; }
Example #12
Source File: BindingSetters.java From materialup with Apache License 2.0 | 6 votes |
@BindingAdapter({"bind:normalUrl", "bind:teaserUrl"}) public static void loadImage(SimpleDraweeView view, String normal, String teaser) { ImageRequest imageRequest = ImageRequest.fromUri(normal); ImageRequest lowRequest = null; if (!TextUtils.isEmpty(teaser)) { lowRequest = ImageRequest.fromUri(teaser); } DraweeController draweeController = Fresco.newDraweeControllerBuilder() .setImageRequest(imageRequest) .setLowResImageRequest(lowRequest) .setOldController(view.getController()) .setAutoPlayAnimations(true) .build(); view.setController(draweeController); }
Example #13
Source File: CanPhotoHelper.java From CanPhotos with Apache License 2.0 | 6 votes |
/** * 设置图片 * * @param image * @param url * @param width * @param heigth */ public void setDraweeImage(SimpleDraweeView image, String url, int width, int heigth) { if (width <= 0) { width = dp2Px(image.getContext(), 50); } if (heigth <= 0) { heigth = dp2Px(image.getContext(), 50); } ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url)).setLocalThumbnailPreviewsEnabled(true).setResizeOptions(new ResizeOptions(width, heigth)).build(); DraweeController draweeController = Fresco.newDraweeControllerBuilder() .setImageRequest(imageRequest) .setAutoPlayAnimations(true) .build(); image.setController(draweeController); }
Example #14
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 #15
Source File: ReactBottomNavigation.java From native-navigation with MIT License | 6 votes |
/** * Sets an icon for a specific icon source. If the uri indicates an icon * to be somewhere remote (http/https) or on the local filesystem, it uses fresco to load it. * Otherwise it loads the Drawable from the Resources and directly returns it via a callback */ private void setIconSource(ReadableMap source, IconControllerListener controllerListener, DraweeHolder holder) { String uri = source != null ? source.getString(PROP_ICON_URI) : null; if (uri == null) { controllerListener.setIconImageInfo(null); controllerListener.setDrawable(null); } else if (uri.startsWith("http://") || uri.startsWith("https://") || uri.startsWith("file://")) { controllerListener.setIconImageInfo(getIconImageInfo(source)); DraweeController controller = Fresco.newDraweeControllerBuilder() .setUri(Uri.parse(uri)) .setControllerListener(controllerListener) .setOldController(holder.getController()) .build(); holder.setController(controller); holder.getTopLevelDrawable().setVisible(true, true); } else { controllerListener.setDrawable(getDrawableByName(uri)); } }
Example #16
Source File: ReactToolbar.java From native-navigation with MIT License | 6 votes |
/** * Sets an icon for a specific icon source. If the uri indicates an icon * to be somewhere remote (http/https) or on the local filesystem, it uses fresco to load it. * Otherwise it loads the Drawable from the Resources and directly returns it via a callback */ private void setIconSource(ReadableMap source, IconControllerListener controllerListener, DraweeHolder holder) { String uri = source != null ? source.getString(PROP_ICON_URI) : null; if (uri == null) { controllerListener.setIconImageInfo(null); controllerListener.setDrawable(null); } else if (uri.startsWith("http://") || uri.startsWith("https://") || uri.startsWith("file://")) { controllerListener.setIconImageInfo(getIconImageInfo(source)); DraweeController controller = Fresco.newDraweeControllerBuilder() .setUri(Uri.parse(uri)) .setControllerListener(controllerListener) .setOldController(holder.getController()) .build(); holder.setController(controller); holder.getTopLevelDrawable().setVisible(true, true); } else { controllerListener.setDrawable(getDrawableByName(uri)); } }
Example #17
Source File: FrescoUtil.java From PicKing with Apache License 2.0 | 6 votes |
public static void setBlurFrescoController(SimpleDraweeView simpleDraweeView, String url, int iterations, int blurRadius) { try { Uri uri = Uri.parse(url); ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri) .setPostprocessor(new IterativeBoxBlurPostProcessor(iterations, blurRadius)) .build(); DraweeController controller = Fresco.newDraweeControllerBuilder() .setOldController(simpleDraweeView.getController()) .setImageRequest(request) .build(); simpleDraweeView.setController(controller); } catch (Exception e) { e.printStackTrace(); } }
Example #18
Source File: FrescoUtils.java From droidddle with Apache License 2.0 | 6 votes |
public static final void setShotUrl(DraweeView view, String url, String thumbnail/*, BaseControllerListener listener*/) { ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url)) // .setResizeOptions( // new ResizeOptions(300, 400)) .setProgressiveRenderingEnabled(true) .build(); ImageRequest lowRequest = null; if (!TextUtils.isEmpty(thumbnail)) { lowRequest = ImageRequest.fromUri(thumbnail); } DraweeController draweeController = Fresco.newDraweeControllerBuilder() .setImageRequest(imageRequest) .setLowResImageRequest(lowRequest) .setOldController(view.getController()) .setAutoPlayAnimations(true) // .setControllerListener(listener) .build(); view.setController(draweeController); }
Example #19
Source File: ZoomableDraweeView.java From materialup with Apache License 2.0 | 5 votes |
private void setControllersInternal( @Nullable DraweeController controller, @Nullable DraweeController hugeImageController) { removeControllerListener(getController()); addControllerListener(controller); mHugeImageController = hugeImageController; super.setController(controller); }
Example #20
Source File: MainActivity.java From ShapedDraweeView with MIT License | 5 votes |
private void rightBlackSmall() { ShapedDraweeView shapedDraweeView = (ShapedDraweeView) findViewById(R.id.mShapedDraweeView1); DraweeController controller = Fresco.newDraweeControllerBuilder() .setUri(Uri.parse( "http://img0.bdstatic.com/img/image/shouye/xinshouye/chongwu16830.jpg")) .build(); shapedDraweeView.setController(controller); }
Example #21
Source File: MainActivity.java From ShapedDraweeView with MIT License | 5 votes |
private void rightAlphaBig() { ShapedDraweeView shapedDraweeView = (ShapedDraweeView) findViewById(R.id.mShapedDraweeView2); DraweeController controller = Fresco.newDraweeControllerBuilder() .setUri(Uri.parse( "http://img0.bdstatic.com/img/image/shouye/xinshouye/chongwu16830.jpg")) .build(); shapedDraweeView.setController(controller); }
Example #22
Source File: MainActivity.java From ShapedDraweeView with MIT License | 5 votes |
private void rightBlackBig() { ShapedDraweeView shapedDraweeView = (ShapedDraweeView) findViewById(R.id.mShapedDraweeView3); DraweeController controller = Fresco.newDraweeControllerBuilder() .setUri(Uri.parse( "http://img0.bdstatic.com/img/image/shouye/xinshouye/chongwu16830.jpg")) .build(); shapedDraweeView.setController(controller); }
Example #23
Source File: MainActivity.java From ShapedDraweeView with MIT License | 5 votes |
private void leftAlphaBig() { ShapedDraweeView shapedDraweeView = (ShapedDraweeView) findViewById(R.id.mShapedDraweeView4); DraweeController controller = Fresco.newDraweeControllerBuilder() .setUri(Uri.parse( "http://img0.bdstatic.com/img/image/shouye/xinshouye/chongwu16830.jpg")) .build(); shapedDraweeView.setController(controller); }
Example #24
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 #25
Source File: FrescoImageloadHelper.java From nono-android with GNU General Public License v3.0 | 5 votes |
public static void LoadFullImageFromURL(final SimpleDraweeView destImageView , final String URL) { destImageView.post(new Runnable() { @Override public void run() { int w = destImageView.getWidth(); int h =destImageView.getHeight(); ViewGroup.LayoutParams params = destImageView.getLayoutParams(); if(w<1){ w = params.width; } if(h<1){ h = params.height; } ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(Uri.parse(URL)) .setResizeOptions(new ResizeOptions(w, h)) .setProgressiveRenderingEnabled(true) .build(); DraweeController draweeController = Fresco.newDraweeControllerBuilder() .setImageRequest(imageRequest) .setOldController(destImageView.getController()) .setAutoPlayAnimations(true) .build(); destImageView.setController(draweeController); } }); }
Example #26
Source File: FrescoFactory.java From FrescoUtils with Apache License 2.0 | 5 votes |
public static DraweeController buildDraweeController(BaseFrescoImageView fresco){ return Fresco.newDraweeControllerBuilder() .setImageRequest(fresco.getImageRequest()) .setAutoPlayAnimations(fresco.isAnim()) .setTapToRetryEnabled(fresco.getTapToRetryEnabled()) .setLowResImageRequest(fresco.getLowImageRequest()) .setControllerListener(fresco.getControllerListener()) .setOldController(fresco.getDraweeController()) .build(); }
Example #27
Source File: ZoomableDraweeView.java From droidddle with Apache License 2.0 | 5 votes |
private void setControllersInternal( @Nullable DraweeController controller, @Nullable DraweeController hugeImageController) { removeControllerListener(getController()); addControllerListener(controller); mHugeImageController = hugeImageController; super.setController(controller); }
Example #28
Source File: MediaRecyclerAdapter.java From Capstone-Project with MIT License | 5 votes |
@Override public void onBindViewHolder(final MediaViewHolder holder, int position) { String mediaImageUrl = mMedia.get(position).getImageUrl(); mediaImageUrl = ImageUtils.getCustomMediaImageThumbnailUrl(mediaImageUrl, ScreenUtils.dpToPxInt(holder.itemView.getContext(), 100), ScreenUtils.dpToPxInt(holder.itemView.getContext(), 200)); // Set media image, also animate automatically if it is a gif. DraweeController controller = Fresco.newDraweeControllerBuilder() .setUri(mediaImageUrl) .setAutoPlayAnimations(true) .build(); holder.imgViewMedia.setController(controller); int mediaTypeTxtRes = R.string.item_media_type_image; switch (mMedia.get(position).getMediaType()) { case Constants.Media.IMAGE: mediaTypeTxtRes = R.string.item_media_type_image; break; case Constants.Media.VIDEO: mediaTypeTxtRes = R.string.item_media_type_video; break; } // Set media type. holder.txtMediaType.setText(mediaTypeTxtRes); holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mOnMediaItemClickListener.onMediaItemClick(holder.getAdapterPosition(), mMedia.get(holder.getAdapterPosition())); } }); }
Example #29
Source File: FrescoUtils.java From droidddle with Apache License 2.0 | 5 votes |
public static final void setShotImage(DraweeView view, Uri uri) { ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(uri) .setProgressiveRenderingEnabled(true) // .setResizeOptions(new ResizeOptions(1024,1024)) .build(); DraweeController draweeController = Fresco.newDraweeControllerBuilder() .setImageRequest(imageRequest) .setOldController(view.getController()) .setAutoPlayAnimations(true) .build(); view.setController(draweeController); }
Example #30
Source File: FrescoUtils.java From materialup with Apache License 2.0 | 5 votes |
public static final void setShotImage(DraweeView view, Uri uri) { ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(uri) .setProgressiveRenderingEnabled(true) // .setResizeOptions(new ResizeOptions(1024,1024)) .build(); DraweeController draweeController = Fresco.newDraweeControllerBuilder() .setImageRequest(imageRequest) .setOldController(view.getController()) .setAutoPlayAnimations(true) .build(); view.setController(draweeController); }