Java 类com.facebook.drawee.backends.pipeline.DraweeConfig 实例源码

项目:GitHub    文件:ScrollPerfApplication.java   
@Override
public void onCreate() {
  super.onCreate();
  final Config config = Config.load(this);
  ImagePipelineConfig.Builder imagePipelineConfigBuilder = ImagePipelineConfig.newBuilder(this)
      .setResizeAndRotateEnabledForNetwork(false)
      .setDownsampleEnabled(config.downsampling);
  if (WebpSupportStatus.sIsWebpSupportRequired) {
    imagePipelineConfigBuilder.experiment().setWebpSupportEnabled(config.webpSupportEnabled);
  }
  if (config.decodingThreadCount == 0) {
    imagePipelineConfigBuilder.setExecutorSupplier(
        new DefaultExecutorSupplier(Const.NUMBER_OF_PROCESSORS));
  } else {
    imagePipelineConfigBuilder.setExecutorSupplier(
        new ScrollPerfExecutorSupplier(Const.NUMBER_OF_PROCESSORS, config.decodingThreadCount));
  }
  imagePipelineConfigBuilder.experiment().setDecodeCancellationEnabled(config.decodeCancellation);
  DraweeConfig draweeConfig = DraweeConfig.newBuilder()
      .setDrawDebugOverlay(config.draweeOverlayEnabled)
      .build();
  Fresco.initialize(this, imagePipelineConfigBuilder.build(), draweeConfig);
}
项目:fresco    文件:ScrollPerfApplication.java   
@Override
public void onCreate() {
  super.onCreate();
  final Config config = Config.load(this);
  ImagePipelineConfig.Builder imagePipelineConfigBuilder = ImagePipelineConfig.newBuilder(this)
      .setResizeAndRotateEnabledForNetwork(false)
      .setDownsampleEnabled(config.downsampling);
  if (WebpSupportStatus.sIsWebpSupportRequired) {
    imagePipelineConfigBuilder.experiment().setWebpSupportEnabled(config.webpSupportEnabled);
  }
  if (config.decodingThreadCount == 0) {
    imagePipelineConfigBuilder.setExecutorSupplier(
        new DefaultExecutorSupplier(Const.NUMBER_OF_PROCESSORS));
  } else {
    imagePipelineConfigBuilder.setExecutorSupplier(
        new ScrollPerfExecutorSupplier(Const.NUMBER_OF_PROCESSORS, config.decodingThreadCount));
  }
  imagePipelineConfigBuilder.experiment().setDecodeCancellationEnabled(config.decodeCancellation);
  DraweeConfig draweeConfig = DraweeConfig.newBuilder()
      .setDrawDebugOverlay(config.draweeOverlayEnabled)
      .build();
  Fresco.initialize(this, imagePipelineConfigBuilder.build(), draweeConfig);
}
项目:GitHub    文件:CustomImageFormatConfigurator.java   
public static void addCustomDrawableFactories(
    Context context,
    DraweeConfig.Builder draweeConfigBuilder) {
  // We always add the color drawable factory so that it can be used for image decoder overrides,
  // see ImageFormatOverrideExample.
  draweeConfigBuilder.addCustomDrawableFactory(ColorImageExample.createDrawableFactory());
  if (isSvgEnabled(context)) {
    draweeConfigBuilder.addCustomDrawableFactory(new SvgDecoderExample.SvgDrawableFactory());
  }
  if (isKeyframesEnabled()) {
    draweeConfigBuilder.addCustomDrawableFactory(KeyframesDecoderExample.createDrawableFactory());
  }
}
项目:fresco    文件:CustomImageFormatConfigurator.java   
public static void addCustomDrawableFactories(
    Context context,
    DraweeConfig.Builder draweeConfigBuilder) {
  // We always add the color drawable factory so that it can be used for image decoder overrides,
  // see ImageFormatOverrideExample.
  draweeConfigBuilder.addCustomDrawableFactory(ColorImageExample.createDrawableFactory());
  if (isSvgEnabled(context)) {
    draweeConfigBuilder.addCustomDrawableFactory(new SvgDecoderExample.SvgDrawableFactory());
  }
  if (isKeyframesEnabled()) {
    draweeConfigBuilder.addCustomDrawableFactory(KeyframesDecoderExample.createDrawableFactory());
  }
}
项目:GitHub    文件:ShowcaseApplication.java   
@Override
public void onCreate() {
  super.onCreate();
  FLog.setMinimumLoggingLevel(FLog.VERBOSE);
  Set<RequestListener> listeners = new HashSet<>();
  listeners.add(new RequestLoggingListener());

  OkHttpClient okHttpClient = new OkHttpClient.Builder()
      .addNetworkInterceptor(new StethoInterceptor())
      .build();

  ImagePipelineConfig imagePipelineConfig =
      OkHttpImagePipelineConfigFactory.newBuilder(this, okHttpClient)
          .setRequestListeners(listeners)
          .setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
          .setImageDecoderConfig(CustomImageFormatConfigurator.createImageDecoderConfig(this))
          .experiment()
          .setMediaVariationsIndexEnabled(
              new Supplier<Boolean>() {
                @Override
                public Boolean get() {
                  return true;
                }
              })
          .experiment()
          .setBitmapPrepareToDraw(true, 0, Integer.MAX_VALUE, true)
          .experiment()
          .setSmartResizingEnabled(Suppliers.BOOLEAN_TRUE)
          .build();

  ImagePipelineConfig.getDefaultImageRequestConfig().setProgressiveRenderingEnabled(true);

  DraweeConfig.Builder draweeConfigBuilder = DraweeConfig.newBuilder();
  CustomImageFormatConfigurator.addCustomDrawableFactories(this, draweeConfigBuilder);

  draweeConfigBuilder.setDebugOverlayEnabledSupplier(
      DebugOverlaySupplierSingleton.getInstance(getApplicationContext()));

  Fresco.initialize(this, imagePipelineConfig, draweeConfigBuilder.build());

  final Context context = this;
  Stetho.initialize(
      Stetho.newInitializerBuilder(context)
          .enableDumpapp(
              new DumperPluginsProvider() {
                @Override
                public Iterable<DumperPlugin> get() {
                  return new Stetho.DefaultDumperPluginsBuilder(context)
                      .provide(new FrescoStethoPlugin())
                      .finish();
                }
              })
          .enableWebKitInspector(Stetho.defaultInspectorModulesProvider(context))
          .build());
}
项目:BigImageViewer    文件:FrescoImageLoader.java   
public static FrescoImageLoader with(Context appContext,
        ImagePipelineConfig imagePipelineConfig, DraweeConfig draweeConfig) {
    Fresco.initialize(appContext, imagePipelineConfig, draweeConfig);
    return new FrescoImageLoader(appContext);
}
项目:BigImageViewer-master    文件:FrescoImageLoader.java   
public static FrescoImageLoader with(Context appContext,
        ImagePipelineConfig imagePipelineConfig, DraweeConfig draweeConfig) {
    Fresco.initialize(appContext, imagePipelineConfig, draweeConfig);
    return new FrescoImageLoader(appContext);
}
项目:fresco    文件:ShowcaseApplication.java   
@Override
public void onCreate() {
  super.onCreate();
  FLog.setMinimumLoggingLevel(FLog.VERBOSE);
  Set<RequestListener> listeners = new HashSet<>();
  listeners.add(new RequestLoggingListener());

  OkHttpClient okHttpClient = new OkHttpClient.Builder()
      .addNetworkInterceptor(new StethoInterceptor())
      .build();

  ImagePipelineConfig imagePipelineConfig =
      OkHttpImagePipelineConfigFactory.newBuilder(this, okHttpClient)
          .setRequestListeners(listeners)
          .setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
          .setImageDecoderConfig(CustomImageFormatConfigurator.createImageDecoderConfig(this))
          .experiment()
          .setMediaVariationsIndexEnabled(
              new Supplier<Boolean>() {
                @Override
                public Boolean get() {
                  return true;
                }
              })
          .experiment()
          .setBitmapPrepareToDraw(true, 0, Integer.MAX_VALUE, true)
          .experiment()
          .setSmartResizingEnabled(Suppliers.BOOLEAN_TRUE)
          .build();

  ImagePipelineConfig.getDefaultImageRequestConfig().setProgressiveRenderingEnabled(true);

  DraweeConfig.Builder draweeConfigBuilder = DraweeConfig.newBuilder();
  CustomImageFormatConfigurator.addCustomDrawableFactories(this, draweeConfigBuilder);

  draweeConfigBuilder.setDebugOverlayEnabledSupplier(
      DebugOverlaySupplierSingleton.getInstance(getApplicationContext()));

  Fresco.initialize(this, imagePipelineConfig, draweeConfigBuilder.build());

  final Context context = this;
  Stetho.initialize(
      Stetho.newInitializerBuilder(context)
          .enableDumpapp(
              new DumperPluginsProvider() {
                @Override
                public Iterable<DumperPlugin> get() {
                  return new Stetho.DefaultDumperPluginsBuilder(context)
                      .provide(new FrescoStethoPlugin())
                      .finish();
                }
              })
          .enableWebKitInspector(Stetho.defaultInspectorModulesProvider(context))
          .build());
}