コード例 #1
0
  private void initialize(FrescoPlusConfig config) {
    final FrescoPlusConfig frescoPlusConfig;
    if (config == null) config = FrescoPlusConfig.newBuilder(mContext).build();
    frescoPlusConfig = config;

    isDebug = frescoPlusConfig.isDebug();
    logTag = frescoPlusConfig.getLogTag();

    printWDImageConfigLog(frescoPlusConfig);

    DiskCacheConfig diskCacheConfig =
        DiskCacheConfig.newBuilder()
            .setBaseDirectoryName(DefaultConfigCentre.DEFAULT_DISK_CACHE_DIR_NAME)
            .setBaseDirectoryPath(frescoPlusConfig.getDiskCacheDir())
            .setMaxCacheSize(frescoPlusConfig.getMaxDiskCacheSize() * DefaultConfigCentre.MB)
            .setMaxCacheSizeOnLowDiskSpace(DefaultConfigCentre.DEFAULT_LOW_SPACE_DISK_CACHE_SIZE)
            .setMaxCacheSizeOnVeryLowDiskSpace(
                DefaultConfigCentre.DEFAULT_VERY_LOW_SPACE_DISK_CACHE_SIZE)
            .build();

    ImagePipelineConfig pipelineConfig =
        ImagePipelineConfig.newBuilder(mContext)
            .setBitmapsConfig(frescoPlusConfig.getBitmapConfig())
            .setImageCacheStatsTracker(FrescoCacheStatsTracker.getInstance())
            .setDownsampleEnabled(true)
            .setResizeAndRotateEnabledForNetwork(true)
            .setMainDiskCacheConfig(diskCacheConfig)
            .build();

    FrescoPlusCore.init(mContext, pipelineConfig);
  }
コード例 #2
0
 /**
  * print FrescoPlusConfig log
  *
  * @param frescoPlusConfig config
  */
 private void printWDImageConfigLog(FrescoPlusConfig frescoPlusConfig) {
   if (isDebug) {
     Log.d(
         FrescoPlusInitializer.getInstance().getLogTag(),
         "FrescoPlusInitializer init...Config:"
             + "DiskCacheDir->"
             + frescoPlusConfig.getDiskCacheDir()
             + ",MaxDiskCacheSize->"
             + frescoPlusConfig.getMaxDiskCacheSize()
             + ",BitmapConfig->"
             + frescoPlusConfig.getBitmapConfig()
             + ",IsDebug->"
             + frescoPlusConfig.isDebug()
             + ",Tag->"
             + frescoPlusConfig.getLogTag());
   }
 }