1 package com.bumptech.glide.load.resource.gifbitmap; 2 3 import android.graphics.Bitmap; 4 5 import com.bumptech.glide.load.engine.Resource; 6 import com.bumptech.glide.load.resource.gif.GifDrawable; 7 8 /** 9 * A resource that wraps an {@link com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapper}. 10 */ 11 public class GifBitmapWrapperResource implements Resource<GifBitmapWrapper> { 12 private final GifBitmapWrapper data; 13 14 public GifBitmapWrapperResource(GifBitmapWrapper data) { 15 if (data == null) { 16 throw new NullPointerException("Data must not be null"); 17 } 18 this.data = data; 19 } 20 21 @Override 22 public GifBitmapWrapper get() { 23 return data; 24 } 25 26 @Override 27 public int getSize() { 28 return data.getSize(); 29 } 30 31 @Override 32 public void recycle() { 33 Resource<Bitmap> bitmapResource = data.getBitmapResource(); 34 if (bitmapResource != null) { 35 bitmapResource.recycle(); 36 } 37 Resource<GifDrawable> gifDataResource = data.getGifResource(); 38 if (gifDataResource != null) { 39 gifDataResource.recycle(); 40 } 41 } 42 } 43