Search in sources :

Example 1 with DraweeConfig

use of com.facebook.drawee.backends.pipeline.DraweeConfig in project fresco by facebook.

the class DemoApplication 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();
    DraweeConfig draweeConfig = DraweeConfig.newBuilder().setDrawDebugOverlay(DebugOverlayHelper.isDebugOverlayEnabled(this)).build();
    Fresco.initialize(this, config, draweeConfig);
}
Also used : RequestListener(com.facebook.imagepipeline.listener.RequestListener) ImagePipelineConfig(com.facebook.imagepipeline.core.ImagePipelineConfig) RequestLoggingListener(com.facebook.imagepipeline.listener.RequestLoggingListener) DraweeConfig(com.facebook.drawee.backends.pipeline.DraweeConfig) HashSet(java.util.HashSet)

Example 2 with DraweeConfig

use of com.facebook.drawee.backends.pipeline.DraweeConfig in project fresco by facebook.

the class ScrollPerfApplication method onCreate.

@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();
    if (BuildConfig.FLAVOR == "noNativeCode") {
        imagePipelineConfigBuilder.setMemoryChunkType(MemoryChunkType.BUFFER_MEMORY);
        Fresco.initialize(this, imagePipelineConfigBuilder.build(), draweeConfig, false);
    } else {
        Fresco.initialize(this, imagePipelineConfigBuilder.build(), draweeConfig, true);
    }
}
Also used : Config(com.facebook.samples.scrollperf.conf.Config) DraweeConfig(com.facebook.drawee.backends.pipeline.DraweeConfig) ImagePipelineConfig(com.facebook.imagepipeline.core.ImagePipelineConfig) ImagePipelineConfig(com.facebook.imagepipeline.core.ImagePipelineConfig) DefaultExecutorSupplier(com.facebook.imagepipeline.core.DefaultExecutorSupplier) ScrollPerfExecutorSupplier(com.facebook.samples.scrollperf.internal.ScrollPerfExecutorSupplier) DraweeConfig(com.facebook.drawee.backends.pipeline.DraweeConfig)

Aggregations

DraweeConfig (com.facebook.drawee.backends.pipeline.DraweeConfig)2 ImagePipelineConfig (com.facebook.imagepipeline.core.ImagePipelineConfig)2 DefaultExecutorSupplier (com.facebook.imagepipeline.core.DefaultExecutorSupplier)1 RequestListener (com.facebook.imagepipeline.listener.RequestListener)1 RequestLoggingListener (com.facebook.imagepipeline.listener.RequestLoggingListener)1 Config (com.facebook.samples.scrollperf.conf.Config)1 ScrollPerfExecutorSupplier (com.facebook.samples.scrollperf.internal.ScrollPerfExecutorSupplier)1 HashSet (java.util.HashSet)1