com.facebook.drawee.controller.AbstractDraweeControllerBuilder Java Examples

The following examples show how to use com.facebook.drawee.controller.AbstractDraweeControllerBuilder. 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: FrescoBasedReactTextInlineImageSpan.java    From react-native-GPay with MIT License 6 votes vote down vote up
public FrescoBasedReactTextInlineImageSpan(
    Resources resources,
    int height,
    int width,
    int tintColor,
    @Nullable Uri uri,
    ReadableMap headers,
    AbstractDraweeControllerBuilder draweeControllerBuilder,
    @Nullable Object callerContext) {
  mDraweeHolder = new DraweeHolder(
      GenericDraweeHierarchyBuilder.newInstance(resources)
          .build()
  );
  mDraweeControllerBuilder = draweeControllerBuilder;
  mCallerContext = callerContext;
  mTintColor = tintColor;
  mUri = (uri != null) ? uri : Uri.EMPTY;
  mHeaders = headers;
  mWidth = (int)(PixelUtil.toPixelFromDIP(width));
  mHeight = (int)(PixelUtil.toPixelFromDIP(height));

}
 
Example #2
Source File: PipelineDraweeController.java    From fresco with MIT License 6 votes vote down vote up
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 #3
Source File: InstrumentedDraweeView.java    From fresco with MIT License 5 votes vote down vote up
@Override
public void setImageURI(Uri uri, @Nullable Object callerContext) {
  SimpleDraweeControllerBuilder controllerBuilder =
      getControllerBuilder()
          .setUri(uri)
          .setCallerContext(callerContext)
          .setOldController(getController());
  if (mConfig.instrumentationEnabled
      && controllerBuilder instanceof AbstractDraweeControllerBuilder) {
    ((AbstractDraweeControllerBuilder<?, ?, ?, ?>) controllerBuilder)
        .setControllerListener(mListener);
  }
  setController(controllerBuilder.build());
}
 
Example #4
Source File: InstrumentedDraweeView.java    From fresco with MIT License 5 votes vote down vote up
@Override
public void setImageURI(Uri uri, @Nullable Object callerContext) {
  SimpleDraweeControllerBuilder controllerBuilder =
      getControllerBuilder()
          .setUri(uri)
          .setCallerContext(callerContext)
          .setOldController(getController());
  if (controllerBuilder instanceof AbstractDraweeControllerBuilder) {
    ((AbstractDraweeControllerBuilder<?, ?, ?, ?>) controllerBuilder)
        .setControllerListener(mListener);
  }
  setController(controllerBuilder.build());
}
 
Example #5
Source File: ReactImageManager.java    From react-native-GPay with MIT License 5 votes vote down vote up
public ReactImageManager(
    AbstractDraweeControllerBuilder draweeControllerBuilder,
    @Nullable GlobalImageLoadListener globalImageLoadListener,
    Object callerContext) {
  mDraweeControllerBuilder = draweeControllerBuilder;
  mGlobalImageLoadListener = globalImageLoadListener;
  mCallerContext = callerContext;
}
 
Example #6
Source File: SimpleDraweeView.java    From fresco with MIT License 5 votes vote down vote up
/**
 * Sets the image request
 *
 * @param request Image Request
 */
public void setImageRequest(ImageRequest request) {
  AbstractDraweeControllerBuilder controllerBuilder = mControllerBuilder;
  DraweeController controller =
      controllerBuilder.setImageRequest(request).setOldController(getController()).build();
  setController(controller);
}
 
Example #7
Source File: ReactImageView.java    From react-native-GPay with MIT License 5 votes vote down vote up
public ReactImageView(
  Context context,
  AbstractDraweeControllerBuilder draweeControllerBuilder,
  @Nullable GlobalImageLoadListener globalImageLoadListener,
  @Nullable Object callerContext) {
  super(context, buildHierarchy(context));
  mScaleType = ImageResizeMode.defaultValue();
  mDraweeControllerBuilder = draweeControllerBuilder;
  mRoundedCornerPostprocessor = new RoundedCornerPostprocessor();
  mTilePostprocessor = new TilePostprocessor();
  mGlobalImageLoadListener = globalImageLoadListener;
  mCallerContext = callerContext;
  mSources = new LinkedList<>();
}
 
Example #8
Source File: WatchDraweeImage.java    From ImageLoadPK with Apache License 2.0 5 votes vote down vote up
@Override
public void setImageURI(Uri uri) {
    super.setImageURI(uri);
    SimpleDraweeControllerBuilder controllerBuilder = getControllerBuilder().setUri(uri);
    if (controllerBuilder instanceof AbstractDraweeControllerBuilder) {
        ((AbstractDraweeControllerBuilder) controllerBuilder).setControllerListener(mControllerListener);
    }
    setController(controllerBuilder.build());

}
 
