Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow CircleImageView to work with ColorDrawables #1

Closed
ianhanniballake opened this issue Feb 5, 2014 · 5 comments
Closed

Allow CircleImageView to work with ColorDrawables #1

ianhanniballake opened this issue Feb 5, 2014 · 5 comments

Comments

@ianhanniballake
Copy link

I use ColorDrawables as placeholders while profile pictures are being loaded from the network. However, ColorDrawables have an intrinsic height and width of -1, causing Bitmap.createBitmap to fail in CircleImageView.getBitmapFromDrawable.

@thevery
Copy link

thevery commented Feb 9, 2014

+1!

@thevery
Copy link

thevery commented Feb 9, 2014

can you please make generic fix for all drawables without explicit size (e.g. ShapeDrawable, GradientDrawable etc)?

@vinc3m1
Copy link

vinc3m1 commented Feb 9, 2014

I've added a generic upstream in RoundedImageView that implements basic support for all drawables without explicit size. Please help test before I push out the next release: vinc3m1/RoundedImageView#30

FYI RoundedImageView has had support for circle images for a long time now through its is_oval param, in addition to a many more features...

@hdodenhof
Copy link
Owner

I actually doubt that the approach of just using fixed dimensions works well with drawables other than ColorDrawables, that's why I restricted it for now.

I'll try to look into this over the next couple days.

@vinc3m1
Copy link

vinc3m1 commented Feb 9, 2014

That's true, but other drawables with effects based on dimensions should not be returning -1 in getInstrinsicHeight or getInstrinsicWidth either. Also more complex custom drawables that require multiple drawing passes cannot benefit from the optimization that this library uses, specifically the use of a BitmapShader.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants