當前位置: 首頁>>代碼示例>>Java>>正文


Java ImagePipelineConfig.Builder方法代碼示例

本文整理匯總了Java中com.facebook.imagepipeline.core.ImagePipelineConfig.Builder方法的典型用法代碼示例。如果您正苦於以下問題:Java ImagePipelineConfig.Builder方法的具體用法?Java ImagePipelineConfig.Builder怎麽用?Java ImagePipelineConfig.Builder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.facebook.imagepipeline.core.ImagePipelineConfig的用法示例。


在下文中一共展示了ImagePipelineConfig.Builder方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import com.facebook.imagepipeline.core.ImagePipelineConfig; //導入方法依賴的package包/類
private void init(Context context) {
    ImagePipelineConfig.Builder builder = ImagePipelineConfig.newBuilder(context)
            .setDownsampleEnabled(true);
    String cache = BoxingFileHelper.getCacheDir(context);

    if (TextUtils.isEmpty(cache)) {
        throw new IllegalStateException("the cache dir is null");
    }
    if (cache != null) {
        DiskCacheConfig diskCacheConfig = DiskCacheConfig.newBuilder(context)
                .setBaseDirectoryPath(new File(cache))
                .setBaseDirectoryName(IMAGE_PIPELINE_CACHE_DIR)
                .setMaxCacheSize(MAX_DISK_CACHE_SIZE)
                .setMaxCacheSizeOnLowDiskSpace(MAX_DISK_CACHE_LOW_SIZE)
                .setMaxCacheSizeOnVeryLowDiskSpace(MAX_DISK_CACHE_VERYLOW_SIZE)
                .build();
        builder.setMainDiskCacheConfig(diskCacheConfig);
    }
    ImagePipelineConfig config = builder.build();
    Fresco.initialize(context, config);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:22,代碼來源:BoxingFrescoLoader.java

示例2: onCreate

import com.facebook.imagepipeline.core.ImagePipelineConfig; //導入方法依賴的package包/類
@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);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:24,代碼來源:ScrollPerfApplication.java

示例3: getDefaultConfigBuilder

import com.facebook.imagepipeline.core.ImagePipelineConfig; //導入方法依賴的package包/類
/**
 * Get the default Fresco configuration builder.
 * Allows adding of configuration options in addition to the default values.
 *
 * @return {@link ImagePipelineConfig.Builder} that has been initialized with default values
 */
