本文整理汇总了Java中com.facebook.imagepipeline.decoder.SimpleProgressiveJpegConfig类的典型用法代码示例。如果您正苦于以下问题:Java SimpleProgressiveJpegConfig类的具体用法?Java SimpleProgressiveJpegConfig怎么用?Java SimpleProgressiveJpegConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SimpleProgressiveJpegConfig类属于com.facebook.imagepipeline.decoder包,在下文中一共展示了SimpleProgressiveJpegConfig类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.facebook.imagepipeline.decoder.SimpleProgressiveJpegConfig; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
app = this;
// 存放所有activity的集合
mActivityList = new ArrayList<>();
// 渐进式图片
ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
.setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
.build();
Fresco.initialize(this, config);
}
示例2: onCreate
import com.facebook.imagepipeline.decoder.SimpleProgressiveJpegConfig; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
CrashReport.initCrashReport(getApplicationContext(), "e1a62089c6", false);
ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
.setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
.build();
Fresco.initialize(this, config);
SDKInitializer.initialize(this);
Bmob.initialize(this, "b0cb494256d9b86fc931ca930a055b75");
Logger.addLogAdapter(new AndroidLogAdapter(){
@Override
public boolean isLoggable(int priority, String tag) {
return true;// TODO: 2017/6/5
}
});
sInstance = this;
initUser();
}
示例3: initFrescoConfig
import com.facebook.imagepipeline.decoder.SimpleProgressiveJpegConfig; //导入依赖的package包/类
private void initFrescoConfig() {
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);
ImagePipelineConfig config = OkHttpImagePipelineConfigFactory.newBuilder(this, mOkHttpClient)
.setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
.setBitmapMemoryCacheParamsSupplier(new Supplier<MemoryCacheParams>() {
public MemoryCacheParams get() {
return bitmapCacheParams;
}
})
.setMainDiskCacheConfig(
DiskCacheConfig.newBuilder(this).setMaxCacheSize(MAX_DISK_CACHE_SIZE).build())
.setDownsampleEnabled(true)
.build();
Fresco.initialize(this, config);
}
示例4: onCreate
import com.facebook.imagepipeline.decoder.SimpleProgressiveJpegConfig; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
app = this;
// 存放所有activity的集合
mActivityList = new ArrayList<>();
// 初始化app异常处理器 - 打包的时候开启
// CrashHandler handler = CrashHandler.getInstance();
// handler.init(getApplicationContext());
// 初始化OkHttpUtils
OkHttpClient okHttpClient = new OkHttpClient.Builder()
.connectTimeout(10000L, TimeUnit.MILLISECONDS)
.readTimeout(10000L, TimeUnit.MILLISECONDS)
//其他配置
.build();
OkHttpUtils.initClient(okHttpClient);
// 初始化Fresco
ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
.setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
.build();
Fresco.initialize(this, config);
// 初始化ShareSDK
ShareSDK.initSDK(this);
// 初始化JPush
JPushInterface.setDebugMode(true);
JPushInterface.init(this);
// 更新用户登录状态
UserBean.updateUserInfoFromNetwork(new UserBean.OnUpdatedUserInfoListener());
}
示例5: onCreate
import com.facebook.imagepipeline.decoder.SimpleProgressiveJpegConfig; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
app = this;
// 存放所有activity的集合
mActivityList = new ArrayList<>();
// 渐进式图片
ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
.setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
.build();
Fresco.initialize(this, config);
// 初始化app异常处理器 - 打包的时候开启
CrashHandler handler = CrashHandler.getInstance();
handler.init(getApplicationContext());
// OkHttpClient okHttpClient = new OkHttpClient.Builder()
// .connectTimeout(10000L, TimeUnit.MILLISECONDS)
// .readTimeout(10000L, TimeUnit.MILLISECONDS)
// //其他配置
// .build();
// OkHttpUtils.initClient(okHttpClient);
// 初始化ShareSDK
ShareSDK.initSDK(this);
}
示例6: onCreate
import com.facebook.imagepipeline.decoder.SimpleProgressiveJpegConfig; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
ImagePipelineConfig imagePipelineConfig = ImagePipelineConfig.newBuilder(this)
.setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
.build();
Fresco.initialize(this, imagePipelineConfig);
}
示例7: setUp
import com.facebook.imagepipeline.decoder.SimpleProgressiveJpegConfig; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
mProgressiveJpegConfig = new SimpleProgressiveJpegConfig(
new SimpleProgressiveJpegConfig.DynamicValueConfig() {
public List<Integer> getScansToDecode() {
return Arrays.asList(PREVIEW_SCAN, GOOD_ENOUGH_SCAN);
}
public int getGoodEnoughScanNumber() {
return GOOD_ENOUGH_SCAN;
}
});
PowerMockito.mockStatic(ProgressiveJpegParser.class);
PowerMockito.whenNew(ProgressiveJpegParser.class).withAnyArguments()
.thenReturn(mProgressiveJpegParser);
PowerMockito.mockStatic(JobScheduler.class);
PowerMockito.whenNew(JobScheduler.class).withAnyArguments()
.thenReturn(mJobScheduler);
when(mExperimentalResizingEnabledSupplier.get()).thenReturn(false);
mDecodeProducer =
new DecodeProducer(
mByteArrayPool,
mExecutor,
mImageDecoder,
mProgressiveJpegConfig,
false, /* Set downsampleEnabled to false */
false, /* Set resizeAndRotateForNetwork to false */
false, /* We don't cancel when the request is cancelled */
mInputProducer,
mExperimentalResizingEnabledSupplier); /* No experimental resizing */
PooledByteBuffer pooledByteBuffer = mockPooledByteBuffer(IMAGE_SIZE);
mByteBufferRef = CloseableReference.of(pooledByteBuffer);
mEncodedImage = new EncodedImage(mByteBufferRef);
mEncodedImage.setImageFormat(DefaultImageFormats.JPEG);
mEncodedImage.setWidth(IMAGE_WIDTH);
mEncodedImage.setHeight(IMAGE_HEIGHT);
mEncodedImage.setRotationAngle(IMAGE_ROTATION_ANGLE);
mEncodedImage.setExifOrientation(IMAGE_EXIF_ORIENTATION);
}
示例8: onCreate
import com.facebook.imagepipeline.decoder.SimpleProgressiveJpegConfig; //导入依赖的package包/类
@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());
}
示例9: configureCaches
import com.facebook.imagepipeline.decoder.SimpleProgressiveJpegConfig; //导入依赖的package包/类
/**
* ImagePipeline配置
*
* @param context context
* @param okHttpClient okHttp客户端
* @return ImagePipeline配置实例
*/
private static ImagePipelineConfig configureCaches(Context context, OkHttpClient okHttpClient, String cachePath) {
//内存配置
final MemoryCacheParams bitmapCacheParams = new MemoryCacheParams(
ConfigConstants.MAX_MEMORY_CACHE_SIZE,// 内存缓存中总图片的最大大小,以字节为单位
Integer.MAX_VALUE,// 内存缓存中图片的最大数量
ConfigConstants.MAX_MEMORY_CACHE_SIZE,// 内存缓存中准备清除但尚未被删除的总图片的最大大小,以字节为单位
Integer.MAX_VALUE,// 内存缓存中准备清除的总图片的最大数量
Integer.MAX_VALUE);// 内存缓存中单个图片的最大大小
//修改内存图片缓存数量,空间策略
Supplier<MemoryCacheParams> mSupplierMemoryCacheParams = new Supplier<MemoryCacheParams>() {
@Override
public MemoryCacheParams get() {
return bitmapCacheParams;
}
};
// String cachePath = Environment.getExternalStorageDirectory().getAbsolutePath();//获得存储路径(SDcard)
String file = "fresco";
//小图片的磁盘配置
DiskCacheConfig diskSmallCacheConfig = DiskCacheConfig.newBuilder(context)
.setBaseDirectoryPath(new File(cachePath))//缓存图片基路径
.setBaseDirectoryName(ConfigConstants.IMAGE_PIPELINE_SMALL_CACHE_DIR)//文件夹名
// .setCacheErrorLogger(cacheErrorLogger)//日志记录器用于日志错误的缓存。
// .setCacheEventListener(cacheEventListener)//缓存事件侦听器。
// .setDiskTrimmableRegistry(diskTrimmableRegistry)//类将包含一个注册表的缓存减少磁盘空间的环境。
.setMaxCacheSize(ConfigConstants.MAX_DISK_CACHE_SIZE)//默认缓存的最大大小。
.setMaxCacheSizeOnLowDiskSpace(ConfigConstants.MAX_SMALL_DISK_CACHE_LOW_SIZE)//缓存的最大大小,使用设备时低磁盘空间。
.setMaxCacheSizeOnVeryLowDiskSpace(ConfigConstants.MAX_SMALL_DISK_CACHE_VERY_LOW_SIZE)//缓存的最大大小,当设备极低磁盘空间
// .setVersion(version)
.build();
//默认图片的磁盘配置
DiskCacheConfig diskCacheConfig = DiskCacheConfig.newBuilder(context)
.setBaseDirectoryPath(new File(cachePath))//缓存图片基路径
.setBaseDirectoryName(ConfigConstants.IMAGE_PIPELINE_CACHE_DIR)//文件夹名
// .setCacheErrorLogger(cacheErrorLogger)//日志记录器用于日志错误的缓存。
// .setCacheEventListener(cacheEventListener)//缓存事件侦听器。
// .setDiskTrimmableRegistry(diskTrimmableRegistry)//类将包含一个注册表的缓存减少磁盘空间的环境。
.setMaxCacheSize(ConfigConstants.MAX_DISK_CACHE_SIZE)//默认缓存的最大大小。
.setMaxCacheSizeOnLowDiskSpace(ConfigConstants.MAX_DISK_CACHE_LOW_SIZE)//缓存的最大大小,使用设备时低磁盘空间。
.setMaxCacheSizeOnVeryLowDiskSpace(ConfigConstants.MAX_DISK_CACHE_VERY_LOW_SIZE)//缓存的最大大小,当设备极低磁盘空间
// .setVersion(version)
.build();
//缓存图片配置
ImagePipelineConfig.Builder configBuilder = null;
if (okHttpClient != null)
configBuilder = OkHttpImagePipelineConfigFactory.newBuilder(context, okHttpClient);
else
configBuilder = ImagePipelineConfig.newBuilder(context);
// .setAnimatedImageFactory(AnimatedImageFactory animatedImageFactory)//图片加载动画
configBuilder.setBitmapMemoryCacheParamsSupplier(mSupplierMemoryCacheParams)//内存缓存配置(一级缓存,已解码的图片)
// .setCacheKeyFactory(cacheKeyFactory)//缓存Key工厂
// .setEncodedMemoryCacheParamsSupplier(encodedCacheParamsSupplier)//内存缓存和未解码的内存缓存的配置(二级缓存)
// .setExecutorSupplier(executorSupplier)//线程池配置
// .setImageCacheStatsTracker(imageCacheStatsTracker)//统计缓存的命中率
// .setImageDecoder(ImageDecoder imageDecoder) //图片解码器配置
// .setIsPrefetchEnabledSupplier(Supplier<Boolean> isPrefetchEnabledSupplier)//图片预览(缩略图,预加载图等)预加载到文件缓存
.setMainDiskCacheConfig(diskCacheConfig)//磁盘缓存配置(总,三级缓存)
// .setMemoryTrimmableRegistry(memoryTrimmableRegistry) //内存用量的缩减,有时我们可能会想缩小内存用量。比如应用中有其他数据需要占用内存,不得不把图片缓存清除或者减小 或者我们想检查看看手机是否已经内存不够了。
// .setNetworkFetchProducer(networkFetchProducer)//自定的网络层配置:如OkHttp,Volley
// .setPoolFactory(poolFactory)//线程池工厂配置
.setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())//渐进式JPEG图
// .setRequestListeners(requestListeners)//图片请求监听
// .setResizeAndRotateEnabledForNetwork(boolean resizeAndRotateEnabledForNetwork)//调整和旋转是否支持网络图片
.setSmallImageDiskCacheConfig(diskSmallCacheConfig);//磁盘缓存配置(小图片,可选~三级缓存的小图优化缓存)
return configBuilder.build();
}
示例10: initFresco
import com.facebook.imagepipeline.decoder.SimpleProgressiveJpegConfig; //导入依赖的package包/类
private void initFresco() {
ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this)
.setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
.build();
Fresco.initialize(this, config);
}