Issue 1:
I want to decode gif by android-gif-drawable, but load picture with glide.

android-gif-drawable can pass byte array to decode gif and my code is:

public void test1(final GifImageView gifImageView) throws IOException {
// String path1 =
// "http://img.newyx.net/news_img/201306/20/1371714170_1812223777.gif";
// test gif url
String path = "http://cdn.duitang.com/uploads/item/201311/20/20131120213622_mJCUy.thumb.600_0.gif";
URL url = new URL(path);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(5 * 1000);
conn.setRequestMethod("GET");
if (conn.getResponseCode() == HttpStatus.SC_OK) {
InputStream sourceIs = conn.getInputStream();
byte[] b = InputStreamTOByte(sourceIs);
final GifDrawable gifFromStream = new GifDrawable(b);
gifImageView.post(new Runnable() {
@Override
public void run() {
gifImageView.setImageDrawable(gifFromStream);
}
});
}
}

public static byte[] InputStreamTOByte(InputStream in) throws IOException {
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
int BUFFER_SIZE = 1024;
byte[] data = new byte[BUFFER_SIZE];
int count = -1;
while ((count = in.read(data, 0, BUFFER_SIZE)) != -1) {
outStream.write(data, 0, count);
}
data = null;
return outStream.toByteArray();
}

and I use path url to test, it can display normal. Then I use glide to decode the same path url.

My code is this:

// first
// Glide.with(MainActivity.this).load(path).into(imageView);
// second
Glide.with(MainActivity.this)
.load(path)
.asGif()
.toBytes()
.into(new SimpleTarget<byte[]>() {
@Override
public void onResourceReady(final byte[] resource,
GlideAnimation<? super byte[]> glideAnimation) {
GifDrawable gifFromStream;
try {
gifFromStream = new GifDrawable(resource);
gifImageView.setImageDrawable(gifFromStream);
} catch (IOException e) {
e.printStackTrace();
}
}
});

No matter the first way or the second way, pictures can't display.

Issue 2:
Idea

Glide.with(this).load(bitmap).into(imageView);
Glide.with(this).load(drawable).into(imageView);

This looks weird compared to ImageView.setImageBitmap(bitmap), but if you need animation and error handling (null bitmap), the above could become an easy to use, fire and forget, go-to line instead of duplicating code.

Note: you've already made a wrapper of ImageView#setImageResource and ImageView#setImageUri.

Currently they throw

Caused by: java.lang.IllegalArgumentException: Unknown type android.graphics.Bitmap@44759ab8. You must provide a Model of a type for which there is a registered ModelLoader, if you are using a custom model, you must first call Glide#register with a ModelLoaderFactory for your custom model class.

at com.bumptech.glide.RequestManager.loadGeneric(RequestManager.java:382)

at com.bumptech.glide.RequestManager.load(RequestManager.java:374)

Context

This came up when I was trying to display a captured image using Glide (oversimplified code):

startActivityForResult(new Intent(MediaStore.ACTION_IMAGE_CAPTURE), Activity.RESULT_FIRST_USER);

public void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode == REQUEST_CODE_GET_PICTURE && resultCode == Activity.RESULT_OK) {
Bitmap bitmap = (Bitmap)data.getExtras().get("data");
Glide.with(this).load(bitmap)/*...*/.into(image);