use of com.facebook.imagepipeline.producers.SettableProducerContext 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);
}
}
use of com.facebook.imagepipeline.producers.SettableProducerContext in project fresco by facebook.
the class ImagePipeline method submitPrefetchRequest.
private DataSource<Void> submitPrefetchRequest(Producer<Void> producerSequence, ImageRequest imageRequest, ImageRequest.RequestLevel lowestPermittedRequestLevelOnSubmit, Object callerContext, Priority priority) {
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 */
true, /* isIntermediateResultExpected */
false, priority);
return ProducerToDataSourceAdapter.create(producerSequence, settableProducerContext, requestListener);
} catch (Exception exception) {
return DataSources.immediateFailedDataSource(exception);
}
}
Aggregations