-
Notifications
You must be signed in to change notification settings - Fork 1
Conversion
Daniel Bergløv edited this page Oct 25, 2015
·
2 revisions
This class contains conversion tools. One pain of programming can be the constant copy/paste work to add the same work to each new project. To help with this, some of the basic conversions has been added to this class.
// Convert dip to pixels
Conversion.dipToPixels(float dips)
// Convert pixels to dip
Conversion.pixelsToDip(int pixels)
/* Convert an attribute resource id
into whatever resource id it points to */
Conversion.attrToRes(Context context, @AttrRes int attr)
// Convert a Drawable to a Bitmap with optional resizing
Conversion.drawableToBitmap(Drawable drawable, float width, float height)