Java 类com.bumptech.glide.load.resource.drawable.DrawableResource 实例源码

项目: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);
}
项目:anticipate    文件:PassthroughDecoder.java   
@Override
public Resource<Drawable> decode(Drawable source, int width, int height) throws IOException {
    return new DrawableResource<Drawable>(source) {
        @Override
        public int getSize() {
            if (drawable instanceof BitmapDrawable) {
                return Util.getBitmapByteSize(((BitmapDrawable) drawable).getBitmap());
            } else {
                return 1;
            }
        }

        @Override
        public void recycle() {

        }
    };
}
项目: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);
}
项目:glide-support    文件:ApplicationIconDecoder.java   
@Override public Resource<Drawable> decode(ApplicationInfo source, int width, int height) throws IOException {
    Drawable icon = context.getPackageManager().getApplicationIcon(source);
    return new DrawableResource<Drawable>(icon) {
        @Override public int getSize() { // best effort
            if (drawable instanceof BitmapDrawable) {
                return Util.getBitmapByteSize(((BitmapDrawable)drawable).getBitmap());
            } else {
                return 1;
            }
        }
        @Override public void recycle() { /* not from our pool */ }
    };
}
项目:glide-support    文件:DrawableResourceDecoder.java   
@Override public Resource<Drawable> decode(Drawable source, int width, int height) throws IOException {
    return new DrawableResource<Drawable>(source) {
        @Override public int getSize() {
            return 1;
        }
        @Override public void recycle() {
        }
    };
}