com.bumptech.glide.load.ResourceDecoder Java Examples

The following examples show how to use com.bumptech.glide.load.ResourceDecoder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CacheLoader.java    From giffun with Apache License 2.0 6 votes vote down vote up
public <Z> Resource<Z> load(Key key, ResourceDecoder<File, Z> decoder, int width, int height) {
    File fromCache = diskCache.get(key);
    if (fromCache == null) {
        return null;
    }

    Resource<Z> result = null;
    try {
        result = decoder.decode(fromCache, width, height);
    } catch (IOException e) {
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "Exception decoding image from cache", e);
        }
    }
    if (result == null) {
        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "Failed to decode image from cache or not present in cache");
        }
        diskCache.delete(key);
    }
    return result;
}
 
Example #2
Source File: PaletteBitmapDecoder.java    From glide-support with The Unlicense 5 votes vote down vote up
public PaletteBitmapDecoder(
		BitmapPool bitmapPool,
		ResourceDecoder<InputStream, Bitmap> bitmapDecoder,
		ResourceDecoder<InputStream, Palette> paletteDecoder) {
	this.bitmapPool = bitmapPool;
	this.paletteDecoder = paletteDecoder;
	this.bitmapDecoder = bitmapDecoder;
}
 
Example #3
Source File: ChildLoadProvider.java    From giffun with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public ResourceDecoder<T, Z> getSourceDecoder() {
    if (sourceDecoder != null) {
        return sourceDecoder;
    } else {
        return parent.getSourceDecoder();
    }
}
 
Example #4
Source File: ChildLoadProvider.java    From giffun with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public ResourceDecoder<File, Z> getCacheDecoder() {
    if (cacheDecoder != null) {
        return cacheDecoder;
    } else {
        return parent.getCacheDecoder();
    }
}
 
Example #5
Source File: EngineKeyFactory.java    From giffun with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
public EngineKey buildKey(String id, Key signature, int width, int height, ResourceDecoder cacheDecoder,
        ResourceDecoder sourceDecoder, Transformation transformation, ResourceEncoder encoder,
        ResourceTranscoder transcoder, Encoder sourceEncoder) {
    return new EngineKey(id, signature, width, height, cacheDecoder, sourceDecoder, transformation, encoder,
            transcoder, sourceEncoder);
}
 
Example #6
Source File: EngineKey.java    From giffun with Apache License 2.0 5 votes vote down vote up
public EngineKey(String id, Key signature, int width, int height, ResourceDecoder cacheDecoder,
        ResourceDecoder decoder, Transformation transformation, ResourceEncoder encoder,
        ResourceTranscoder transcoder, Encoder sourceEncoder) {
    this.id = id;
    this.signature = signature;
    this.width = width;
    this.height = height;
    this.cacheDecoder = cacheDecoder;
    this.decoder = decoder;
    this.transformation = transformation;
    this.encoder = encoder;
    this.transcoder = transcoder;
    this.sourceEncoder = sourceEncoder;
}
 
Example #7
Source File: GifBitmapWrapperResourceDecoder.java    From giffun with Apache License 2.0 5 votes vote down vote up
GifBitmapWrapperResourceDecoder(ResourceDecoder<ImageVideoWrapper, Bitmap> bitmapDecoder,
        ResourceDecoder<InputStream, GifDrawable> gifDecoder, BitmapPool bitmapPool, ImageTypeParser parser,
        BufferedStreamFactory streamFactory) {
    this.bitmapDecoder = bitmapDecoder;
    this.gifDecoder = gifDecoder;
    this.bitmapPool = bitmapPool;
    this.parser = parser;
    this.streamFactory = streamFactory;
}
 
Example #8
Source File: PaletteCacheDecoder.java    From glide-support with The Unlicense 4 votes vote down vote up
public PaletteCacheDecoder(
		ResourceDecoder<InputStream, Palette> paletteDecoder,
		ResourceDecoder<InputStream, Bitmap> bitmapDecoder) {
	this.paletteDecoder = paletteDecoder;
	this.bitmapDecoder = bitmapDecoder;
}
 
Example #9
Source File: GifDrawableLoadProvider.java    From giffun with Apache License 2.0 4 votes vote down vote up
@Override
public ResourceDecoder<File, GifDrawable> getCacheDecoder() {
    return cacheDecoder;
}
 
Example #10
Source File: StreamAnimationDecoder.java    From APNG4Android with Apache License 2.0 4 votes vote down vote up
public StreamAnimationDecoder(ResourceDecoder<ByteBuffer, Drawable> byteBufferDecoder) {
    this.byteBufferDecoder = byteBufferDecoder;
}
 
Example #11
Source File: FixedLoadProvider.java    From giffun with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public ResourceDecoder<T, Z> getSourceDecoder() {
    return dataLoadProvider.getSourceDecoder();
}
 
Example #12
Source File: FixedLoadProvider.java    From giffun with Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public ResourceDecoder<File, Z> getCacheDecoder() {
    return dataLoadProvider.getCacheDecoder();
}
 
Example #13
Source File: EmptyDataLoadProvider.java    From giffun with Apache License 2.0 4 votes vote down vote up
@Override
public ResourceDecoder<T, Z> getSourceDecoder() {
    return null;
}
 
