Java 类com.facebook.imagepipeline.drawable.DrawableFactory 实例源码

项目:GitHub    文件:PipelineDraweeControllerFactory.java   
public void init(
    Resources resources,
    DeferredReleaser deferredReleaser,
    DrawableFactory animatedDrawableFactory,
    Executor uiThreadExecutor,
    MemoryCache<CacheKey, CloseableImage> memoryCache,
    @Nullable ImmutableList<DrawableFactory> drawableFactories,
    @Nullable Supplier<Boolean> debugOverlayEnabledSupplier) {
  mResources = resources;
  mDeferredReleaser = deferredReleaser;
  mAnimatedDrawableFactory = animatedDrawableFactory;
  mUiThreadExecutor = uiThreadExecutor;
  mMemoryCache = memoryCache;
  mDrawableFactories = drawableFactories;
  mDebugOverlayEnabledSupplier = debugOverlayEnabledSupplier;
}
项目:GitHub    文件:PipelineDraweeControllerFactory.java   
public PipelineDraweeController newController(
    Supplier<DataSource<CloseableReference<CloseableImage>>> dataSourceSupplier,
    String id,
    CacheKey cacheKey,
    Object callerContext,
    @Nullable ImmutableList<DrawableFactory> customDrawableFactories) {
  Preconditions.checkState(mResources != null, "init() not called");
  // Field values passed as arguments so that any subclass of PipelineDraweeControllerFactory
  // can simply override internalCreateController() and return a custom Drawee controller
  PipelineDraweeController controller = internalCreateController(
      mResources,
      mDeferredReleaser,
      mAnimatedDrawableFactory,
      mUiThreadExecutor,
      mMemoryCache,
      mDrawableFactories,
      customDrawableFactories,
      dataSourceSupplier,
      id,
      cacheKey,
      callerContext);
  if (mDebugOverlayEnabledSupplier != null) {
    controller.setDrawDebugOverlay(mDebugOverlayEnabledSupplier.get());
  }
  return controller;
}
项目:GitHub    文件:PipelineDraweeControllerFactory.java   
protected PipelineDraweeController internalCreateController(
    Resources resources,
    DeferredReleaser deferredReleaser,
    DrawableFactory animatedDrawableFactory,
    Executor uiThreadExecutor,
    MemoryCache<CacheKey, CloseableImage> memoryCache,
    @Nullable ImmutableList<DrawableFactory> globalDrawableFactories,
    @Nullable ImmutableList<DrawableFactory> customDrawableFactories,
    Supplier<DataSource<CloseableReference<CloseableImage>>> dataSourceSupplier,
    String id,
    CacheKey cacheKey,
    Object callerContext) {
  PipelineDraweeController controller = new PipelineDraweeController(
      resources,
      deferredReleaser,
      animatedDrawableFactory,
      uiThreadExecutor,
      memoryCache,
      dataSourceSupplier,
      id,
      cacheKey,
      callerContext,
      globalDrawableFactories);
  controller.setCustomDrawableFactories(customDrawableFactories);
  return controller;
}
项目:GitHub    文件:PipelineDraweeController.java   
public PipelineDraweeController(
        Resources resources,
        DeferredReleaser deferredReleaser,
        DrawableFactory animatedDrawableFactory,
        Executor uiThreadExecutor,
        MemoryCache<CacheKey, CloseableImage> memoryCache,
        Supplier<DataSource<CloseableReference<CloseableImage>>> dataSourceSupplier,
        String id,
        CacheKey cacheKey,
        Object callerContext) {
  this(
      resources,
      deferredReleaser,
      animatedDrawableFactory,
      uiThreadExecutor,
      memoryCache,
      dataSourceSupplier,
      id,
      cacheKey,
      callerContext,
      null);
}
项目:GitHub    文件:PipelineDraweeController.java   
public PipelineDraweeController(
    Resources resources,
    DeferredReleaser deferredReleaser,
    DrawableFactory animatedDrawableFactory,
    Executor uiThreadExecutor,
    MemoryCache<CacheKey, CloseableImage> memoryCache,
    Supplier<DataSource<CloseableReference<CloseableImage>>> dataSourceSupplier,
    String id,
    CacheKey cacheKey,
    Object callerContext,
    @Nullable ImmutableList<DrawableFactory> globalDrawableFactories) {
  super(deferredReleaser, uiThreadExecutor, id, callerContext);
  mResources = resources;
  mAnimatedDrawableFactory = animatedDrawableFactory;
  mMemoryCache = memoryCache;
  mCacheKey = cacheKey;
  mGlobalDrawableFactories = globalDrawableFactories;
  init(dataSourceSupplier);
}
项目:GitHub    文件:PipelineDraweeController.java   
private Drawable maybeCreateDrawableFromFactories(
    @Nullable ImmutableList<DrawableFactory> drawableFactories,
    CloseableImage closeableImage) {
  if (drawableFactories == null) {
    return null;
  }
  for (DrawableFactory factory : drawableFactories) {
    if (factory.supportsImageType(closeableImage)) {
      Drawable drawable = factory.createDrawable(closeableImage);
      if (drawable != null) {
        return drawable;
      }
    }
  }
  return null;
}
项目:fresco    文件:PipelineDraweeControllerFactory.java   
public void init(
    Resources resources,
    DeferredReleaser deferredReleaser,
    DrawableFactory animatedDrawableFactory,
    Executor uiThreadExecutor,
    MemoryCache<CacheKey, CloseableImage> memoryCache,
    @Nullable ImmutableList<DrawableFactory> drawableFactories,
    @Nullable Supplier<Boolean> debugOverlayEnabledSupplier) {
  mResources = resources;
  mDeferredReleaser = deferredReleaser;
  mAnimatedDrawableFactory = animatedDrawableFactory;
  mUiThreadExecutor = uiThreadExecutor;
  mMemoryCache = memoryCache;
  mDrawableFactories = drawableFactories;
  mDebugOverlayEnabledSupplier = debugOverlayEnabledSupplier;
}
项目:fresco    文件:PipelineDraweeControllerFactory.java   
public PipelineDraweeController newController(
    Supplier<DataSource<CloseableReference<CloseableImage>>> dataSourceSupplier,
    String id,
    CacheKey cacheKey,
    Object callerContext,
    @Nullable ImmutableList<DrawableFactory> customDrawableFactories) {
  Preconditions.checkState(mResources != null, "init() not called");
  // Field values passed as arguments so that any subclass of PipelineDraweeControllerFactory
  // can simply override internalCreateController() and return a custom Drawee controller
  PipelineDraweeController controller = internalCreateController(
      mResources,
      mDeferredReleaser,
      mAnimatedDrawableFactory,
      mUiThreadExecutor,
      mMemoryCache,
      mDrawableFactories,
      customDrawableFactories,
      dataSourceSupplier,
      id,
      cacheKey,
      callerContext);
  if (mDebugOverlayEnabledSupplier != null) {
    controller.setDrawDebugOverlay(mDebugOverlayEnabledSupplier.get());
  }
  return controller;
}
项目:fresco    文件:PipelineDraweeControllerFactory.java   
protected PipelineDraweeController internalCreateController(
    Resources resources,
    DeferredReleaser deferredReleaser,
    DrawableFactory animatedDrawableFactory,
    Executor uiThreadExecutor,
    MemoryCache<CacheKey, CloseableImage> memoryCache,
    @Nullable ImmutableList<DrawableFactory> globalDrawableFactories,
    @Nullable ImmutableList<DrawableFactory> customDrawableFactories,
    Supplier<DataSource<CloseableReference<CloseableImage>>> dataSourceSupplier,
    String id,
    CacheKey cacheKey,
    Object callerContext) {
  PipelineDraweeController controller = new PipelineDraweeController(
      resources,
      deferredReleaser,
      animatedDrawableFactory,
      uiThreadExecutor,
      memoryCache,
      dataSourceSupplier,
      id,
      cacheKey,
      callerContext,
      globalDrawableFactories);
  controller.setCustomDrawableFactories(customDrawableFactories);
  return controller;
}
项目:fresco    文件:PipelineDraweeController.java   
public PipelineDraweeController(
        Resources resources,
        DeferredReleaser deferredReleaser,
        DrawableFactory animatedDrawableFactory,
        Executor uiThreadExecutor,
        MemoryCache<CacheKey, CloseableImage> memoryCache,
        Supplier<DataSource<CloseableReference<CloseableImage>>> dataSourceSupplier,
        String id,
        CacheKey cacheKey,
        Object callerContext) {
  this(
      resources,
      deferredReleaser,
      animatedDrawableFactory,
      uiThreadExecutor,
      memoryCache,
      dataSourceSupplier,
      id,
      cacheKey,
      callerContext,
      null);
}
项目:fresco    文件:PipelineDraweeController.java   
public PipelineDraweeController(
    Resources resources,
    DeferredReleaser deferredReleaser,
    DrawableFactory animatedDrawableFactory,
    Executor uiThreadExecutor,
    MemoryCache<CacheKey, CloseableImage> memoryCache,
    Supplier<DataSource<CloseableReference<CloseableImage>>> dataSourceSupplier,
    String id,
    CacheKey cacheKey,
    Object callerContext,
    @Nullable ImmutableList<DrawableFactory> globalDrawableFactories) {
  super(deferredReleaser, uiThreadExecutor, id, callerContext);
  mResources = resources;
  mAnimatedDrawableFactory = animatedDrawableFactory;
  mMemoryCache = memoryCache;
  mCacheKey = cacheKey;
  mGlobalDrawableFactories = globalDrawableFactories;
  init(dataSourceSupplier);
}
项目:fresco    文件:PipelineDraweeController.java   
private Drawable maybeCreateDrawableFromFactories(
    @Nullable ImmutableList<DrawableFactory> drawableFactories,
    CloseableImage closeableImage) {
  if (drawableFactories == null) {
    return null;
  }
  for (DrawableFactory factory : drawableFactories) {
    if (factory.supportsImageType(closeableImage)) {
      Drawable drawable = factory.createDrawable(closeableImage);
      if (drawable != null) {
        return drawable;
      }
    }
  }
  return null;
}
项目:GitHub    文件:DraweeConfig.java   
/**
 * Add a custom drawable factory that will be used to create
 * Drawables for {@link com.facebook.imagepipeline.image.CloseableImage}s.
 *
 * @param factory the factory to use
 * @return the builder
 */
