com.facebook.drawee.controller.ControllerListener Java Examples
The following examples show how to use
com.facebook.drawee.controller.ControllerListener.
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: DraweeMocks.java From fresco with MIT License | 6 votes |
/** * Stubs addControllerListener * * @param controller * @return forwarding listener */ public static ControllerListener stubControllerListener(final DraweeController controller) { final ForwardingControllerListener forwardingListener = new ForwardingControllerListener(); if (!(controller instanceof AbstractDraweeController)) { return null; } AbstractDraweeController abstractController = (AbstractDraweeController) controller; doAnswer( new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { forwardingListener.addListener((ControllerListener) invocation.getArguments()[0]); return null; } }) .when(abstractController) .addControllerListener(any(ControllerListener.class)); return forwardingListener; }
Example #3
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 #4
Source File: PipelineDraweeControllerBuilderSupplier.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 5 votes |
public PipelineDraweeControllerBuilderSupplier( Context context, ImagePipelineFactory imagePipelineFactory, Set<ControllerListener> boundControllerListeners) { mContext = context; mImagePipeline = imagePipelineFactory.getImagePipeline(); mPipelineDraweeControllerFactory = new PipelineDraweeControllerFactory( context.getResources(), DeferredReleaser.getInstance(), imagePipelineFactory.getAnimatedDrawableFactory(), UiThreadImmediateExecutorService.getInstance()); mBoundControllerListeners = boundControllerListeners; }
Example #5
Source File: PipelineDraweeControllerBuilder.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 5 votes |
public PipelineDraweeControllerBuilder( Context context, PipelineDraweeControllerFactory pipelineDraweeControllerFactory, ImagePipeline imagePipeline, Set<ControllerListener> boundControllerListeners) { super(context, boundControllerListeners); mImagePipeline = imagePipeline; mPipelineDraweeControllerFactory = pipelineDraweeControllerFactory; }
Example #6
Source File: VolleyDraweeControllerBuilderSupplier.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 5 votes |
public VolleyDraweeControllerBuilderSupplier( Context context, ImageLoader imageLoader, Set<ControllerListener> boundControllerListeners) { mContext = context; mImageLoader = imageLoader; mVolleyDraweeControllerFactory = new VolleyDraweeControllerFactory( context.getResources(), DeferredReleaser.getInstance(), UiThreadExecutorService.getInstance()); mBoundControllerListeners = boundControllerListeners; }
Example #7
Source File: VolleyDraweeControllerBuilder.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 5 votes |
public VolleyDraweeControllerBuilder( Context context, ImageLoader imageLoader, VolleyDraweeControllerFactory volleyDraweeControllerFactory, Set<ControllerListener> boundControllerListeners) { super(context, boundControllerListeners); mImageLoader = imageLoader; mVolleyDraweeControllerFactory = volleyDraweeControllerFactory; }
Example #8
Source File: PostItemImageView.java From redgram-for-reddit with GNU General Public License v3.0 | 5 votes |
private ControllerListener<? super ImageInfo> getControllerListener() { ControllerListener controllerListener = new BaseControllerListener<ImageInfo>(){ @Override public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) { imageLoaded = true; } }; return controllerListener; }
Example #9
Source File: FrescoFaceCropActivity.java From ImageLoader with Apache License 2.0 | 5 votes |
/** * Fresco getController * * @param sdv SimpleDraweeView * @param url 图片地址 * @param controllerListener 下载图片后执行事件 * @return */ private static DraweeController getController(SimpleDraweeView sdv, String url, ControllerListener controllerListener) { ImageRequest request = ImageRequestBuilder .newBuilderWithSource(Uri.parse(url)) .setProgressiveRenderingEnabled(true) .build(); DraweeController controller = Fresco.newDraweeControllerBuilder() .setImageRequest(request) .setControllerListener(controllerListener) .setOldController(sdv.getController()) .build(); return controller; }
Example #10
Source File: PipelineDraweeControllerBuilderSupplier.java From fresco with MIT License | 5 votes |
public PipelineDraweeControllerBuilderSupplier( Context context, ImagePipelineFactory imagePipelineFactory, Set<ControllerListener> boundControllerListeners, Set<ControllerListener2> boundControllerListeners2, @Nullable DraweeConfig draweeConfig) { mContext = context; mImagePipeline = imagePipelineFactory.getImagePipeline(); if (draweeConfig != null && draweeConfig.getPipelineDraweeControllerFactory() != null) { mPipelineDraweeControllerFactory = draweeConfig.getPipelineDraweeControllerFactory(); } else { mPipelineDraweeControllerFactory = new PipelineDraweeControllerFactory(); } mPipelineDraweeControllerFactory.init( context.getResources(), DeferredReleaser.getInstance(), imagePipelineFactory.getAnimatedDrawableFactory(context), UiThreadImmediateExecutorService.getInstance(), mImagePipeline.getBitmapMemoryCache(), draweeConfig != null ? draweeConfig.getCustomDrawableFactories() : null, draweeConfig != null ? draweeConfig.getDebugOverlayEnabledSupplier() : null); mBoundControllerListeners = boundControllerListeners; mBoundControllerListeners2 = boundControllerListeners2; mDefaultImagePerfDataListener = draweeConfig != null ? draweeConfig.getImagePerfDataListener() : null; }
Example #11
Source File: PipelineDraweeControllerBuilder.java From fresco with MIT License | 5 votes |
public PipelineDraweeControllerBuilder( Context context, PipelineDraweeControllerFactory pipelineDraweeControllerFactory, ImagePipeline imagePipeline, Set<ControllerListener> boundControllerListeners, Set<ControllerListener2> boundControllerListeners2) { super(context, boundControllerListeners, boundControllerListeners2); mImagePipeline = imagePipeline; mPipelineDraweeControllerFactory = pipelineDraweeControllerFactory; }
Example #12
Source File: FrescoController.java From base-module with Apache License 2.0 | 5 votes |
/** * 加载图片到 View 上,可设置回调监听 * @param draweeView * @param listener */ public void intoTarget(SimpleDraweeView draweeView, ControllerListener listener) { if ((mImageConfig != null && mImageConfig.useNewHierarchy) || !draweeView.hasHierarchy()) { GenericDraweeHierarchy hierarchy = GenericDraweeHierarchyBuilder .newInstance(draweeView.getResources()).build(); draweeView.setHierarchy(hierarchy); } parseImageConfig(draweeView.getHierarchy()); if (mUri != null) { ImageDecodeOptions imageDecodeOptions = ImageDecodeOptions.newBuilder() .setDecodePreviewFrame(true) .build(); ImageRequestBuilder builder = ImageRequestBuilder.newBuilderWithSource(mUri) .setProgressiveRenderingEnabled(true) .setImageDecodeOptions(imageDecodeOptions); if (mWidth > 0 && mHeight > 0) { builder.setResizeOptions(new ResizeOptions(mWidth, mHeight)); } else { int width = draweeView.getMeasuredWidth(); int height = draweeView.getMeasuredHeight(); if(width > 0 && height > 0){ builder.setResizeOptions(new ResizeOptions(width, height)); } } ImageRequest request = builder.build(); AbstractDraweeController controller = Fresco.newDraweeControllerBuilder() .setImageRequest(request) .setControllerListener(listener) .setOldController(draweeView.getController()) .setAutoPlayAnimations(true) .build(); draweeView.setController(controller); } else { draweeView.setImageURI(""); } }
Example #13
Source File: ImageFilter.java From react-native-image-filter-kit with MIT License | 5 votes |
private void reset(final int retries) { mFiltering.cancel(); mImageListeners.clear(); List<ReactImageView> images = images(); mFiltering = new CancellationTokenSource(); for (final ReactImageView image : images) { final ControllerListener<ImageInfo> prevListener = ReactImageViewUtils .getControllerListener(image); if (mDefaultWidth == 0 && mDefaultHeight == 0) { mDefaultWidth = image.getMeasuredWidth(); mDefaultHeight = image.getMeasuredHeight(); } FrescoControllerListener nextListener = new FrescoControllerListener( FrescoControllerListener.originalListener(prevListener), () -> { sendJSEvent(ImageFilterEvent.ON_FILTERING_START, null); runFilterPipeline(); }, error -> handleError( error, rs -> { reset(rs); runFilterPipeline(); }, retries ) ); mImageListeners.put(image, nextListener); ReactImageViewUtils.setControllerListener(image, nextListener); } }
Example #14
Source File: FrescoControllerListener.java From react-native-image-filter-kit with MIT License | 5 votes |
@Nullable static ControllerListener<ImageInfo> originalListener( final ControllerListener<ImageInfo> listener ) { return listener instanceof FrescoControllerListener ? originalListener(((FrescoControllerListener) listener).mWrappedListener) : listener; }
Example #15
Source File: FrescoControllerListener.java From react-native-image-filter-kit with MIT License | 5 votes |
FrescoControllerListener( final @Nullable ControllerListener<ImageInfo> originalListener, final @Nonnull Functor.Arity0 onImageUpdated, final @Nonnull Functor.Arity1<Throwable> onError ) { super(); mWrappedListener = originalListener; mImageUpdated = onImageUpdated; mError = onError; }
Example #16
Source File: ReactImageViewUtils.java From react-native-image-filter-kit with MIT License | 5 votes |
static void setControllerListener( @Nullable ReactImageView target, @Nullable ControllerListener<ImageInfo> listener ) { if (target != null) { ReflectUtils.setFieldValue(target, "mControllerListener", listener); } }
Example #17
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 #18
Source File: ControllerListenerWrapper.java From fresco with MIT License | 4 votes |
@VisibleForTesting ControllerListenerWrapper(ControllerListener<ImageInfo> controllerListener) { mControllerListener = controllerListener; }
Example #19
Source File: ControllerListenerWrapperTest.java From fresco with MIT License | 4 votes |
@Before public void setup() { mControllerListener = (ControllerListener<ImageInfo>) mock(ControllerListener.class); mControllerListenerWrapper = new ControllerListenerWrapper(mControllerListener); }
Example #20
Source File: ImageManager.java From redgram-for-reddit with GNU General Public License v3.0 | 4 votes |
public SingleImageBuilder setListener(ControllerListener listener){ controllerBuilder.setControllerListener(listener); return this; }
Example #21
Source File: InstrumentedDraweeView.java From fresco with MIT License | 4 votes |
public ControllerListener<Object> getListener() { return mListener; }
Example #22
Source File: InstrumentedDraweeView.java From fresco with MIT License | 4 votes |
public ControllerListener<Object> getListener() { return mListener; }
Example #23
Source File: FrescoZoomImageView.java From FrescoUtils with Apache License 2.0 | 4 votes |
@Override public void setControllerListener(ControllerListener controllerListener) { this.mControllerListener = controllerListener; }
Example #24
Source File: FrescoZoomImageView.java From FrescoUtils with Apache License 2.0 | 4 votes |
@Override public ControllerListener getControllerListener() { return this.mControllerListener; }
Example #25
Source File: FrescoImageView.java From FrescoUtils with Apache License 2.0 | 4 votes |
@Override public void setControllerListener(ControllerListener controllerListener) { this.mControllerListener = controllerListener; }
Example #26
Source File: FrescoImageView.java From FrescoUtils with Apache License 2.0 | 4 votes |
@Override public ControllerListener getControllerListener() { return this.mControllerListener; }
Example #27
Source File: WatchDraweeImage.java From ImageLoadPK with Apache License 2.0 | 4 votes |
public ControllerListener getControllerListener() { return mControllerListener; }
Example #28
Source File: ReactImageView.java From react-native-GPay with MIT License | 4 votes |
public void setControllerListener(ControllerListener controllerListener) { mControllerForTesting = controllerListener; mIsDirty = true; maybeUpdateView(); }
Example #29
Source File: FrescoController.java From base-module with Apache License 2.0 | 4 votes |
@Override public void intoTarget(SimpleDraweeView draweeView, ControllerListener listener) { super.intoTarget(draweeView, listener); }
Example #30
Source File: DeliveryControllerListener.java From YcShareElement with Apache License 2.0 | 4 votes |
public DeliveryControllerListener(ControllerListener<INFO> listener) { this.listener = listener; }