Java 类com.bumptech.glide.load.model.ImageVideoWrapper 实例源码

项目:GlidePlus    文件:ImageWrapperResourceDecoder.java   
private ImageWrapper decodeStream(ImageVideoWrapper source, int width, int height, byte[] bytes)
        throws IOException {
    InputStream bis = streamFactory.build(source.getStream(), bytes);
    bis.mark(MARK_LIMIT_BYTES);
    ImageHeaderParser.ImageType type = parser.parse(bis);
    bis.reset();

    ImageWrapper result = null;
    if (type == ImageHeaderParser.ImageType.GIF) {
        result = decodeGifWrapper(bis, width, height);
    }
    // Decoding the gif may fail even if the type matches.
    if (result == null) {
        // We can only reset the buffered InputStream, so to start from the beginning of the stream, we need to
        // pass in a new source containing the buffered stream rather than the original stream.
        ImageVideoWrapper forBitmapDecoder = new ImageVideoWrapper(bis, source.getFileDescriptor());
        result = decodeBitmapWrapper(forBitmapDecoder, width, height);
    }
    return result;
}
项目:saarang-iosched    文件:ImageVideoBitmapDecoder.java   
@Override
public Resource<Bitmap> decode(ImageVideoWrapper source, int width, int height) throws IOException {
    Resource<Bitmap> result = null;
    InputStream is = source.getStream();
    if (is != null) {
        try {
            result = streamDecoder.decode(source.getStream(), width, height);
        } catch (IOException e) {
            if (Log.isLoggable(TAG, Log.VERBOSE)) {
                Log.v(TAG, "Failed to load image from stream, trying FileDescriptor", e);
            }
        }
    }

    if (result == null) {
        result = fileDescriptorDecoder.decode(source.getFileDescriptor(), width, height);
    }
    return result;
}
项目:AppDevFestSudeste2015    文件:ImageVideoBitmapDecoder.java   
@Override
public Resource<Bitmap> decode(ImageVideoWrapper source, int width, int height) throws IOException {
    Resource<Bitmap> result = null;
    InputStream is = source.getStream();
    if (is != null) {
        try {
            result = streamDecoder.decode(source.getStream(), width, height);
        } catch (IOException e) {
            if (Log.isLoggable(TAG, Log.VERBOSE)) {
                Log.v(TAG, "Failed to load image from stream, trying FileDescriptor", e);
            }
        }
    }

    if (result == null) {
        result = fileDescriptorDecoder.decode(source.getFileDescriptor(), width, height);
    }
    return result;
}
项目:BioStar2Android    文件:GlidePhotoData.java   
@Override
public Resource<GifBitmapWrapper> decode(ImageVideoWrapper imageVideoWrapper, int i, int i1) throws IOException {
    InputStream inputStream = imageVideoWrapper.getStream();
    StringBuffer sb = new StringBuffer();
    byte[] b = new byte[4096];
    boolean findData = false;
    for (int n; (n = inputStream.read(b)) != -1; ) {
        String data = new String(b, 0, n);
        sb.append(data);
        if (findData == false && sb.length() > "data:image/jpeg;base64,".length()) {
            findData = true;
            int index = sb.indexOf(",");
            sb = sb.delete(0, index + 1);
        }
    }
    String result = sb.toString();
    Bitmap bmp = convertBitmap(result);
    if (bmp == null) {
        return null;
    }
    setPhotoData(bmp);
    return getGifBitmapWrapperResource();
}
项目:devfestnorte-app    文件:ImageVideoBitmapDecoder.java   
@Override
public Resource<Bitmap> decode(ImageVideoWrapper source, int width, int height) throws IOException {
    Resource<Bitmap> result = null;
    InputStream is = source.getStream();
    if (is != null) {
        try {
            result = streamDecoder.decode(source.getStream(), width, height);
        } catch (IOException e) {
            if (Log.isLoggable(TAG, Log.VERBOSE)) {
                Log.v(TAG, "Failed to load image from stream, trying FileDescriptor", e);
            }
        }
    }

    if (result == null) {
        result = fileDescriptorDecoder.decode(source.getFileDescriptor(), width, height);
    }
    return result;
}
项目:saarang-iosched    文件:ImageVideoBitmapDecoder.java   
@Override
public Resource<Bitmap> decode(ImageVideoWrapper source, int width, int height) throws IOException {
    Resource<Bitmap> result = null;
    InputStream is = source.getStream();
    if (is != null) {
        try {
            result = streamDecoder.decode(source.getStream(), width, height);
        } catch (IOException e) {
            if (Log.isLoggable(TAG, Log.VERBOSE)) {
                Log.v(TAG, "Failed to load image from stream, trying FileDescriptor", e);
            }
        }
    }

    if (result == null) {
        result = fileDescriptorDecoder.decode(source.getFileDescriptor(), width, height);
    }
    return result;
}
项目:GlidePlus    文件:ImageWrapperResourceDecoder.java   
ImageWrapperResourceDecoder(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;
}
项目:GlidePlus    文件:ImageWrapperResourceDecoder.java   
@SuppressWarnings("resource")
// @see ResourceDecoder.decode
@Override
public Resource<ImageWrapper> decode(ImageVideoWrapper source, int width, int height) throws IOException {
    ByteArrayPool pool = ByteArrayPool.get();
    byte[] tempBytes = pool.getBytes();

    ImageWrapper wrapper = null;
    try {
        wrapper = decode(source, width, height, tempBytes);
    } finally {
        pool.releaseBytes(tempBytes);
    }
    return wrapper != null ? new ImageWrapperResource(wrapper) : null;
}
项目:GlidePlus    文件:ImageWrapperResourceDecoder.java   
private ImageWrapper decode(ImageVideoWrapper source, int width, int height, byte[] bytes) throws IOException {
    final ImageWrapper result;
    if (source.getStream() != null) {
        result = decodeStream(source, width, height, bytes);
    } else {
        result = decodeBitmapWrapper(source, width, height);
    }
    return result;
}
项目:GlidePlus    文件:ImageWrapperResourceDecoder.java   
private ImageWrapper decodeBitmapWrapper(ImageVideoWrapper toDecode, int width, int height) throws IOException {
    ImageWrapper result = null;

    Resource<Bitmap> bitmapResource = bitmapDecoder.decode(toDecode, width, height);
    if (bitmapResource != null) {
        result = new ImageWrapper(bitmapResource, null);
    }

    return result;
}
项目:glide-support    文件:RegionImageVideoDecoder.java   
@Override protected BitmapRegionDecoder createDecoder(ImageVideoWrapper source, int width, int height)
        throws IOException {
    BitmapRegionDecoder decoder;
    try {
        decoder = BitmapRegionDecoder.newInstance(source.getStream(), false);
    } catch (Exception ex) {
        decoder = BitmapRegionDecoder.newInstance(source.getFileDescriptor().getFileDescriptor(), false);
    }
    return decoder;
}
项目:saarang-iosched    文件:Glide.java   
Glide(Engine engine, RequestQueue requestQueue, MemoryCache memoryCache, BitmapPool bitmapPool,
        Context context) {
    this.engine = engine;
    this.requestQueue = requestQueue;
    this.bitmapPool = bitmapPool;
    this.memoryCache = memoryCache;

    dataLoadProviderFactory = new DataLoadProviderFactory();
    dataLoadProviderFactory.register(InputStream.class, Bitmap.class, new StreamBitmapDataLoadProvider(bitmapPool));

    dataLoadProviderFactory.register(ParcelFileDescriptor.class, Bitmap.class,
            new FileDescriptorBitmapDataLoadProvider(bitmapPool));

    ImageVideoDataLoadProvider imageVideoDataLoadProvider = new ImageVideoDataLoadProvider(bitmapPool);
    dataLoadProviderFactory.register(ImageVideoWrapper.class, Bitmap.class, imageVideoDataLoadProvider);

    GifDataLoadProvider gifDataLoadProvider = new GifDataLoadProvider(context, bitmapPool);
    dataLoadProviderFactory.register(ImageVideoWrapper.class, GifBitmapWrapper.class,
            new ImageVideoGifDataLoadProvider(imageVideoDataLoadProvider, gifDataLoadProvider));

    register(File.class, ParcelFileDescriptor.class, new FileDescriptorFileLoader.Factory());
    register(File.class, InputStream.class, new StreamFileLoader.Factory());
    register(Integer.class, ParcelFileDescriptor.class, new FileDescriptorResourceLoader.Factory());
    register(Integer.class, InputStream.class, new StreamResourceLoader.Factory());
    register(String.class, ParcelFileDescriptor.class, new FileDescriptorStringLoader.Factory());
    register(String.class, InputStream.class, new StreamStringLoader.Factory());
    register(Uri.class, ParcelFileDescriptor.class, new FileDescriptorUriLoader.Factory());
    register(Uri.class, InputStream.class, new StreamUriLoader.Factory());
    register(URL.class, InputStream.class, new StreamUrlLoader.Factory());
    register(GlideUrl.class, InputStream.class, new VolleyUrlLoader.Factory(requestQueue));

    transcoderFactory.register(Bitmap.class, BitmapDrawable.class,
            new BitmapDrawableTranscoder(context.getResources(), bitmapPool));
    transcoderFactory.register(GifBitmapWrapper.class, Drawable.class,
            new GifBitmapDrawableTranscoder(context));
}
项目:saarang-iosched    文件:DrawableTypeRequest.java   
private static <A, Z, R> FixedLoadProvider<A, ImageVideoWrapper, Z, R> buildProvider(Glide glide,
        ModelLoader<A, InputStream> streamModelLoader,
        ModelLoader<A, ParcelFileDescriptor> fileDescriptorModelLoader, Class<Z> resourceClass,
        Class<R> transcodedClass,
        ResourceTranscoder<Z, R> transcoder) {
        return streamModelLoader == null && fileDescriptorModelLoader == null ? null :
                new FixedLoadProvider<A, ImageVideoWrapper, Z, R>(
                        new ImageVideoModelLoader<A>(streamModelLoader, fileDescriptorModelLoader),
                        transcoder != null ? transcoder : glide.buildTranscoder(resourceClass, transcodedClass),
                        glide.buildDataProvider(ImageVideoWrapper.class, resourceClass));
}
项目:saarang-iosched    文件:ImageVideoGifDataLoadProvider.java   
public ImageVideoGifDataLoadProvider(DataLoadProvider<ImageVideoWrapper, Bitmap> bitmapProvider,
        DataLoadProvider<InputStream, GifData> gifProvider) {
    cacheDecoder = new GifBitmapWrapperStreamResourceDecoder(new GifBitmapWrapperResourceDecoder(
            bitmapProvider.getSourceDecoder(),
            gifProvider.getCacheDecoder()));
    sourceDecoder = new GifBitmapWrapperResourceDecoder(
            bitmapProvider.getSourceDecoder(),
            gifProvider.getSourceDecoder());
    encoder = new GifBitmapWrapperResourceEncoder(bitmapProvider.getEncoder(), gifProvider.getEncoder());
}
项目:saarang-iosched    文件:BitmapTypeRequest.java   
private static <A, R> FixedLoadProvider<A, ImageVideoWrapper, Bitmap, R> buildProvider(Glide glide,
        ModelLoader<A, InputStream> streamModelLoader,
        ModelLoader<A, ParcelFileDescriptor> fileDescriptorModelLoader,
        Class<R> transcodedClass,
        ResourceTranscoder<Bitmap, R> transcoder) {
        return streamModelLoader == null && fileDescriptorModelLoader == null ? null :
                new FixedLoadProvider<A, ImageVideoWrapper, Bitmap, R>(
                        new ImageVideoModelLoader<A>(streamModelLoader, fileDescriptorModelLoader),
                        transcoder != null ? transcoder : glide.buildTranscoder(Bitmap.class, transcodedClass),
                        glide.buildDataProvider(ImageVideoWrapper.class, Bitmap.class));
}
项目:saarang-iosched    文件:BitmapRequestBuilder.java   
BitmapRequestBuilder(Context context, ModelType model,
        LoadProvider<ModelType, ImageVideoWrapper, Bitmap, TranscodeType> streamLoadProvider,
        Class<TranscodeType> transcodeClass, Glide glide) {
    super(context, model, streamLoadProvider, transcodeClass, glide);
    this.bitmapPool = glide.getBitmapPool();

    imageDecoder = new StreamBitmapDecoder(bitmapPool);
    videoDecoder = new FileDescriptorBitmapDecoder(bitmapPool);
}
项目:AppDevFestSudeste2015    文件:Glide.java   
Glide(Engine engine, RequestQueue requestQueue, MemoryCache memoryCache, BitmapPool bitmapPool,
        Context context) {
    this.engine = engine;
    this.requestQueue = requestQueue;
    this.bitmapPool = bitmapPool;
    this.memoryCache = memoryCache;

    dataLoadProviderFactory = new DataLoadProviderFactory();
    dataLoadProviderFactory.register(InputStream.class, Bitmap.class, new StreamBitmapDataLoadProvider(bitmapPool));

    dataLoadProviderFactory.register(ParcelFileDescriptor.class, Bitmap.class,
            new FileDescriptorBitmapDataLoadProvider(bitmapPool));

    ImageVideoDataLoadProvider imageVideoDataLoadProvider = new ImageVideoDataLoadProvider(bitmapPool);
    dataLoadProviderFactory.register(ImageVideoWrapper.class, Bitmap.class, imageVideoDataLoadProvider);

    GifDataLoadProvider gifDataLoadProvider = new GifDataLoadProvider(context, bitmapPool);
    dataLoadProviderFactory.register(ImageVideoWrapper.class, GifBitmapWrapper.class,
            new ImageVideoGifDataLoadProvider(imageVideoDataLoadProvider, gifDataLoadProvider));

    register(File.class, ParcelFileDescriptor.class, new FileDescriptorFileLoader.Factory());
    register(File.class, InputStream.class, new StreamFileLoader.Factory());
    register(Integer.class, ParcelFileDescriptor.class, new FileDescriptorResourceLoader.Factory());
    register(Integer.class, InputStream.class, new StreamResourceLoader.Factory());
    register(String.class, ParcelFileDescriptor.class, new FileDescriptorStringLoader.Factory());
    register(String.class, InputStream.class, new StreamStringLoader.Factory());
    register(Uri.class, ParcelFileDescriptor.class, new FileDescriptorUriLoader.Factory());
    register(Uri.class, InputStream.class, new StreamUriLoader.Factory());
    register(URL.class, InputStream.class, new StreamUrlLoader.Factory());
    register(GlideUrl.class, InputStream.class, new VolleyUrlLoader.Factory(requestQueue));

    transcoderFactory.register(Bitmap.class, BitmapDrawable.class,
            new BitmapDrawableTranscoder(context.getResources(), bitmapPool));
    transcoderFactory.register(GifBitmapWrapper.class, Drawable.class,
            new GifBitmapDrawableTranscoder(context));
}
项目:AppDevFestSudeste2015    文件:DrawableTypeRequest.java   
private static <A, Z, R> FixedLoadProvider<A, ImageVideoWrapper, Z, R> buildProvider(Glide glide,
        ModelLoader<A, InputStream> streamModelLoader,
        ModelLoader<A, ParcelFileDescriptor> fileDescriptorModelLoader, Class<Z> resourceClass,
        Class<R> transcodedClass,
        ResourceTranscoder<Z, R> transcoder) {
        return streamModelLoader == null && fileDescriptorModelLoader == null ? null :
                new FixedLoadProvider<A, ImageVideoWrapper, Z, R>(
                        new ImageVideoModelLoader<A>(streamModelLoader, fileDescriptorModelLoader),
                        transcoder != null ? transcoder : glide.buildTranscoder(resourceClass, transcodedClass),
                        glide.buildDataProvider(ImageVideoWrapper.class, resourceClass));
}
项目:AppDevFestSudeste2015    文件:ImageVideoGifDataLoadProvider.java   
public ImageVideoGifDataLoadProvider(DataLoadProvider<ImageVideoWrapper, Bitmap> bitmapProvider,
        DataLoadProvider<InputStream, GifData> gifProvider) {
    cacheDecoder = new GifBitmapWrapperStreamResourceDecoder(new GifBitmapWrapperResourceDecoder(
            bitmapProvider.getSourceDecoder(),
            gifProvider.getCacheDecoder()));
    sourceDecoder = new GifBitmapWrapperResourceDecoder(
            bitmapProvider.getSourceDecoder(),
            gifProvider.getSourceDecoder());
    encoder = new GifBitmapWrapperResourceEncoder(bitmapProvider.getEncoder(), gifProvider.getEncoder());
}
项目:AppDevFestSudeste2015    文件:BitmapTypeRequest.java   
private static <A, R> FixedLoadProvider<A, ImageVideoWrapper, Bitmap, R> buildProvider(Glide glide,
        ModelLoader<A, InputStream> streamModelLoader,
        ModelLoader<A, ParcelFileDescriptor> fileDescriptorModelLoader,
        Class<R> transcodedClass,
        ResourceTranscoder<Bitmap, R> transcoder) {
        return streamModelLoader == null && fileDescriptorModelLoader == null ? null :
                new FixedLoadProvider<A, ImageVideoWrapper, Bitmap, R>(
                        new ImageVideoModelLoader<A>(streamModelLoader, fileDescriptorModelLoader),
                        transcoder != null ? transcoder : glide.buildTranscoder(Bitmap.class, transcodedClass),
                        glide.buildDataProvider(ImageVideoWrapper.class, Bitmap.class));
}
项目:AppDevFestSudeste2015    文件:BitmapRequestBuilder.java   
BitmapRequestBuilder(Context context, ModelType model,
        LoadProvider<ModelType, ImageVideoWrapper, Bitmap, TranscodeType> streamLoadProvider,
        Class<TranscodeType> transcodeClass, Glide glide) {
    super(context, model, streamLoadProvider, transcodeClass, glide);
    this.bitmapPool = glide.getBitmapPool();

    imageDecoder = new StreamBitmapDecoder(bitmapPool);
    videoDecoder = new FileDescriptorBitmapDecoder(bitmapPool);
}
项目:devfestnorte-app    文件:Glide.java   
Glide(Engine engine, RequestQueue requestQueue, MemoryCache memoryCache, BitmapPool bitmapPool,
        Context context) {
    this.engine = engine;
    this.requestQueue = requestQueue;
    this.bitmapPool = bitmapPool;
    this.memoryCache = memoryCache;

    dataLoadProviderFactory = new DataLoadProviderFactory();
    dataLoadProviderFactory.register(InputStream.class, Bitmap.class, new StreamBitmapDataLoadProvider(bitmapPool));

    dataLoadProviderFactory.register(ParcelFileDescriptor.class, Bitmap.class,
            new FileDescriptorBitmapDataLoadProvider(bitmapPool));

    ImageVideoDataLoadProvider imageVideoDataLoadProvider = new ImageVideoDataLoadProvider(bitmapPool);
    dataLoadProviderFactory.register(ImageVideoWrapper.class, Bitmap.class, imageVideoDataLoadProvider);

    GifDataLoadProvider gifDataLoadProvider = new GifDataLoadProvider(context, bitmapPool);
    dataLoadProviderFactory.register(ImageVideoWrapper.class, GifBitmapWrapper.class,
            new ImageVideoGifDataLoadProvider(imageVideoDataLoadProvider, gifDataLoadProvider));

    register(File.class, ParcelFileDescriptor.class, new FileDescriptorFileLoader.Factory());
    register(File.class, InputStream.class, new StreamFileLoader.Factory());
    register(Integer.class, ParcelFileDescriptor.class, new FileDescriptorResourceLoader.Factory());
    register(Integer.class, InputStream.class, new StreamResourceLoader.Factory());
    register(String.class, ParcelFileDescriptor.class, new FileDescriptorStringLoader.Factory());
    register(String.class, InputStream.class, new StreamStringLoader.Factory());
    register(Uri.class, ParcelFileDescriptor.class, new FileDescriptorUriLoader.Factory());
    register(Uri.class, InputStream.class, new StreamUriLoader.Factory());
    register(URL.class, InputStream.class, new StreamUrlLoader.Factory());
    register(GlideUrl.class, InputStream.class, new VolleyUrlLoader.Factory(requestQueue));

    transcoderFactory.register(Bitmap.class, BitmapDrawable.class,
            new BitmapDrawableTranscoder(context.getResources(), bitmapPool));
    transcoderFactory.register(GifBitmapWrapper.class, Drawable.class,
            new GifBitmapDrawableTranscoder(context));
}
项目:devfestnorte-app    文件:DrawableTypeRequest.java   
private static <A, Z, R> FixedLoadProvider<A, ImageVideoWrapper, Z, R> buildProvider(Glide glide,
        ModelLoader<A, InputStream> streamModelLoader,
        ModelLoader<A, ParcelFileDescriptor> fileDescriptorModelLoader, Class<Z> resourceClass,
        Class<R> transcodedClass,
        ResourceTranscoder<Z, R> transcoder) {
        return streamModelLoader == null && fileDescriptorModelLoader == null ? null :
                new FixedLoadProvider<A, ImageVideoWrapper, Z, R>(
                        new ImageVideoModelLoader<A>(streamModelLoader, fileDescriptorModelLoader),
                        transcoder != null ? transcoder : glide.buildTranscoder(resourceClass, transcodedClass),
                        glide.buildDataProvider(ImageVideoWrapper.class, resourceClass));
}
项目:devfestnorte-app    文件:ImageVideoGifDataLoadProvider.java   
public ImageVideoGifDataLoadProvider(DataLoadProvider<ImageVideoWrapper, Bitmap> bitmapProvider,
        DataLoadProvider<InputStream, GifData> gifProvider) {
    cacheDecoder = new GifBitmapWrapperStreamResourceDecoder(new GifBitmapWrapperResourceDecoder(
            bitmapProvider.getSourceDecoder(),
            gifProvider.getCacheDecoder()));
    sourceDecoder = new GifBitmapWrapperResourceDecoder(
            bitmapProvider.getSourceDecoder(),
            gifProvider.getSourceDecoder());
    encoder = new GifBitmapWrapperResourceEncoder(bitmapProvider.getEncoder(), gifProvider.getEncoder());
}
项目:devfestnorte-app    文件:BitmapTypeRequest.java   
private static <A, R> FixedLoadProvider<A, ImageVideoWrapper, Bitmap, R> buildProvider(Glide glide,
        ModelLoader<A, InputStream> streamModelLoader,
        ModelLoader<A, ParcelFileDescriptor> fileDescriptorModelLoader,
        Class<R> transcodedClass,
        ResourceTranscoder<Bitmap, R> transcoder) {
        return streamModelLoader == null && fileDescriptorModelLoader == null ? null :
                new FixedLoadProvider<A, ImageVideoWrapper, Bitmap, R>(
                        new ImageVideoModelLoader<A>(streamModelLoader, fileDescriptorModelLoader),
                        transcoder != null ? transcoder : glide.buildTranscoder(Bitmap.class, transcodedClass),
                        glide.buildDataProvider(ImageVideoWrapper.class, Bitmap.class));
}
项目:devfestnorte-app    文件:BitmapRequestBuilder.java   
BitmapRequestBuilder(Context context, ModelType model,
        LoadProvider<ModelType, ImageVideoWrapper, Bitmap, TranscodeType> streamLoadProvider,
        Class<TranscodeType> transcodeClass, Glide glide) {
    super(context, model, streamLoadProvider, transcodeClass, glide);
    this.bitmapPool = glide.getBitmapPool();

    imageDecoder = new StreamBitmapDecoder(bitmapPool);
    videoDecoder = new FileDescriptorBitmapDecoder(bitmapPool);
}
项目:saarang-iosched    文件:Glide.java   
Glide(Engine engine, RequestQueue requestQueue, MemoryCache memoryCache, BitmapPool bitmapPool,
        Context context) {
    this.engine = engine;
    this.requestQueue = requestQueue;
    this.bitmapPool = bitmapPool;
    this.memoryCache = memoryCache;

    dataLoadProviderFactory = new DataLoadProviderFactory();
    dataLoadProviderFactory.register(InputStream.class, Bitmap.class, new StreamBitmapDataLoadProvider(bitmapPool));

    dataLoadProviderFactory.register(ParcelFileDescriptor.class, Bitmap.class,
            new FileDescriptorBitmapDataLoadProvider(bitmapPool));

    ImageVideoDataLoadProvider imageVideoDataLoadProvider = new ImageVideoDataLoadProvider(bitmapPool);
    dataLoadProviderFactory.register(ImageVideoWrapper.class, Bitmap.class, imageVideoDataLoadProvider);

    GifDataLoadProvider gifDataLoadProvider = new GifDataLoadProvider(context, bitmapPool);
    dataLoadProviderFactory.register(ImageVideoWrapper.class, GifBitmapWrapper.class,
            new ImageVideoGifDataLoadProvider(imageVideoDataLoadProvider, gifDataLoadProvider));

    register(File.class, ParcelFileDescriptor.class, new FileDescriptorFileLoader.Factory());
    register(File.class, InputStream.class, new StreamFileLoader.Factory());
    register(Integer.class, ParcelFileDescriptor.class, new FileDescriptorResourceLoader.Factory());
    register(Integer.class, InputStream.class, new StreamResourceLoader.Factory());
    register(String.class, ParcelFileDescriptor.class, new FileDescriptorStringLoader.Factory());
    register(String.class, InputStream.class, new StreamStringLoader.Factory());
    register(Uri.class, ParcelFileDescriptor.class, new FileDescriptorUriLoader.Factory());
    register(Uri.class, InputStream.class, new StreamUriLoader.Factory());
    register(URL.class, InputStream.class, new StreamUrlLoader.Factory());
    register(GlideUrl.class, InputStream.class, new VolleyUrlLoader.Factory(requestQueue));

    transcoderFactory.register(Bitmap.class, BitmapDrawable.class,
            new BitmapDrawableTranscoder(context.getResources(), bitmapPool));
    transcoderFactory.register(GifBitmapWrapper.class, Drawable.class,
            new GifBitmapDrawableTranscoder(context));
}
项目:saarang-iosched    文件:DrawableTypeRequest.java   
private static <A, Z, R> FixedLoadProvider<A, ImageVideoWrapper, Z, R> buildProvider(Glide glide,
        ModelLoader<A, InputStream> streamModelLoader,
        ModelLoader<A, ParcelFileDescriptor> fileDescriptorModelLoader, Class<Z> resourceClass,
        Class<R> transcodedClass,
        ResourceTranscoder<Z, R> transcoder) {
        return streamModelLoader == null && fileDescriptorModelLoader == null ? null :
                new FixedLoadProvider<A, ImageVideoWrapper, Z, R>(
                        new ImageVideoModelLoader<A>(streamModelLoader, fileDescriptorModelLoader),
                        transcoder != null ? transcoder : glide.buildTranscoder(resourceClass, transcodedClass),
                        glide.buildDataProvider(ImageVideoWrapper.class, resourceClass));
}
项目:saarang-iosched    文件:ImageVideoGifDataLoadProvider.java   
public ImageVideoGifDataLoadProvider(DataLoadProvider<ImageVideoWrapper, Bitmap> bitmapProvider,
        DataLoadProvider<InputStream, GifData> gifProvider) {
    cacheDecoder = new GifBitmapWrapperStreamResourceDecoder(new GifBitmapWrapperResourceDecoder(
            bitmapProvider.getSourceDecoder(),
            gifProvider.getCacheDecoder()));
    sourceDecoder = new GifBitmapWrapperResourceDecoder(
            bitmapProvider.getSourceDecoder(),
            gifProvider.getSourceDecoder());
    encoder = new GifBitmapWrapperResourceEncoder(bitmapProvider.getEncoder(), gifProvider.getEncoder());
}
项目:saarang-iosched    文件:BitmapTypeRequest.java   
private static <A, R> FixedLoadProvider<A, ImageVideoWrapper, Bitmap, R> buildProvider(Glide glide,
        ModelLoader<A, InputStream> streamModelLoader,
        ModelLoader<A, ParcelFileDescriptor> fileDescriptorModelLoader,
        Class<R> transcodedClass,
        ResourceTranscoder<Bitmap, R> transcoder) {
        return streamModelLoader == null && fileDescriptorModelLoader == null ? null :
                new FixedLoadProvider<A, ImageVideoWrapper, Bitmap, R>(
                        new ImageVideoModelLoader<A>(streamModelLoader, fileDescriptorModelLoader),
                        transcoder != null ? transcoder : glide.buildTranscoder(Bitmap.class, transcodedClass),
                        glide.buildDataProvider(ImageVideoWrapper.class, Bitmap.class));
}
项目:saarang-iosched    文件:BitmapRequestBuilder.java   
BitmapRequestBuilder(Context context, ModelType model,
        LoadProvider<ModelType, ImageVideoWrapper, Bitmap, TranscodeType> streamLoadProvider,
        Class<TranscodeType> transcodeClass, Glide glide) {
    super(context, model, streamLoadProvider, transcodeClass, glide);
    this.bitmapPool = glide.getBitmapPool();

    imageDecoder = new StreamBitmapDecoder(bitmapPool);
    videoDecoder = new FileDescriptorBitmapDecoder(bitmapPool);
}
项目:GlidePlus    文件:ImageWrapperResourceDecoder.java   
public ImageWrapperResourceDecoder(ResourceDecoder<ImageVideoWrapper, Bitmap> bitmapDecoder,
                                   ResourceDecoder<InputStream, GifDrawable> gifDecoder, BitmapPool bitmapPool) {
    this(bitmapDecoder, gifDecoder, bitmapPool, DEFAULT_PARSER, DEFAULT_STREAM_FACTORY);
}
项目:GlidePlus    文件:ImageWrapperStreamResourceDecoder.java   
public ImageWrapperStreamResourceDecoder(
        ResourceDecoder<ImageVideoWrapper, ImageWrapper> gifBitmapDecoder) {
    this.gifBitmapDecoder = gifBitmapDecoder;
}
项目:GlidePlus    文件:ImageWrapperStreamResourceDecoder.java   
@Override
public Resource<ImageWrapper> decode(InputStream source, int width, int height) throws IOException {
    return gifBitmapDecoder.decode(new ImageVideoWrapper(source, null), width, height);
}
项目:saarang-iosched    文件:DrawableRequestBuilder.java   
DrawableRequestBuilder(Context context, ModelType model,
        LoadProvider<ModelType, ImageVideoWrapper, GifBitmapWrapper, Drawable> loadProvider, Glide glide) {
    super(context, model, loadProvider, Drawable.class, glide);
    this.context = context;
    this.glide = glide;
}
项目:saarang-iosched    文件:DrawableRequestBuilder.java   
@Override
public DrawableRequestBuilder<ModelType> thumbnail(
        GenericRequestBuilder<ModelType, ImageVideoWrapper, GifBitmapWrapper, Drawable> thumbnailRequest) {
    super.thumbnail(thumbnailRequest);
    return this;
}
项目:saarang-iosched    文件:ImageVideoDataLoadProvider.java   
@Override
public ResourceDecoder<ImageVideoWrapper, Bitmap> getSourceDecoder() {
    return sourceDecoder;
}
项目:saarang-iosched    文件:ImageVideoGifDataLoadProvider.java   
@Override
public ResourceDecoder<ImageVideoWrapper, GifBitmapWrapper> getSourceDecoder() {
    return sourceDecoder;
}
项目:saarang-iosched    文件:GifBitmapWrapperResourceDecoder.java   
public GifBitmapWrapperResourceDecoder(ResourceDecoder<ImageVideoWrapper, Bitmap> bitmapDecoder,
        ResourceDecoder<InputStream, GifData> gifDecoder) {
    this.bitmapDecoder = bitmapDecoder;
    this.gifDecoder = gifDecoder;
}
项目:saarang-iosched    文件:GifBitmapWrapperStreamResourceDecoder.java   
public GifBitmapWrapperStreamResourceDecoder(ResourceDecoder<ImageVideoWrapper, GifBitmapWrapper> gifBitmapDecoder) {
    this.gifBitmapDecoder = gifBitmapDecoder;
}