- All Implemented Interfaces:
- android.graphics.drawable.Drawable.Callback
public class DrawableWithIntrinsicSize
extends ForwardingDrawable
implements android.graphics.drawable.Drawable.Callback
Fresco currently sets drawables' intrinsic size to (-1, -1). This is to guarantee that scaling is
performed correctly. In the case of the Toolbar, we don't have access to the widget's internal
ImageView, which has width/height set to WRAP_CONTENT, which relies on intrinsic size.
To work around this we have this class which just wraps another Drawable, but returns the correct
dimensions in getIntrinsicWidth/Height. This makes WRAP_CONTENT work in Toolbar's internals.
This drawable uses the size of a loaded image to determine the intrinsic size. It therefore can't
be used safely until *after* an image has loaded, and must be replaced when the image is
replaced.