Example #9
Source File: ImagePerfMonitor.java    From fresco with MIT License 5 votes vote down vote up
public void updateImageRequestData(
    AbstractDraweeControllerBuilder<
            PipelineDraweeControllerBuilder,
            ImageRequest,
            CloseableReference<CloseableImage>,
            ImageInfo>
        pipelineDraweeControllerBuilder) {
  mImagePerfState.setControllerImageRequests(
      pipelineDraweeControllerBuilder.getImageRequest(),
      pipelineDraweeControllerBuilder.getLowResImageRequest(),
      pipelineDraweeControllerBuilder.getFirstAvailableImageRequests());
}
 
Example #10
Source File: PipelineDraweeControllerBuilder.java    From fresco with MIT License 5 votes vote down vote up
@Override
protected DataSource<CloseableReference<CloseableImage>> getDataSourceForRequest(
    DraweeController controller,
    String controllerId,
    ImageRequest imageRequest,
    Object callerContext,
    AbstractDraweeControllerBuilder.CacheLevel cacheLevel) {
  return mImagePipeline.fetchDecodedImage(
      imageRequest,
      callerContext,
      convertCacheLevelToRequestLevel(cacheLevel),
      getRequestListener(controller),
      controllerId);
}
 
Example #11
Source File: PipelineDraweeControllerBuilder.java    From fresco with MIT License 5 votes vote down vote up
public static ImageRequest.RequestLevel convertCacheLevelToRequestLevel(
    AbstractDraweeControllerBuilder.CacheLevel cacheLevel) {
  switch (cacheLevel) {
    case FULL_FETCH:
      return ImageRequest.RequestLevel.FULL_FETCH;
    case DISK_CACHE:
      return ImageRequest.RequestLevel.DISK_CACHE;
    case BITMAP_MEMORY_CACHE:
      return ImageRequest.RequestLevel.BITMAP_MEMORY_CACHE;
    default:
      throw new RuntimeException("Cache level" + cacheLevel + "is not supported. ");
  }
}
 
Example #12
Source File: InstrumentedDraweeView.java    From fresco with MIT License 4 votes vote down vote up
public void setListener(AbstractDraweeControllerBuilder controllerBuilder) {
  if (mConfig.instrumentationEnabled) {
    controllerBuilder.setControllerListener(mListener);
  }
}
 
Example #13
Source File: FrescoBasedReactTextInlineImageShadowNode.java    From react-native-GPay with MIT License 4 votes vote down vote up
public FrescoBasedReactTextInlineImageShadowNode(
  AbstractDraweeControllerBuilder draweeControllerBuilder,
  @Nullable Object callerContext) {
  mDraweeControllerBuilder = draweeControllerBuilder;
  mCallerContext = callerContext;
}
 
Example #14
Source File: SimpleDraweeView.java    From fresco with MIT License 4 votes vote down vote up
protected AbstractDraweeControllerBuilder getControllerBuilder() {
  return mControllerBuilder;
}
 
Example #15
Source File: SimpleDraweeView.java    From fresco with MIT License 4 votes vote down vote up
/** Initializes {@link SimpleDraweeView} with supplier of Drawee controller builders. */
public static void initialize(
    Supplier<? extends AbstractDraweeControllerBuilder> draweeControllerBuilderSupplier) {
  sDraweecontrollerbuildersupplier = draweeControllerBuilderSupplier;
}
 
Example #16
Source File: ReactImageManager.java    From react-native-GPay with MIT License 4 votes vote down vote up
public AbstractDraweeControllerBuilder getDraweeControllerBuilder() {
  if (mDraweeControllerBuilder == null) {
    mDraweeControllerBuilder = Fresco.newDraweeControllerBuilder();
  }
  return mDraweeControllerBuilder;
}
 
Example #17
Source File: ReactImageManager.java    From react-native-GPay with MIT License 4 votes vote down vote up
public ReactImageManager(
    AbstractDraweeControllerBuilder draweeControllerBuilder, Object callerContext) {
  this(draweeControllerBuilder, null, callerContext);
}
 
Example #18
Source File: FrescoBasedReactTextInlineImageViewManager.java    From react-native-GPay with MIT License 4 votes vote down vote up
public FrescoBasedReactTextInlineImageViewManager(
  @Nullable AbstractDraweeControllerBuilder draweeControllerBuilder,
  @Nullable Object callerContext) {
  mDraweeControllerBuilder = draweeControllerBuilder;
  mCallerContext = callerContext;
}
 
Example #19
Source File: FrescoBasedReactTextInlineImageShadowNode.java    From react-native-GPay with MIT License 4 votes vote down vote up
public AbstractDraweeControllerBuilder getDraweeControllerBuilder() {
  return mDraweeControllerBuilder;
}