-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
Is possible to make transformation to placeholder as well? #317
Comments
A similar question before: #262 |
Currently i extend from ImageView and overriding onDraw method, something like: boolean isRoundedCorner
protected void onDraw(Canvas canvas) {
if (isRoundedCorner) {
float radius = 90.0f; // angle of round corners
Path clipPath = new Path();
RectF rect = new RectF(0, 0, this.getWidth(), this.getHeight());
clipPath.addRoundRect(rect, radius, radius, Path.Direction.CW);
canvas.clipPath(clipPath);
}
super.onDraw(canvas);
} |
It's unfortunately not possible to apply Transformations to placeholders. The only way to do this would be to require every Transformation implementation to apply both to the original type (Bitmap, GifData) and the placeholder type (Drawable), which would be inconvenient for many Transformations and not possible for others. The most efficient way to do this would be to make your placeholder rounded (ie modify the image in resources). I understand that's not always possible though. |
I recommend to use https://github.com/vinc3m1/RoundedImageView (which is better than circle transform) or other similar (like CircleImageView) instead of circle transform. Or as sjudd suggested to make your placeholder rounded. edit: I found these two library I recommended can't perform animated Gifs. But BezelImageView (which also need to add style to attr.xml) works well for me. |
I ran into a similar issue. |
Thanks for the input guys. I'm going to close this, I don't think we're ever going to get to the point where we can consistently transform placeholders. A custom placeholder resource, or a special view may be the best way to go. |
Potential workarounds in #1077. |
Let say i want to download image then to run circle transformation on it. Now i want to use placeholder as well. When placeholder image is displayed it has square canvas instead circle. Is it possible to run the transform (circle transform) to both placeholder and downloaded image?
Thanks
The text was updated successfully, but these errors were encountered: