@Override
public void onResponse(Call call, Response response) throws IOException {
if (!response.isSuccessful()) {
return;
}
try(ResponseBody body = response.body()) {
Bitmap loaded = BitmapFactory.decodeStream(body.byteStream());
if (loaded == null) { // decode failed
return;
}
Bitmap scaled = Bitmap.createScaledBitmap(loaded, mCaller.getWidth(), mCaller.getHeight(), false);
RoundedBitmapDrawable rbd = RoundedBitmapDrawableFactory.create(mCaller.getContext().getResources(), scaled);
rbd.setCornerRadius(Math.max(scaled.getWidth(), scaled.getHeight()) / 2.0f);
setRetrieved(rbd);
ImageCache.getInstance(mCaller.getContext()).putCached(call.request().url().toString(), rbd);
mCaller.post(this);
}
}
ImageCache.java 文件源码
java
阅读 26
收藏 0
点赞 0
评论 0
项目:MyDebts
作者:
评论列表
文章目录