Search in sources :

Example 1 with VitoImageSource

use of com.facebook.fresco.vito.core.impl.source.VitoImageSource in project fresco by facebook.

the class VitoImagePipelineImpl method fetchDecodedImage.

@Override
public DataSource<CloseableReference<CloseableImage>> fetchDecodedImage(final VitoImageRequest imageRequest, @Nullable final Object callerContext, @Nullable final RequestListener requestListener, final long uiComponentId) {
    if (!(imageRequest.imageSource instanceof VitoImageSource)) {
        return DataSources.immediateFailedDataSource(new IllegalArgumentException("Unknown ImageSource " + imageRequest.imageSource));
    }
    VitoImageSource vitoImageSource = (VitoImageSource) imageRequest.imageSource;
    final String stringId = VitoUtils.getStringId(uiComponentId);
    return vitoImageSource.createDataSourceSupplier(mImagePipeline, mImagePipelineUtils, imageRequest.imageOptions, callerContext, requestListener, stringId).get();
}
Also used : VitoImageSource(com.facebook.fresco.vito.core.impl.source.VitoImageSource)

Example 2 with VitoImageSource

use of com.facebook.fresco.vito.core.impl.source.VitoImageSource in project fresco by facebook.

the class VitoImagePipelineImpl method createImageRequest.

@Override
public VitoImageRequest createImageRequest(Resources resources, ImageSource imageSource, @Nullable ImageOptions options) {
    if (options == null) {
        options = ImageOptions.defaults();
    }
    if (!(imageSource instanceof VitoImageSource)) {
        throw new IllegalArgumentException("ImageSource not supported: " + imageSource);
    }
    VitoImageSource vitoImageSource = (VitoImageSource) imageSource;
    CacheKey finalImageCacheKey = null;
    ImageRequest finalImageRequest = vitoImageSource.maybeExtractFinalImageRequest(mImagePipelineUtils, options);
    if (finalImageRequest != null) {
        finalImageCacheKey = mImagePipeline.getCacheKey(finalImageRequest, null);
    }
    return new VitoImageRequest(resources, imageSource, options, finalImageRequest, finalImageCacheKey);
}
Also used : VitoImageRequest(com.facebook.fresco.vito.core.VitoImageRequest) VitoImageRequest(com.facebook.fresco.vito.core.VitoImageRequest) ImageRequest(com.facebook.imagepipeline.request.ImageRequest) VitoImageSource(com.facebook.fresco.vito.core.impl.source.VitoImageSource) CacheKey(com.facebook.cache.common.CacheKey)

Aggregations

VitoImageSource (com.facebook.fresco.vito.core.impl.source.VitoImageSource)2 CacheKey (com.facebook.cache.common.CacheKey)1 VitoImageRequest (com.facebook.fresco.vito.core.VitoImageRequest)1 ImageRequest (com.facebook.imagepipeline.request.ImageRequest)1