本文整理汇总了Java中com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapper类的典型用法代码示例。如果您正苦于以下问题:Java GifBitmapWrapper类的具体用法?Java GifBitmapWrapper怎么用?Java GifBitmapWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GifBitmapWrapper类属于com.bumptech.glide.load.resource.gifbitmap包,在下文中一共展示了GifBitmapWrapper类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: transcode
import com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapper; //导入依赖的package包/类
@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);
}
示例2: decode
import com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapper; //导入依赖的package包/类
@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();
}
示例3: Glide
import com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapper; //导入依赖的package包/类
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));
}
示例4: DrawableTypeRequest
import com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapper; //导入依赖的package包/类
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;
}
示例5: setPhotoData
import com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapper; //导入依赖的package包/类
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();
}
};
}
示例6: drawable
import com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapper; //导入依赖的package包/类
public static ResourceTranscoder<GifBitmapWrapper, GlideDrawable> drawable(int delay, Context context) {
return new DelayTranscoder<>(delay, new GifBitmapWrapperDrawableTranscoder(
new GlideBitmapDrawableTranscoder(context.getResources(), Glide.get(context).getBitmapPool())));
}
示例7: DrawableRequestBuilder
import com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapper; //导入依赖的package包/类
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;
}
示例8: thumbnail
import com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapper; //导入依赖的package包/类
@Override
public DrawableRequestBuilder<ModelType> thumbnail(
GenericRequestBuilder<ModelType, ImageVideoWrapper, GifBitmapWrapper, Drawable> thumbnailRequest) {
super.thumbnail(thumbnailRequest);
return this;
}
示例9: transform
import com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapper; //导入依赖的package包/类
@Override
public DrawableRequestBuilder<ModelType> transform(
Transformation<GifBitmapWrapper> transformation) {
super.transform(transformation);
return this;
}
示例10: getGifBitmapWrapperResource
import com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapper; //导入依赖的package包/类
public Resource<GifBitmapWrapper> getGifBitmapWrapperResource() {
return mGifBitmapWrapperResource;
}