use of com.bumptech.glide.RequestBuilder in project BaseProject by feer921.
the class ImageUtil method loadImage.
// public static void loadImage(Context context, String picUrl, int newWidth, int newHeight, Drawable holderDrawable,
// Drawable errorDrawable, ImageView targetIv
// , Callback callback) {
// RequestCreator loadRequest = loadImageRequest(context, picUrl,null,0);
//
// if (newWidth > 0 && newHeight > 0) {
// loadRequest.resize(newWidth, newHeight);
// loadRequest.centerCrop();
// }
// else{
// // loadRequest.fit();
// }
// if (holderDrawable != null) {
// loadRequest.placeholder(holderDrawable);
// }
// else{
// loadRequest.noPlaceholder();
// }
// if (errorDrawable != null) {
// loadRequest.error(errorDrawable);
// }
// loadRequest.noFade();
// loadRequest.into(targetIv, callback);
// }
public static void loadImage(Context context, String picUrl, int newWidth, int newHeight, Drawable holderDrawable, Drawable errorDrawable, ImageView targetIv, RequestListener callback) {
RequestBuilder requestBuilder = loadImageRequest(context, picUrl);
RequestOptions options = new RequestOptions();
if (newWidth > 0 && newHeight > 0) {
options.override(newWidth, newHeight).centerCrop();
} else {
// loadRequest.fit();
}
if (holderDrawable != null) {
options.placeholder(holderDrawable);
} else {
// loadRequest.noPlaceholder();
}
if (errorDrawable != null) {
options.error(errorDrawable);
}
options.dontAnimate();
if (callback != null) {
requestBuilder.listener(callback);
}
requestBuilder.apply(options).into(targetIv);
}
use of com.bumptech.glide.RequestBuilder in project glide by bumptech.
the class GifFrameLoaderTest method setUp.
@SuppressWarnings("unchecked")
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
when(handler.obtainMessage(anyInt(), isA(DelayTarget.class))).thenReturn(mock(Message.class));
firstFrame = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
ByteBuffer byteBuffer = ByteBuffer.allocate(10);
when(gifDecoder.getData()).thenReturn(byteBuffer);
requestBuilder = mock(RequestBuilder.class, new ReturnsSelfAnswer());
loader = createGifFrameLoader(handler);
}
Aggregations