public static ImagePipelineConfig.Builder getDefaultConfigBuilder(ReactContext context) {
  HashSet<RequestListener> requestListeners = new HashSet<>();
  requestListeners.add(new SystraceRequestListener());

  OkHttpClient client = OkHttpClientProvider.createClient();

  // make sure to forward cookies for any requests via the okHttpClient
  // so that image requests to endpoints that use cookies still work
  CookieJarContainer container = (CookieJarContainer) client.cookieJar();
  ForwardingCookieHandler handler = new ForwardingCookieHandler(context);
  container.setCookieJar(new JavaNetCookieJar(handler));

  return OkHttpImagePipelineConfigFactory
    .newBuilder(context.getApplicationContext(), client)
    .setNetworkFetcher(new ReactOkHttpNetworkFetcher(client))
    .setDownsampleEnabled(false)
    .setRequestListeners(requestListeners);
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:25,代碼來源:FrescoModule.java

示例4: configureCaches

import com.facebook.imagepipeline.core.ImagePipelineConfig; //導入方法依賴的package包/類
/**
 * Configures disk and memory cache not to exceed common limits
 */
private static void configureCaches(ImagePipelineConfig.Builder configBuilder, Context context) {
    final MemoryCacheParams bitmapCacheParams = new MemoryCacheParams(
            MAX_MEMORY_CACHE_SIZE, // Max total size of elements in the cache
            Integer.MAX_VALUE,                     // Max entries in the cache
            MAX_MEMORY_CACHE_SIZE, // Max total size of elements in eviction queue
            Integer.MAX_VALUE,                     // Max length of eviction queue
            Integer.MAX_VALUE);                    // Max cache entry size
    configBuilder
            .setBitmapMemoryCacheParamsSupplier(
                    new Supplier<MemoryCacheParams>() {
                        public MemoryCacheParams get() {
                            return bitmapCacheParams;
                        }
                    })
            .setMainDiskCacheConfig(DiskCacheConfig.newBuilder(context)
                    .setBaseDirectoryPath(getExternalCacheDir(context))
                    .setBaseDirectoryName(IMAGE_PIPELINE_CACHE_DIR)
                    .setMaxCacheSize(MAX_DISK_CACHE_SIZE)
                    .build());
}
 
開發者ID:lennyup,項目名稱:react-native-udesk,代碼行數:24,代碼來源:ImagePipelineConfigFactory.java

示例5: configureCaches

import com.facebook.imagepipeline.core.ImagePipelineConfig; //導入方法依賴的package包/類
/**
 * Configures disk and memory cache not to exceed common limits
 */
private static void configureCaches(
    ImagePipelineConfig.Builder configBuilder,
    Context context) {
  final MemoryCacheParams bitmapCacheParams = new MemoryCacheParams(
      MAX_MEMORY_CACHE_SIZE, // Max total size of elements in the cache
      Integer.MAX_VALUE,                     // Max entries in the cache
      MAX_MEMORY_CACHE_SIZE, // Max total size of elements in eviction queue
      Integer.MAX_VALUE,                     // Max length of eviction queue
      Integer.MAX_VALUE);                    // Max cache entry size
  configBuilder
      .setBitmapMemoryCacheParamsSupplier(
          new Supplier<MemoryCacheParams>() {
            public MemoryCacheParams get() {
              return bitmapCacheParams;
            }
          })
      .setMainDiskCacheConfig(
          DiskCacheConfig.newBuilder(context)
                  .setBaseDirectoryPath(context.getApplicationContext().getCacheDir())
              .setBaseDirectoryName(IMAGE_PIPELINE_CACHE_DIR)
              .setMaxCacheSize(MAX_DISK_CACHE_SIZE)
              .build());
}
 
開發者ID:ebridfighter,項目名稱:GongXianSheng,代碼行數:27,代碼來源:ImagePipelineConfigFactory.java

示例6: getDefaultConfig

import com.facebook.imagepipeline.core.ImagePipelineConfig; //導入方法依賴的package包/類
private static ImagePipelineConfig getDefaultConfig(
    Context context,
    @Nullable RequestListener listener,
    @Nullable DiskCacheConfig diskCacheConfig) {
  HashSet<RequestListener> requestListeners = new HashSet<>();
  requestListeners.add(new SystraceRequestListener());
  if (listener != null) {
    requestListeners.add(listener);
  }

  OkHttpClient okHttpClient = OkHttpClientProvider.getOkHttpClient();
  ImagePipelineConfig.Builder builder =
      OkHttpImagePipelineConfigFactory.newBuilder(context.getApplicationContext(), okHttpClient);

  builder
      .setDownsampleEnabled(false)
      .setRequestListeners(requestListeners);

  if (diskCacheConfig != null) {
    builder.setMainDiskCacheConfig(diskCacheConfig);
  }

  return builder.build();
}
 
開發者ID:john1jan,項目名稱:ReactNativeSignatureExample,代碼行數:25,代碼來源:FrescoModule.java

示例7: configureCaches

import com.facebook.imagepipeline.core.ImagePipelineConfig; //導入方法依賴的package包/類
/**
 * Configures disk and memory cache not to exceed common limits
 */
private static void configureCaches(ImagePipelineConfig.Builder configBuilder, Context context) {
    final MemoryCacheParams bitmapCacheParams = new MemoryCacheParams(
            MAX_MEMORY_CACHE_SIZE, // Max total size of elements in the cache
            Integer.MAX_VALUE,     // Max entries in the cache
            MAX_MEMORY_CACHE_SIZE, // Max total size of elements in eviction queue
            Integer.MAX_VALUE,     // Max length of eviction queue
            Integer.MAX_VALUE);    // Max cache entry size
    configBuilder
            .setBitmapMemoryCacheParamsSupplier(
                    new Supplier<MemoryCacheParams>() {
                        public MemoryCacheParams get() {
                            return bitmapCacheParams;
                        }
                    })
            .setMainDiskCacheConfig(DiskCacheConfig.newBuilder(context)
                    .setBaseDirectoryPath(getExternalCacheDir(context))
                    .setBaseDirectoryName(IMAGE_PIPELINE_CACHE_DIR)
                    .setMaxCacheSize(MAX_DISK_CACHE_SIZE)
                    .build());
}
 
開發者ID:LegendKe,項目名稱:MyTravelingDiary,代碼行數:24,代碼來源:ImagePipelineConfigFactory.java

示例8: onCreate

import com.facebook.imagepipeline.core.ImagePipelineConfig; //導入方法依賴的package包/類
@Override
public void onCreate() {
    super.onCreate();

    OkHttpClient okHttpClient = new OkHttpClient();

    File sd = Environment.getExternalStorageDirectory();
    String image = sd.getPath() + "/imageLoad";
    //配置圖片緩存目錄
    File cacheDir = new File(image);
    if (!cacheDir.exists()) {
        Log.i("App", "path:" + cacheDir.getAbsolutePath());
    }
    //初始化Fresco,使用OkHttp3作為網絡請求
    ImagePipelineConfig.Builder configBuilder = FrescoConfig
            .getConfigBuilder(getApplicationContext(), cacheDir, okHttpClient);
    Fresco.initialize(this, configBuilder.build());
}
 
開發者ID:imliujun,項目名稱:FrescoCustomCacheKey,代碼行數:19,代碼來源:App.java

示例9: getConfigureCaches

import com.facebook.imagepipeline.core.ImagePipelineConfig; //導入方法依賴的package包/類
private ImagePipelineConfig getConfigureCaches(Context context) {
    final MemoryCacheParams bitmapCacheParams = new MemoryCacheParams(
            MAX_MEM,// 內存緩存中總圖片的最大大小,以字節為單位。
            Integer.MAX_VALUE,// 內存緩存中圖片的最大數量。
            MAX_MEM,// 內存緩存中準備清除但尚未被刪除的總圖片的最大大小,以字節為單位。
            Integer.MAX_VALUE,// 內存緩存中準備清除的總圖片的最大數量。
            Integer.MAX_VALUE / 10);// 內存緩存中單個圖片的最大大小。

    Supplier<MemoryCacheParams> mSupplierMemoryCacheParams = new Supplier<MemoryCacheParams>() {
        @Override
        public MemoryCacheParams get() {
            return bitmapCacheParams;
        }
    };
    ImagePipelineConfig.Builder builder = ImagePipelineConfig.newBuilder(context)
            .setDownsampleEnabled(true);
    builder.setBitmapMemoryCacheParamsSupplier(mSupplierMemoryCacheParams);
    return builder.build();
}
 
開發者ID:Limuyang1013,項目名稱:ImitateNetEasyCloud,代碼行數:20,代碼來源:NetEasyApplication.java

示例10: onCreate

import com.facebook.imagepipeline.core.ImagePipelineConfig; //導入方法依賴的package包/類
@Override
public void onCreate() {
    super.onCreate();

    init();

    //初始化KLog
    KLog.init(BuildConfig.LOG_DEBUG);
    // fresco圖片庫的初始化
    ImagePipelineConfig.Builder configBuilder = ImagePipelineConfig.newBuilder(this);
    ImagePipelineConfig imagePipelineConfig = configBuilder.build();
    Fresco.initialize(this, imagePipelineConfig);

    /**
     * 如果存在SD卡則將緩存寫入SD卡,否則寫入手機內存
     */
    if (getApplicationContext().getExternalCacheDir() != null && ExistSDCard()) {
        cacheDir = getApplicationContext().getExternalCacheDir().toString();
    } else {
        cacheDir = getApplicationContext().getCacheDir().toString();
    }
}
 
開發者ID:ydmmocoo,項目名稱:StudyApp,代碼行數:23,代碼來源:App.java

示例11: configureCaches

import com.facebook.imagepipeline.core.ImagePipelineConfig; //導入方法依賴的package包/類
/**
 * Configures disk and memory cache not to exceed common limits
 */
private static void configureCaches(
    ImagePipelineConfig.Builder configBuilder,
    Context context) {
  final MemoryCacheParams bitmapCacheParams = new MemoryCacheParams(
      MAX_MEMORY_CACHE_SIZE, // Max total size of elements in the cache
      Integer.MAX_VALUE,                     // Max entries in the cache
      MAX_MEMORY_CACHE_SIZE, // Max total size of elements in eviction queue
      Integer.MAX_VALUE,                     // Max length of eviction queue
      Integer.MAX_VALUE);                    // Max cache entry size
  configBuilder
      .setBitmapMemoryCacheParamsSupplier(
          new Supplier<MemoryCacheParams>() {
            public MemoryCacheParams get() {
              return bitmapCacheParams;
            }
          })
      .setMainDiskCacheConfig(
          DiskCacheConfig.newBuilder(context)
              .setBaseDirectoryPath(context.getApplicationContext().getCacheDir())
              .setBaseDirectoryName(IMAGE_PIPELINE_CACHE_DIR)
              .setMaxCacheSize(MAX_DISK_CACHE_SIZE)
              .build());
}
 
開發者ID:jiang111,項目名稱:ZhiHu-TopAnswer,代碼行數:27,代碼來源:ImagePipelineConfigFactory.java

示例12: configureCaches

import com.facebook.imagepipeline.core.ImagePipelineConfig; //導入方法依賴的package包/類
/**
 * Configures disk and memory cache not to exceed common limits
 */
private static void configureCaches(
        ImagePipelineConfig.Builder configBuilder,
        Context context) {
    FileUtils.createDirs(ConfigConstants.IMAGE_PIPELINE_CACHE_DIR);
    final MemoryCacheParams bitmapCacheParams = new MemoryCacheParams(
            ConfigConstants.MAX_MEMORY_CACHE_SIZE, // Max total size of elements in the cache
            Integer.MAX_VALUE,                     // Max entries in the cache
            ConfigConstants.MAX_MEMORY_CACHE_SIZE, // Max total size of elements in eviction queue
            Integer.MAX_VALUE,                     // Max length of eviction queue
            Integer.MAX_VALUE);                    // Max cache entry size
    configBuilder
            .setBitmapMemoryCacheParamsSupplier(
                    new Supplier<MemoryCacheParams>() {
                        public MemoryCacheParams get() {
                            return bitmapCacheParams;
                        }
                    })
            .setMainDiskCacheConfig(
                    DiskCacheConfig.newBuilder(context)
                            .setBaseDirectoryPath(FileUtils.createDirs(ConfigConstants.IMAGE_PIPELINE_BASE_DIR))
                            .setBaseDirectoryName(ConfigConstants.IMAGE_PIPELINE_CACHE_DIR)
                            .setMaxCacheSize(ConfigConstants.MAX_DISK_CACHE_SIZE)
                            .build());
}
 
開發者ID:sungerk,項目名稱:meiShi,代碼行數:28,代碼來源:ImagePipelineConfigFactory.java

示例13: configureCaches

import com.facebook.imagepipeline.core.ImagePipelineConfig; //導入方法依賴的package包/類
/**
 * Configures disk and memory cache not to exceed common limits
 */
private static void configureCaches(ImagePipelineConfig.Builder configBuilder, Context context) {
    final MemoryCacheParams bitmapCacheParams = new MemoryCacheParams(
            MAX_MEMORY_CACHE_SIZE, // Max total size of elements in the cache
            Integer.MAX_VALUE,                     // Max entries in the cache
            MAX_MEMORY_CACHE_SIZE, // Max total size of elements in eviction queue
            Integer.MAX_VALUE,                     // Max length of eviction queue
            Integer.MAX_VALUE);                    // Max cache entry size
    configBuilder
            .setBitmapMemoryCacheParamsSupplier(
                    new Supplier<MemoryCacheParams>() {
                        public MemoryCacheParams get() {
                            return bitmapCacheParams;
                        }
                    })
            .setMainDiskCacheConfig(DiskCacheConfig.newBuilder()
                            .setBaseDirectoryPath(getExternalCacheDir(context))
                            .setBaseDirectoryName(IMAGE_PIPELINE_CACHE_DIR)
                            .setMaxCacheSize(MAX_DISK_CACHE_SIZE)
                            .build());
}
 
開發者ID:haoyunbang,項目名稱:HaoCommon,代碼行數:24,代碼來源:ImagePipelineConfigFactory.java

示例14: configureCaches

import com.facebook.imagepipeline.core.ImagePipelineConfig; //導入方法依賴的package包/類
/**
 * Configures disk and memory cache not to exceed common limits
 */
private static void configureCaches(
    ImagePipelineConfig.Builder configBuilder,
    Context context) {
  final MemoryCacheParams bitmapCacheParams = new MemoryCacheParams(
      ConfigConstants.MAX_MEMORY_CACHE_SIZE, // Max total size of elements in the cache
      Integer.MAX_VALUE,                     // Max entries in the cache
      ConfigConstants.MAX_MEMORY_CACHE_SIZE, // Max total size of elements in eviction queue
      Integer.MAX_VALUE,                     // Max length of eviction queue
      Integer.MAX_VALUE);                    // Max cache entry size
  configBuilder
      .setBitmapMemoryCacheParamsSupplier(
          new Supplier<MemoryCacheParams>() {
            public MemoryCacheParams get() {
              return bitmapCacheParams;
            }
          })
      .setMainDiskCacheConfig(
          DiskCacheConfig.newBuilder(context)
              .setBaseDirectoryPath(context.getApplicationContext().getCacheDir())
              .setBaseDirectoryName(IMAGE_PIPELINE_CACHE_DIR)
              .setMaxCacheSize(ConfigConstants.MAX_DISK_CACHE_SIZE)
              .build());
}
 
開發者ID:facebook,項目名稱:fresco,代碼行數:27,代碼來源:ImagePipelineConfigFactory.java

示例15: setUp

import com.facebook.imagepipeline.core.ImagePipelineConfig; //導入方法依賴的package包/類
@Override
@Before
public void setUp() {
  mInstrumentation = InstrumentationRegistry.getInstrumentation();
  mWebpBitmapFactory = new WebpBitmapFactoryImpl();
  ImagePipelineConfig.Builder configBuilder =
      ImagePipelineConfig.newBuilder(mInstrumentation.getContext())
          .experiment().setWebpBitmapFactory(mWebpBitmapFactory);
  ImagePipelineFactory.initialize(configBuilder.build());
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:11,代碼來源:WebpBitmapFactoryTest.java


注:本文中的com.facebook.imagepipeline.core.ImagePipelineConfig.Builder方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。