Search in sources :

Example 16 with ImagePipelineConfig

use of com.facebook.imagepipeline.core.ImagePipelineConfig in project fresco by facebook.

the class AnimationApplication method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    FLog.setMinimumLoggingLevel(FLog.VERBOSE);
    Set<RequestListener> listeners = new HashSet<>();
    listeners.add(new RequestLoggingListener());
    ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this).setRequestListeners(listeners).build();
    Fresco.initialize(this, config);
}
Also used : RequestListener(com.facebook.imagepipeline.listener.RequestListener) ImagePipelineConfig(com.facebook.imagepipeline.core.ImagePipelineConfig) RequestLoggingListener(com.facebook.imagepipeline.listener.RequestLoggingListener) HashSet(java.util.HashSet)

Example 17 with ImagePipelineConfig

use of com.facebook.imagepipeline.core.ImagePipelineConfig in project GalleryFinal by pengjianbo.

the class MainActivity method initFresco.

private void initFresco() {
    ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this).setBitmapsConfig(Bitmap.Config.ARGB_8888).build();
    Fresco.initialize(this, config);
}
Also used : ImagePipelineConfig(com.facebook.imagepipeline.core.ImagePipelineConfig)

Example 18 with ImagePipelineConfig

use of com.facebook.imagepipeline.core.ImagePipelineConfig in project ride-read-android by Ride-Read.

the class FrescoApp method configureCaches.

/**
     * 初始化配置
     */
private ImagePipelineConfig configureCaches(Context context) {
    final MemoryCacheParams bitmapCacheParams = new // 内存缓存中总图片的最大大小,以字节为单位。
    MemoryCacheParams(// 内存缓存中总图片的最大大小,以字节为单位。
    50 * ByteConstants.MB, // 内存缓存中图片的最大数量。
    500, // 内存缓存中准备清除但尚未被删除的总图片的最大大小,以字节为单位。
    50 * ByteConstants.MB, // 内存缓存中准备清除的总图片的最大数量。
    500, // 内存缓存中单个图片的最大大小。
    5 * ByteConstants.MB);
    //修改内存图片缓存数量,空间策略(这个方式有点恶心)
    //        Supplier<MemoryCacheParams> mSupplierMemoryCacheParams = new Supplier<MemoryCacheParams>() {
    //            @Override
    //            public MemoryCacheParams get() {
    //                return bitmapCacheParams;
    //            }
    //        };
    //小图片的磁盘配置
    DiskCacheConfig diskSmallCacheConfig = //缓存图片基路径
    DiskCacheConfig.newBuilder(this).setBaseDirectoryPath(new File(FRESCO_PATH)).setBaseDirectoryName(//文件夹名
    IMAGE_PIPELINE_SMALL_CACHE_DIR).setMaxCacheSize(//默认缓存的最大大小。
    MAX_SMALL_DISK_CACHE_SIZE).setMaxCacheSizeOnLowDiskSpace(//缓存的最大大小,使用设备时低磁盘空间。
    MAX_SMALL_DISK_LOW_CACHE_SIZE).setMaxCacheSizeOnVeryLowDiskSpace(//缓存的最大大小,当设备极低磁盘空间
    MAX_SMALL_DISK_VERYLOW_CACHE_SIZE).build();
    //默认图片的磁盘配置
    DiskCacheConfig diskCacheConfig = //缓存图片基路径
    DiskCacheConfig.newBuilder(this).setBaseDirectoryPath(new File(FRESCO_PATH)).setBaseDirectoryName(//文件夹名
    IMAGE_PIPELINE_CACHE_DIR).setMaxCacheSize(//默认缓存的最大大小。
    MAX_DISK_CACHE_SIZE).setMaxCacheSizeOnLowDiskSpace(//缓存的最大大小,使用设备时低磁盘空间。
    MAX_DISK_CACHE_LOW_SIZE).setMaxCacheSizeOnVeryLowDiskSpace(//缓存的最大大小,当设备极低磁盘空间
    MAX_DISK_CACHE_VERYLOW_SIZE).build();
    //缓存图片配置
    Supplier<MemoryCacheParams> bitmapCacheParamsSupplier = new Supplier<MemoryCacheParams>() {

        @Override
        public MemoryCacheParams get() {
            return bitmapCacheParams;
        }
    };
    ImagePipelineConfig.Builder configBuilder = ImagePipelineConfig.newBuilder(context).setBitmapMemoryCacheParamsSupplier(bitmapCacheParamsSupplier).setMainDiskCacheConfig(//磁盘缓存配置(总,三级缓存)
    diskCacheConfig).setSmallImageDiskCacheConfig(//磁盘缓存配置(小图片,可选~三级缓存的小图优化缓存)
    diskSmallCacheConfig);
    return configBuilder.build();
}
Also used : DiskCacheConfig(com.facebook.cache.disk.DiskCacheConfig) ImagePipelineConfig(com.facebook.imagepipeline.core.ImagePipelineConfig) MemoryCacheParams(com.facebook.imagepipeline.cache.MemoryCacheParams) Supplier(com.facebook.common.internal.Supplier) File(java.io.File)

Aggregations

ImagePipelineConfig (com.facebook.imagepipeline.core.ImagePipelineConfig)18 RequestListener (com.facebook.imagepipeline.listener.RequestListener)7 RequestLoggingListener (com.facebook.imagepipeline.listener.RequestLoggingListener)7 HashSet (java.util.HashSet)7 DiskCacheConfig (com.facebook.cache.disk.DiskCacheConfig)5 Supplier (com.facebook.common.internal.Supplier)5 MemoryCacheParams (com.facebook.imagepipeline.cache.MemoryCacheParams)4 DraweeConfig (com.facebook.drawee.backends.pipeline.DraweeConfig)3 File (java.io.File)2 AlarmManager (android.app.AlarmManager)1 PendingIntent (android.app.PendingIntent)1 Intent (android.content.Intent)1 ShowcaseMediaIdExtractor (com.facebook.fresco.samples.showcase.imagepipeline.ShowcaseMediaIdExtractor)1 StethoInterceptor (com.facebook.stetho.okhttp3.StethoInterceptor)1 AndroidMessenger (im.actor.core.AndroidMessenger)1 ApiConfiguration (im.actor.core.ApiConfiguration)1 ConfigurationBuilder (im.actor.core.ConfigurationBuilder)1 Runtime (im.actor.runtime.Runtime)1 ActorPushManager (im.actor.sdk.core.ActorPushManager)1 AndroidCallProvider (im.actor.sdk.core.AndroidCallProvider)1