Example #14
Source File: EmptyDataLoadProvider.java    From giffun with Apache License 2.0 4 votes vote down vote up
@Override
public ResourceDecoder<File, Z> getCacheDecoder() {
    return null;
}
 
Example #15
Source File: GifBitmapWrapperStreamResourceDecoder.java    From giffun with Apache License 2.0 4 votes vote down vote up
public GifBitmapWrapperStreamResourceDecoder(
        ResourceDecoder<ImageVideoWrapper, GifBitmapWrapper> gifBitmapDecoder) {
    this.gifBitmapDecoder = gifBitmapDecoder;
}
 
Example #16
Source File: ImageVideoDataLoadProvider.java    From giffun with Apache License 2.0 4 votes vote down vote up
@Override
public ResourceDecoder<File, Bitmap> getCacheDecoder() {
    return cacheDecoder;
}
 
Example #17
Source File: GifDrawableLoadProvider.java    From giffun with Apache License 2.0 4 votes vote down vote up
@Override
public ResourceDecoder<InputStream, GifDrawable> getSourceDecoder() {
    return decoder;
}
 
Example #18
Source File: StreamBitmapDataLoadProvider.java    From giffun with Apache License 2.0 4 votes vote down vote up
@Override
public ResourceDecoder<File, Bitmap> getCacheDecoder() {
    return cacheDecoder;
}
 
Example #19
Source File: StreamBitmapDataLoadProvider.java    From giffun with Apache License 2.0 4 votes vote down vote up
@Override
public ResourceDecoder<InputStream, Bitmap> getSourceDecoder() {
    return decoder;
}
 
Example #20
Source File: FileDescriptorBitmapDataLoadProvider.java    From giffun with Apache License 2.0 4 votes vote down vote up
@Override
public ResourceDecoder<File, Bitmap> getCacheDecoder() {
    return cacheDecoder;
}
 
Example #21
Source File: FileDescriptorBitmapDataLoadProvider.java    From giffun with Apache License 2.0 4 votes vote down vote up
@Override
public ResourceDecoder<ParcelFileDescriptor, Bitmap> getSourceDecoder() {
    return sourceDecoder;
}
 
Example #22
Source File: ImageVideoBitmapDecoder.java    From giffun with Apache License 2.0 4 votes vote down vote up
public ImageVideoBitmapDecoder(ResourceDecoder<InputStream, Bitmap> streamDecoder,
        ResourceDecoder<ParcelFileDescriptor, Bitmap> fileDescriptorDecoder) {
    this.streamDecoder = streamDecoder;
    this.fileDescriptorDecoder = fileDescriptorDecoder;
}
 
Example #23
Source File: GifBitmapWrapperResourceDecoder.java    From giffun with Apache License 2.0 4 votes vote down vote up
public GifBitmapWrapperResourceDecoder(ResourceDecoder<ImageVideoWrapper, Bitmap> bitmapDecoder,
        ResourceDecoder<InputStream, GifDrawable> gifDecoder, BitmapPool bitmapPool) {
    this(bitmapDecoder, gifDecoder, bitmapPool, DEFAULT_PARSER, DEFAULT_STREAM_FACTORY);
}
 
Example #24
Source File: ImageVideoDataLoadProvider.java    From giffun with Apache License 2.0 4 votes vote down vote up
@Override
public ResourceDecoder<ImageVideoWrapper, Bitmap> getSourceDecoder() {
    return sourceDecoder;
}
 
Example #25
Source File: FileToStreamDecoder.java    From giffun with Apache License 2.0 4 votes vote down vote up
public FileToStreamDecoder(ResourceDecoder<InputStream, T> streamDecoder) {
    this(streamDecoder, DEFAULT_FILE_OPENER);
}
 
Example #26
Source File: FileToStreamDecoder.java    From giffun with Apache License 2.0 4 votes vote down vote up
FileToStreamDecoder(ResourceDecoder<InputStream, T> streamDecoder, FileOpener fileOpener) {
    this.streamDecoder = streamDecoder;
    this.fileOpener = fileOpener;
}
 
Example #27
Source File: StreamFileDataLoadProvider.java    From giffun with Apache License 2.0 4 votes vote down vote up
@Override
public ResourceDecoder<File, File> getCacheDecoder() {
    return cacheDecoder;
}
 
Example #28
Source File: StreamFileDataLoadProvider.java    From giffun with Apache License 2.0 4 votes vote down vote up
@Override
public ResourceDecoder<InputStream, File> getSourceDecoder() {
    return ERROR_DECODER;
}
 
Example #29
Source File: ImageVideoGifDrawableLoadProvider.java    From giffun with Apache License 2.0 4 votes vote down vote up
@Override
public ResourceDecoder<File, GifBitmapWrapper> getCacheDecoder() {
    return cacheDecoder;
}
 
Example #30
Source File: ImageVideoGifDrawableLoadProvider.java    From giffun with Apache License 2.0 4 votes vote down vote up
@Override
public ResourceDecoder<ImageVideoWrapper, GifBitmapWrapper> getSourceDecoder() {
    return sourceDecoder;
}