use of com.facebook.drawee.drawable.RoundedColorDrawable in project fresco by facebook.
the class WrappingUtils method applyLeafRounding.
/**
* Rounds the given drawable with a {@link RoundedBitmapDrawable} or {@link RoundedColorDrawable}.
*
* <p> If the given drawable is not a {@link BitmapDrawable} or a {@link ColorDrawable}, it is
* returned without being rounded.
*
* @return the rounded drawable, or the original drawable if rounding didn't take place
*/
private static Drawable applyLeafRounding(Drawable drawable, RoundingParams roundingParams, Resources resources) {
if (drawable instanceof BitmapDrawable) {
final BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
RoundedBitmapDrawable roundedBitmapDrawable = new RoundedBitmapDrawable(resources, bitmapDrawable.getBitmap(), bitmapDrawable.getPaint());
applyRoundingParams(roundedBitmapDrawable, roundingParams);
return roundedBitmapDrawable;
}
if (drawable instanceof ColorDrawable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
RoundedColorDrawable roundedColorDrawable = RoundedColorDrawable.fromColorDrawable((ColorDrawable) drawable);
applyRoundingParams(roundedColorDrawable, roundingParams);
return roundedColorDrawable;
}
return drawable;
}
Aggregations