예제 #1
0
 private DataSource<Void> submitPrefetchRequest(
     Producer<Void> producerSequence,
     ImageRequest imageRequest,
     ImageRequest.RequestLevel lowestPermittedRequestLevelOnSubmit,
     Object callerContext,
     Priority priority) {
   try {
     ImageRequest.RequestLevel lowestPermittedRequestLevel =
         ImageRequest.RequestLevel.getMax(
             imageRequest.getLowestPermittedRequestLevel(), lowestPermittedRequestLevelOnSubmit);
     SettableProducerContext settableProducerContext =
         new SettableProducerContext(
             imageRequest,
             generateUniqueFutureId(),
             mRequestListener,
             callerContext,
             lowestPermittedRequestLevel,
             /* isPrefetch */ true,
             /* isIntermediateResultExpected */ false,
             priority);
     return ProducerToDataSourceAdapter.create(
         producerSequence, settableProducerContext, mRequestListener);
   } catch (Exception exception) {
     return DataSources.immediateFailedDataSource(exception);
   }
 }
예제 #2
0
 private <T> DataSource<CloseableReference<T>> submitFetchRequest(
     Producer<CloseableReference<T>> producerSequence,
     ImageRequest imageRequest,
     ImageRequest.RequestLevel lowestPermittedRequestLevelOnSubmit,
     Object callerContext) {
   try {
     ImageRequest.RequestLevel lowestPermittedRequestLevel =
         ImageRequest.RequestLevel.getMax(
             imageRequest.getLowestPermittedRequestLevel(), lowestPermittedRequestLevelOnSubmit);
     SettableProducerContext settableProducerContext =
         new SettableProducerContext(
             imageRequest,
             generateUniqueFutureId(),
             mRequestListener,
             callerContext,
             lowestPermittedRequestLevel,
             /* isPrefetch */ false,
             imageRequest.getProgressiveRenderingEnabled()
                 || !UriUtil.isNetworkUri(imageRequest.getSourceUri()),
             imageRequest.getPriority());
     return CloseableProducerToDataSourceAdapter.create(
         producerSequence, settableProducerContext, mRequestListener);
   } catch (Exception exception) {
     return DataSources.immediateFailedDataSource(exception);
   }
 }