public Builder addCustomDrawableFactory(DrawableFactory factory) {
  if (mCustomDrawableFactories == null) {
    mCustomDrawableFactories = new ArrayList<>();
  }
  mCustomDrawableFactories.add(factory);
  return this;
}
项目:GitHub    文件:PipelineDraweeController.java   
/**
 * Initializes this controller with the new data source supplier, id and caller context. This
 * allows for reusing of the existing controller instead of instantiating a new one. This method
 * should be called when the controller is in detached state.
 *
 * @param dataSourceSupplier data source supplier
 * @param id unique id for this controller
 * @param callerContext tag and context for this controller
 */
public void initialize(
    Supplier<DataSource<CloseableReference<CloseableImage>>> dataSourceSupplier,
    String id,
    CacheKey cacheKey,
    Object callerContext,
    @Nullable ImmutableList<DrawableFactory> customDrawableFactories) {
  super.initialize(id, callerContext);
  init(dataSourceSupplier);
  mCacheKey = cacheKey;
  setCustomDrawableFactories(customDrawableFactories);
}
项目:GitHub    文件:AnimatedFactoryV2Impl.java   
@Nullable
@Override
public DrawableFactory getAnimatedDrawableFactory(Context context) {
  if (mAnimatedDrawableFactory == null) {
    mAnimatedDrawableFactory = createDrawableFactory();
  }
  return mAnimatedDrawableFactory;
}
项目:fresco    文件:DraweeConfig.java   
/**
 * Add a custom drawable factory that will be used to create
 * Drawables for {@link com.facebook.imagepipeline.image.CloseableImage}s.
 *
 * @param factory the factory to use
 * @return the builder
 */
