vinc3m1/RoundedImageView

TransitionDrawable support

carriehall opened this issue · 0 comments

I am getting the same exception as others when I try to use a transition drawable

java.lang.IllegalArgumentException: width and height must be > 0

I believe it's caused by these lines

if (drawable instanceof ColorDrawable) {
     bitmap = Bitmap.createBitmap(COLORDRAWABLE_DIMENSION, COLORDRAWABLE_DIMENSION, BITMAP_CONFIG);
} else {
     bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), BITMAP_CONFIG);
}

TransitionDrawables are returning -1 for the intrinsic sizes, presumably because I am creating them on the fly as they are used for a Picasso placeholder rather than inflated onto the screen already.

If I use a custom class and override getIntrinsicWidth and getIntrinsicHeight with 1, then it seems to work, but it feels hacky and I'm not sure what the repercussions are.