use of in.srain.cube.image.drawable.RoundedDrawable in project cube-sdk by liaohuqiu.
the class DefaultImageLoadHandler method onLoadFinish.
@Override
public void onLoadFinish(ImageTask imageTask, CubeImageView imageView, BitmapDrawable drawable) {
if (imageView == null) {
return;
}
Drawable d = drawable;
if (drawable != null) {
if (mResizeImageViewAfterLoad) {
int w = drawable.getBitmap().getWidth();
int h = drawable.getBitmap().getHeight();
if (w > 0 && h > 0) {
ViewGroup.LayoutParams lyp = imageView.getLayoutParams();
if (lyp != null) {
lyp.width = w;
lyp.height = h;
imageView.setLayoutParams(lyp);
}
}
}
// RoundedDrawable will not recycle automatically when API level is lower than 11
if ((mDisplayTag & DISPLAY_ROUNDED) == DISPLAY_ROUNDED && Version.hasHoneycomb()) {
d = new RoundedDrawable(drawable.getBitmap(), mCornerRadius);
}
if ((mDisplayTag & DISPLAY_FADE_IN) == DISPLAY_FADE_IN) {
int loadingColor = android.R.color.transparent;
if (mLoadingColor != -1 && (mDisplayTag & DISPLAY_ROUNDED) != DISPLAY_ROUNDED) {
loadingColor = mLoadingColor;
}
final TransitionDrawable td = new TransitionDrawable(new Drawable[] { new ColorDrawable(loadingColor), d });
imageView.setImageDrawable(td);
td.startTransition(200);
} else {
if (DEBUG) {
Drawable oldDrawable = imageView.getDrawable();
int w = 0, h = 0;
if (oldDrawable != null) {
w = oldDrawable.getIntrinsicWidth();
h = oldDrawable.getIntrinsicHeight();
}
CLog.d(LOG_TAG, MSG_LOAD_FINISH, imageTask, imageView, w, h, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
}
imageView.setImageDrawable(drawable);
}
}
}
Aggregations