Search in sources :

Example 1 with RequestListener

use of com.facebook.imagepipeline.listener.RequestListener 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 2 with RequestListener

use of com.facebook.imagepipeline.listener.RequestListener in project fresco by facebook.

the class ImagePipeline method submitFetchRequest.

private <T> DataSource<CloseableReference<T>> submitFetchRequest(Producer<CloseableReference<T>> producerSequence, ImageRequest imageRequest, ImageRequest.RequestLevel lowestPermittedRequestLevelOnSubmit, Object callerContext) {
    final RequestListener requestListener = getRequestListenerForRequest(imageRequest);
    try {
        ImageRequest.RequestLevel lowestPermittedRequestLevel = ImageRequest.RequestLevel.getMax(imageRequest.getLowestPermittedRequestLevel(), lowestPermittedRequestLevelOnSubmit);
        SettableProducerContext settableProducerContext = new SettableProducerContext(imageRequest, generateUniqueFutureId(), requestListener, callerContext, lowestPermittedRequestLevel, /* isPrefetch */
        false, imageRequest.getProgressiveRenderingEnabled() || imageRequest.getMediaVariations() != null || !UriUtil.isNetworkUri(imageRequest.getSourceUri()), imageRequest.getPriority());
        return CloseableProducerToDataSourceAdapter.create(producerSequence, settableProducerContext, requestListener);
    } catch (Exception exception) {
        return DataSources.immediateFailedDataSource(exception);
    }
}
Also used : ForwardingRequestListener(com.facebook.imagepipeline.listener.ForwardingRequestListener) RequestListener(com.facebook.imagepipeline.listener.RequestListener) SettableProducerContext(com.facebook.imagepipeline.producers.SettableProducerContext) ImageRequest(com.facebook.imagepipeline.request.ImageRequest) CancellationException(java.util.concurrent.CancellationException)

Example 3 with RequestListener

use of com.facebook.imagepipeline.listener.RequestListener in project fresco by facebook.

the class ShowcaseApplication method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    FLog.setMinimumLoggingLevel(FLog.VERBOSE);
    Set<RequestListener> listeners = new HashSet<>();
    listeners.add(new RequestLoggingListener());
    ImagePipelineConfig imagePipelineConfig = ImagePipelineConfig.newBuilder(this).setRequestListeners(listeners).setImageDecoderConfig(CustomImageFormatConfigurator.createImageDecoderConfig(this)).experiment().setMediaVariationsIndexEnabled(new Supplier<Boolean>() {

        @Override
        public Boolean get() {
            return true;
        }
    }).experiment().setMediaIdExtractor(new ShowcaseMediaIdExtractor()).build();
    DraweeConfig.Builder draweeConfigBuilder = DraweeConfig.newBuilder();
    CustomImageFormatConfigurator.addCustomDrawableFactories(this, draweeConfigBuilder);
    draweeConfigBuilder.setDebugOverlayEnabledSupplier(DebugOverlaySupplierSingleton.getInstance(getApplicationContext()));
    Fresco.initialize(this, imagePipelineConfig, draweeConfigBuilder.build());
}
Also used : RequestListener(com.facebook.imagepipeline.listener.RequestListener) ShowcaseMediaIdExtractor(com.facebook.fresco.samples.showcase.imagepipeline.ShowcaseMediaIdExtractor) ImagePipelineConfig(com.facebook.imagepipeline.core.ImagePipelineConfig) RequestLoggingListener(com.facebook.imagepipeline.listener.RequestLoggingListener) Supplier(com.facebook.common.internal.Supplier) DraweeConfig(com.facebook.drawee.backends.pipeline.DraweeConfig) HashSet(java.util.HashSet)

Example 4 with RequestListener

use of com.facebook.imagepipeline.listener.RequestListener in project fresco by facebook.

the class TransitionsApplication 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 5 with RequestListener

use of com.facebook.imagepipeline.listener.RequestListener in project fresco by facebook.

the class UriApplication 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)

Aggregations

RequestListener (com.facebook.imagepipeline.listener.RequestListener)11 RequestLoggingListener (com.facebook.imagepipeline.listener.RequestLoggingListener)8 HashSet (java.util.HashSet)8 ImagePipelineConfig (com.facebook.imagepipeline.core.ImagePipelineConfig)7 DraweeConfig (com.facebook.drawee.backends.pipeline.DraweeConfig)2 ForwardingRequestListener (com.facebook.imagepipeline.listener.ForwardingRequestListener)2 SettableProducerContext (com.facebook.imagepipeline.producers.SettableProducerContext)2 ImageRequest (com.facebook.imagepipeline.request.ImageRequest)2 CancellationException (java.util.concurrent.CancellationException)2 Supplier (com.facebook.common.internal.Supplier)1 CloseableReference (com.facebook.common.references.CloseableReference)1 ShowcaseMediaIdExtractor (com.facebook.fresco.samples.showcase.imagepipeline.ShowcaseMediaIdExtractor)1 Test (org.junit.Test)1