Java 类com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapper 实例源码

项目:saarang-iosched    文件:GifBitmapDrawableTranscoder.java   
@Override
public Resource<Drawable> transcode(Resource<GifBitmapWrapper> toTranscode) {
    GifBitmapWrapper gifBitmap = toTranscode.get();
    Resource<Bitmap> bitmapResource = gifBitmap.getBitmapResource();

    final Resource resource;
    final Drawable drawable;
    if (bitmapResource != null) {
        resource = bitmapResource;
        drawable = new BitmapDrawable(resources, bitmapResource.get());
    } else {
        resource = gifBitmap.getGifResource();
        drawable = gifBitmap.getGifResource().get().getDrawable();
    }
    return new DrawableResource(drawable, resource);
}
项目:AppDevFestSudeste2015    文件:GifBitmapDrawableTranscoder.java   
@Override
public Resource<Drawable> transcode(Resource<GifBitmapWrapper> toTranscode) {
    GifBitmapWrapper gifBitmap = toTranscode.get();
    Resource<Bitmap> bitmapResource = gifBitmap.getBitmapResource();

    final Resource resource;
    final Drawable drawable;
    if (bitmapResource != null) {
        resource = bitmapResource;
        drawable = new BitmapDrawable(resources, bitmapResource.get());
    } else {
        resource = gifBitmap.getGifResource();
        drawable = gifBitmap.getGifResource().get().getDrawable();
    }
    return new DrawableResource(drawable, resource);
}
项目: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    文件:GifBitmapDrawableTranscoder.java   
@Override
public Resource<Drawable> transcode(Resource<GifBitmapWrapper> toTranscode) {
    GifBitmapWrapper gifBitmap = toTranscode.get();
    Resource<Bitmap> bitmapResource = gifBitmap.getBitmapResource();

    final Resource resource;
    final Drawable drawable;
    if (bitmapResource != null) {
        resource = bitmapResource;
        drawable = new BitmapDrawable(resources, bitmapResource.get());
    } else {
        resource = gifBitmap.getGifResource();
        drawable = gifBitmap.getGifResource().get().getDrawable();
    }
    return new DrawableResource(drawable, resource);
}
项目:saarang-iosched    文件:GifBitmapDrawableTranscoder.java   
@Override
public Resource<Drawable> transcode(Resource<GifBitmapWrapper> toTranscode) {
    GifBitmapWrapper gifBitmap = toTranscode.get();
    Resource<Bitmap> bitmapResource = gifBitmap.getBitmapResource();

    final Resource resource;
    final Drawable drawable;
    if (bitmapResource != null) {
        resource = bitmapResource;
        drawable = new BitmapDrawable(resources, bitmapResource.get());
    } else {
        resource = gifBitmap.getGifResource();
        drawable = gifBitmap.getGifResource().get().getDrawable();
    }
    return new DrawableResource(drawable, resource);
}
项目: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   
DrawableTypeRequest(A model, ModelLoader<A, InputStream> streamModelLoader,
        ModelLoader<A, ParcelFileDescriptor> fileDescriptorModelLoader, Context context, Glide glide) {
    super(context, model,
            buildProvider(glide, streamModelLoader, fileDescriptorModelLoader, GifBitmapWrapper.class, Drawable.class,
                    null), glide);
    this.model = model;
    this.streamModelLoader = streamModelLoader;
    this.fileDescriptorModelLoader = fileDescriptorModelLoader;
    this.context = context;
    this.glide = glide;
}
项目: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   
DrawableTypeRequest(A model, ModelLoader<A, InputStream> streamModelLoader,
        ModelLoader<A, ParcelFileDescriptor> fileDescriptorModelLoader, Context context, Glide glide) {
    super(context, model,
            buildProvider(glide, streamModelLoader, fileDescriptorModelLoader, GifBitmapWrapper.class, Drawable.class,
                    null), glide);
    this.model = model;
    this.streamModelLoader = streamModelLoader;
    this.fileDescriptorModelLoader = fileDescriptorModelLoader;
    this.context = context;
    this.glide = glide;
}
项目:BioStar2Android    文件:GlidePhotoData.java   
public void setPhotoData(Bitmap bmp) {
    mBmp = bmp;
    mBitmapResource = new Resource<Bitmap>() {
        @Override
        public Bitmap get() {
            return mBmp;
        }

        @Override
        public int getSize() {
            return mBmp.getByteCount();
        }

        @Override
        public void recycle() {
            if (mBmp != null) {
                mBmp.recycle();
            }
            mBmp = null;
        }
    };
    mGifBitmapWrapper = new GifBitmapWrapper(mBitmapResource, null);
    mGifBitmapWrapperResource = new Resource<GifBitmapWrapper>() {
        @Override
        public GifBitmapWrapper get() {
            return mGifBitmapWrapper;
        }

        @Override
        public int getSize() {
            return mGifBitmapWrapper.getSize();
        }

        @Override
        public void recycle() {
            mGifBitmapWrapper.getBitmapResource().recycle();
        }
    };
}
项目: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   
DrawableTypeRequest(A model, ModelLoader<A, InputStream> streamModelLoader,
        ModelLoader<A, ParcelFileDescriptor> fileDescriptorModelLoader, Context context, Glide glide) {
    super(context, model,
            buildProvider(glide, streamModelLoader, fileDescriptorModelLoader, GifBitmapWrapper.class, Drawable.class,
                    null), glide);
    this.model = model;
    this.streamModelLoader = streamModelLoader;
    this.fileDescriptorModelLoader = fileDescriptorModelLoader;
    this.context = context;
    this.glide = glide;
}
项目: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   
DrawableTypeRequest(A model, ModelLoader<A, InputStream> streamModelLoader,
        ModelLoader<A, ParcelFileDescriptor> fileDescriptorModelLoader, Context context, Glide glide) {
    super(context, model,
            buildProvider(glide, streamModelLoader, fileDescriptorModelLoader, GifBitmapWrapper.class, Drawable.class,
                    null), glide);
    this.model = model;
    this.streamModelLoader = streamModelLoader;
    this.fileDescriptorModelLoader = fileDescriptorModelLoader;
    this.context = context;
    this.glide = glide;
}
项目:glide-support    文件:DelayTranscoder.java   
public static ResourceTranscoder<GifBitmapWrapper, GlideDrawable> drawable(int delay, Context context) {
    return new DelayTranscoder<>(delay, new GifBitmapWrapperDrawableTranscoder(
            new GlideBitmapDrawableTranscoder(context.getResources(), Glide.get(context).getBitmapPool())));
}
项目: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    文件:DrawableRequestBuilder.java   
@Override
public DrawableRequestBuilder<ModelType> transform(
        Transformation<GifBitmapWrapper> transformation) {
    super.transform(transformation);
    return this;
}
项目:AppDevFestSudeste2015    文件: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;
}
项目:AppDevFestSudeste2015    文件:DrawableRequestBuilder.java   
@Override
public DrawableRequestBuilder<ModelType> thumbnail(
        GenericRequestBuilder<ModelType, ImageVideoWrapper, GifBitmapWrapper, Drawable> thumbnailRequest) {
    super.thumbnail(thumbnailRequest);
    return this;
}
项目:AppDevFestSudeste2015    文件:DrawableRequestBuilder.java   
@Override
public DrawableRequestBuilder<ModelType> transform(
        Transformation<GifBitmapWrapper> transformation) {
    super.transform(transformation);
    return this;
}
项目:BioStar2Android    文件:GlidePhotoData.java   
public Resource<GifBitmapWrapper> getGifBitmapWrapperResource() {
    return mGifBitmapWrapperResource;
}
项目:devfestnorte-app    文件: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;
}
项目:devfestnorte-app    文件:DrawableRequestBuilder.java   
@Override
public DrawableRequestBuilder<ModelType> thumbnail(
        GenericRequestBuilder<ModelType, ImageVideoWrapper, GifBitmapWrapper, Drawable> thumbnailRequest) {
    super.thumbnail(thumbnailRequest);
    return this;
}
项目:devfestnorte-app    文件:DrawableRequestBuilder.java   
@Override
public DrawableRequestBuilder<ModelType> transform(
        Transformation<GifBitmapWrapper> transformation) {
    super.transform(transformation);
    return this;
}
项目: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    文件:DrawableRequestBuilder.java   
@Override
public DrawableRequestBuilder<ModelType> transform(
        Transformation<GifBitmapWrapper> transformation) {
    super.transform(transformation);
    return this;
}