public Builder addCustomDrawableFactory(DrawableFactory factory) {
  if (mCustomDrawableFactories == null) {
    mCustomDrawableFactories = new ArrayList<>();
  }
  mCustomDrawableFactories.add(factory);
  return this;
}
项目:fresco    文件:PipelineDraweeController.java   
/**
 * Initializes this controller with the new data source supplier, id and caller context. This
 * allows for reusing of the existing controller instead of instantiating a new one. This method
 * should be called when the controller is in detached state.
 *
 * @param dataSourceSupplier data source supplier
 * @param id unique id for this controller
 * @param callerContext tag and context for this controller
 */
public void initialize(
    Supplier<DataSource<CloseableReference<CloseableImage>>> dataSourceSupplier,
    String id,
    CacheKey cacheKey,
    Object callerContext,
    @Nullable ImmutableList<DrawableFactory> customDrawableFactories) {
  super.initialize(id, callerContext);
  init(dataSourceSupplier);
  mCacheKey = cacheKey;
  setCustomDrawableFactories(customDrawableFactories);
}
项目:fresco    文件:AnimatedFactoryV2Impl.java   
@Nullable
@Override
public DrawableFactory getAnimatedDrawableFactory(Context context) {
  if (mAnimatedDrawableFactory == null) {
    mAnimatedDrawableFactory = createDrawableFactory();
  }
  return mAnimatedDrawableFactory;
}
项目:GitHub    文件:PipelineDraweeControllerBuilder.java   
public PipelineDraweeControllerBuilder setCustomDrawableFactories(
    @Nullable ImmutableList<DrawableFactory> customDrawableFactories) {
  mCustomDrawableFactories = customDrawableFactories;
  return getThis();
}
项目:GitHub    文件:PipelineDraweeControllerBuilder.java   
public PipelineDraweeControllerBuilder setCustomDrawableFactories(
    DrawableFactory... drawableFactories) {
  Preconditions.checkNotNull(drawableFactories);
  return setCustomDrawableFactories(ImmutableList.of(drawableFactories));
}
项目:GitHub    文件:PipelineDraweeControllerBuilder.java   
public PipelineDraweeControllerBuilder setCustomDrawableFactory(DrawableFactory drawableFactory) {
  Preconditions.checkNotNull(drawableFactory);
  return setCustomDrawableFactories(ImmutableList.of(drawableFactory));
}
项目:GitHub    文件:DraweeConfig.java   
@Nullable
public ImmutableList<DrawableFactory> getCustomDrawableFactories() {
  return mCustomDrawableFactories;
}
项目:GitHub    文件:PipelineDraweeController.java   
public void setCustomDrawableFactories(
    @Nullable ImmutableList<DrawableFactory> customDrawableFactories) {
  mCustomDrawableFactories = customDrawableFactories;
}
项目:GitHub    文件:ImagePipelineFactory.java   
@Nullable
public DrawableFactory getAnimatedDrawableFactory(Context context) {
  AnimatedFactory animatedFactory = getAnimatedFactory();
  return animatedFactory == null ? null : animatedFactory.getAnimatedDrawableFactory(context);
}
项目:GitHub    文件:KeyframesDecoderExample.java   
public static DrawableFactory createDrawableFactory() {
  return new KeyframesDrawableFactory();
}
项目:fresco    文件:PipelineDraweeControllerBuilder.java   
public PipelineDraweeControllerBuilder setCustomDrawableFactories(
    @Nullable ImmutableList<DrawableFactory> customDrawableFactories) {
  mCustomDrawableFactories = customDrawableFactories;
  return getThis();
}
项目:fresco    文件:PipelineDraweeControllerBuilder.java   
public PipelineDraweeControllerBuilder setCustomDrawableFactories(
    DrawableFactory... drawableFactories) {
  Preconditions.checkNotNull(drawableFactories);
  return setCustomDrawableFactories(ImmutableList.of(drawableFactories));
}
项目:fresco    文件:PipelineDraweeControllerBuilder.java   
public PipelineDraweeControllerBuilder setCustomDrawableFactory(DrawableFactory drawableFactory) {
  Preconditions.checkNotNull(drawableFactory);
  return setCustomDrawableFactories(ImmutableList.of(drawableFactory));
}
项目:fresco    文件:DraweeConfig.java   
@Nullable
public ImmutableList<DrawableFactory> getCustomDrawableFactories() {
  return mCustomDrawableFactories;
}
项目:fresco    文件:PipelineDraweeController.java   
public void setCustomDrawableFactories(
    @Nullable ImmutableList<DrawableFactory> customDrawableFactories) {
  mCustomDrawableFactories = customDrawableFactories;
}
项目:fresco    文件:ImagePipelineFactory.java   
@Nullable
public DrawableFactory getAnimatedDrawableFactory(Context context) {
  AnimatedFactory animatedFactory = getAnimatedFactory();
  return animatedFactory == null ? null : animatedFactory.getAnimatedDrawableFactory(context);
}
项目:fresco    文件:KeyframesDecoderExample.java   
public static DrawableFactory createDrawableFactory() {
  return new KeyframesDrawableFactory();
}
项目:GitHub    文件:AnimatedFactory.java   
@Nullable DrawableFactory getAnimatedDrawableFactory(Context context);
项目:fresco    文件:AnimatedFactory.java   
@Nullable DrawableFactory getAnimatedDrawableFactory(Context context);