com.facebook.imagepipeline.image.ImageInfo Java Examples
The following examples show how to use
com.facebook.imagepipeline.image.ImageInfo.
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: CombinedImageListenerImpl.java From fresco with MIT License | 6 votes |
@Override public void onFinalImageSet( long id, VitoImageRequest imageRequest, @ImageOrigin int imageOrigin, @Nullable ImageInfo imageInfo, @Nullable ControllerListener2.Extras extras, @Nullable Drawable drawable) { if (mVitoImageRequestListener != null) { mVitoImageRequestListener.onFinalImageSet( id, imageRequest, imageOrigin, imageInfo, extras, drawable); } if (mImageListener != null) { mImageListener.onFinalImageSet(id, imageOrigin, imageInfo, drawable); } mControllerListener2.onFinalImageSet(VitoUtils.getStringId(id), imageInfo, extras); }
Example #2
Source File: FrescoStateImpl.java From fresco with MIT License | 6 votes |
@Override public void onFinalImageSet( long id, @ImageOrigin int imageOrigin, @Nullable ImageInfo imageInfo, @Nullable Drawable drawable) { if (mImageListener != null) { mImageListener.onFinalImageSet(id, imageOrigin, imageInfo, drawable); } if (mOtherListeners != null) { mOtherListeners.onFinalImageSet(id, imageOrigin, imageInfo, drawable); } if (mImageStateListener != null) { mImageStateListener.onFinalImageSet(this, imageOrigin, imageInfo, drawable); } }
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: OverlayMarker.java From react-native-baidu-map with MIT License | 6 votes |
@Override public void onFinalImageSet(String id, final ImageInfo imageInfo, Animatable animatable) { Log.i("onFinalImageSet", id); CloseableReference<CloseableImage> imageReference = null; try { imageReference = dataSource.getResult(); if (imageReference != null) { CloseableImage image = imageReference.get(); if (image != null && image instanceof CloseableStaticBitmap) { CloseableStaticBitmap closeableStaticBitmap = (CloseableStaticBitmap) image; Bitmap bitmap = closeableStaticBitmap.getUnderlyingBitmap(); if (bitmap != null) { bitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true); iconBitmapDescriptor = BitmapDescriptorFactory.fromBitmap(bitmap); BITMAP_DESCRIPTOR_MAP.put(iconInfo.getUri(), iconBitmapDescriptor); } } } } finally { dataSource.close(); if (imageReference != null) { CloseableReference.closeSafely(imageReference); } loadingImage = false; } }
Example #5
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 #6
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 #7
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 #8
Source File: MediasAdapter.java From meiShi with Apache License 2.0 | 6 votes |
@Override public void onBindItemViewHolder(final ViewHolder holder, final int position) { MediaEntity entity = getItem(position); holder.mImageViewCover.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onItemClickListener.onItemClick(getItem(position)); } }); holder.mTextViewLikesCount.setTextImageStart(18, R.mipmap.ic_thumb_up_gray_18dp, " " + entity.getLikes_count()); holder.mTextViewRecommendCaption.setText(entity.getCaption()); String url = entity.getCover_pic().replace("!thumb320", ""); DraweeController controller = Fresco.newDraweeControllerBuilder() .setControllerListener(new BaseControllerListener<ImageInfo>() { @Override public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) { float aspectRatio = (float)imageInfo.getWidth() / (float)imageInfo.getHeight(); holder.mImageViewCover.setAspectRatio(aspectRatio); } }) .setUri(Uri.parse(url)) .build(); holder.mImageViewCover.setController(controller); AppUtils.loadSmallUserAvata(getItem(position).getUser(), holder.mImageViewAvatar); }
Example #9
Source File: PipelineDraweeController.java From fresco with MIT License | 6 votes |
protected synchronized void initializePerformanceMonitoring( @Nullable ImagePerfDataListener imagePerfDataListener, AbstractDraweeControllerBuilder< PipelineDraweeControllerBuilder, ImageRequest, CloseableReference<CloseableImage>, ImageInfo> builder, Supplier<Boolean> asyncLogging) { if (mImagePerfMonitor != null) { mImagePerfMonitor.reset(); } if (imagePerfDataListener != null) { if (mImagePerfMonitor == null) { mImagePerfMonitor = new ImagePerfMonitor(AwakeTimeSinceBootClock.get(), this, asyncLogging); } mImagePerfMonitor.addImagePerfDataListener(imagePerfDataListener); mImagePerfMonitor.setEnabled(true); mImagePerfMonitor.updateImageRequestData(builder); } mImageRequest = builder.getImageRequest(); mFirstAvailableImageRequests = builder.getFirstAvailableImageRequests(); mLowResImageRequest = builder.getLowResImageRequest(); }
Example #10
Source File: ImagePipelineRegionDecodingFragment.java From fresco with MIT License | 5 votes |
@Override public void onFinalImageSet( String id, @javax.annotation.Nullable ImageInfo imageInfo, @javax.annotation.Nullable Animatable animatable) { mImageInfo = imageInfo; mSelectedRegion.setUpdateMaximumDimensionOnNextSizeChange(true); if (imageInfo != null) { mFullDraweeView.setAspectRatio(imageInfo.getWidth() / (float) imageInfo.getHeight()); mFullDraweeView.requestLayout(); updateRegion(); } }
Example #11
Source File: FrescoControllerImpl.java From fresco with MIT License | 5 votes |
private InstrumentedDrawable.Listener createListener( final ImageListener imageListener, final ImageInfo info, final String id) { return new InstrumentedDrawable.Listener() { public static final String TAG = "InstrumentedDrawable.Listener"; @Override public void track( int viewWidth, int viewHeight, int imageWidth, int imageHeight, int scaledWidth, int scaledHeight, String scaleType) { if (imageListener != null) { if (!(info instanceof HasImageMetadata)) { FLog.wtf(TAG, "mInfo does not implement HasImageMetadata: " + info); } else { int encodedImageWidth = -1; int encodedImageHeight = -1; DimensionsInfo dimensionsInfo = new DimensionsInfo( viewWidth, viewHeight, encodedImageWidth, encodedImageHeight, imageWidth, imageHeight, scaleType); if (imageListener != null) { imageListener.onImageDrawn(id, info, dimensionsInfo); } } } } }; }
Example #12
Source File: ReactToolbar.java From react-native-GPay with MIT License | 5 votes |
@Override public void onFinalImageSet(String id, @Nullable ImageInfo imageInfo, @Nullable Animatable animatable) { super.onFinalImageSet(id, imageInfo, animatable); final ImageInfo info = mIconImageInfo != null ? mIconImageInfo : imageInfo; setDrawable(new DrawableWithIntrinsicSize(mHolder.getTopLevelDrawable(), info)); }
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: ForwardingImageListener.java From fresco with MIT License | 5 votes |
@Override public void onImageDrawn(String id, ImageInfo imageInfo, DimensionsInfo dimensionsInfo) { for (int i = 0; i < mListeners.length; i++) { if (mListeners[i] != null) { mListeners[i].onImageDrawn(id, imageInfo, dimensionsInfo); } } }
Example #15
Source File: ForwardingImageListener.java From fresco with MIT License | 5 votes |
@Override public void onIntermediateImageSet(long id, @Nullable ImageInfo imageInfo) { for (int i = 0; i < mListeners.length; i++) { if (mListeners[i] != null) { mListeners[i].onIntermediateImageSet(id, imageInfo); } } }
Example #16
Source File: ForwardingImageListener.java From fresco with MIT License | 5 votes |
@Override public void onFinalImageSet( long id, @ImageOrigin int imageOrigin, @Nullable ImageInfo imageInfo, @Nullable Drawable drawable) { for (int i = 0; i < mListeners.length; i++) { if (mListeners[i] != null) { mListeners[i].onFinalImageSet(id, imageOrigin, imageInfo, drawable); } } }
Example #17
Source File: CombinedImageListener.java From fresco with MIT License | 5 votes |
@Override void onFinalImageSet( long id, VitoImageRequest imageRequest, @ImageOrigin int imageOrigin, @Nullable ImageInfo imageInfo, @Nullable ControllerListener2.Extras extras, @Nullable Drawable drawable);
Example #18
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 #19
Source File: ImagePerfControllerListener2.java From fresco with MIT License | 5 votes |
@Override public void onIntermediateImageSet(String id, @Nullable ImageInfo imageInfo) { final long now = mClock.now(); mImagePerfState.setControllerIntermediateImageSetTimeMs(now); mImagePerfState.setControllerId(id); mImagePerfState.setImageInfo(imageInfo); updateStatus(ImageLoadStatus.INTERMEDIATE_AVAILABLE); }
Example #20
Source File: RetainingDataSourceSupplierFragment.java From fresco with MIT License | 5 votes |
@Override public void onFinalImageSet( String id, @Nullable ImageInfo imageInfo, @Nullable Animatable anim) { if (anim != null) { // app-specific logic to enable animation starting anim.start(); } }
Example #21
Source File: ImagePreFragment.java From SprintNBA with Apache License 2.0 | 5 votes |
@Override public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) { super.onFinalImageSet(id, imageInfo, animatable); LogUtils.i("onFinalImageSet"); if (imageInfo == null) { return; } pdvImage.update(imageInfo.getWidth(), imageInfo.getHeight()); }
Example #22
Source File: ControllerListenerWrapperTest.java From fresco with MIT License | 5 votes |
@Test public void testOnFinalImageSetAnimatedDrawable() { final AnimatedDrawable drawable = mock(AnimatedDrawable.class); final ImageInfo imageInfo = mock(ImageInfo.class); mControllerListenerWrapper.onFinalImageSet(ID, ImageOrigin.DISK, imageInfo, drawable); verify(mControllerListener).onFinalImageSet(eq(STRING_ID), eq(imageInfo), eq(drawable)); verifyNoMoreInteractions(mControllerListener); }
Example #23
Source File: UniversalDraweeView.java From JianshuApp with GNU General Public License v3.0 | 5 votes |
private void loadImageURI(Uri uri, @Nullable Object callerContext, int width, int height) { // 对URL做格式转换、尺寸限制等处理 uri = Uri.parse(ImageUtils.format(uri.toString(), DisplayInfo.getWidthPixels())); ImageRequestBuilder imageRequestBuilder = ImageRequestBuilder.newBuilderWithSource(uri); imageRequestBuilder.setProgressiveRenderingEnabled(true); imageRequestBuilder.setRotationOptions(RotationOptions.autoRotateAtRenderTime()); if (width > 0 && height > 0) { imageRequestBuilder.setResizeOptions(new ResizeOptions(width, height)); } PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder() .setCallerContext(callerContext) .setImageRequest(imageRequestBuilder.build()) .setOldController(getController()) .setAutoPlayAnimations(true) // 自动播放动态图 .setTapToRetryEnabled(true) // 在加载失败时,可以点击重新加载 .setControllerListener(new BaseControllerListener<ImageInfo>() { @Override public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) { super.onFinalImageSet(id, imageInfo, animatable); onUpdateImage(imageInfo); } }); if (AppUtils.isMainThread()) { setController(controller.build()); } else { Observable.just(0) .observeOn(AndroidSchedulers.mainThread()) .subscribe(it -> setController(controller.build())); } }
Example #24
Source File: ControllerListenerWrapperTest.java From fresco with MIT License | 5 votes |
@Test public void testOnFinalImageSetNormalDrawable() { final Drawable drawable = mock(Drawable.class); final ImageInfo imageInfo = mock(ImageInfo.class); mControllerListenerWrapper.onFinalImageSet(ID, ImageOrigin.DISK, imageInfo, drawable); verify(mControllerListener) .onFinalImageSet(eq(STRING_ID), eq(imageInfo), isNull(Animatable.class)); verifyNoMoreInteractions(mControllerListener); }
Example #25
Source File: ControllerListenerWrapperTest.java From fresco with MIT License | 5 votes |
@Test public void testOnIntermediateImageSet() { final ImageInfo imageInfo = mock(ImageInfo.class); mControllerListenerWrapper.onIntermediateImageSet(ID, imageInfo); verify(mControllerListener).onIntermediateImageSet(eq(STRING_ID), eq(imageInfo)); verifyNoMoreInteractions(mControllerListener); }
Example #26
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 #27
Source File: ImageFragment.java From TLint with Apache License 2.0 | 5 votes |
@Override public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) { super.onFinalImageSet(id, imageInfo, animatable); System.out.println("onFinalImageSet"); if (imageInfo == null) { return; } image.update(imageInfo.getWidth(), imageInfo.getHeight()); progress.setVisibility(View.GONE); }
Example #28
Source File: ImagePerfControllerListener.java From fresco with MIT License | 5 votes |
@Override public void onFinalImageSet( String id, @Nullable ImageInfo imageInfo, @Nullable Animatable animatable) { final long now = mClock.now(); mImagePerfState.setControllerFinalImageSetTimeMs(now); mImagePerfState.setImageRequestEndTimeMs(now); mImagePerfState.setControllerId(id); mImagePerfState.setImageInfo(imageInfo); mImagePerfMonitor.notifyStatusUpdated(mImagePerfState, ImageLoadStatus.SUCCESS); }
Example #29
Source File: CombinedImageListenerImpl.java From fresco with MIT License | 5 votes |
@Override public void onIntermediateImageSet( long id, VitoImageRequest imageRequest, @Nullable ImageInfo imageInfo) { if (mVitoImageRequestListener != null) { mVitoImageRequestListener.onIntermediateImageSet(id, imageRequest, imageInfo); } if (mImageListener != null) { mImageListener.onIntermediateImageSet(id, imageInfo); } mControllerListener2.onIntermediateImageSet(VitoUtils.getStringId(id), imageInfo); }
Example #30
Source File: ImagePerfControllerListener.java From fresco with MIT License | 5 votes |
@Override public void onIntermediateImageSet(String id, @Nullable ImageInfo imageInfo) { final long now = mClock.now(); mImagePerfState.setControllerIntermediateImageSetTimeMs(now); mImagePerfState.setControllerId(id); mImagePerfState.setImageInfo(imageInfo); mImagePerfMonitor.notifyStatusUpdated(mImagePerfState, ImageLoadStatus.INTERMEDIATE_AVAILABLE); }