List of usage examples for android.support.v4.graphics.drawable RoundedBitmapDrawable setCornerRadius
public void setCornerRadius(float f)
From source file:com.android.incallui.CallCardFragment.java
/** * Set all the ImageViews to the same photo. Currently there are 2 photo views: the large one * (which fills about the bottom half of the screen) and the small one, which displays as a * circle next to the primary contact info. This method does not handle whether the ImageView * is shown or not.//from w w w . j a v a 2s . c o m * * @param photo The photo to set for the image views. */ private void setDrawableToImageViews(Drawable photo) { if (photo == null) { photo = ContactInfoCache.getInstance(getView().getContext()).getDefaultContactPhotoDrawable(); } if (mPrimaryPhotoDrawable == photo) { return; } mPrimaryPhotoDrawable = photo; mPhotoLarge.setImageDrawable(photo); // Modify the drawable to be round for the smaller ImageView. Bitmap bitmap = drawableToBitmap(photo); if (bitmap != null) { final RoundedBitmapDrawable drawable = RoundedBitmapDrawableFactory.create(getResources(), bitmap); drawable.setAntiAlias(true); drawable.setCornerRadius(bitmap.getHeight() / 2); photo = drawable; } mPhotoSmall.setImageDrawable(photo); }
From source file:com.android.contacts.common.ContactPhotoManager.java
/** * Given a bitmap, returns a drawable that is configured to display the bitmap based on the * specified request.//from w ww . j a v a2s . com */ private Drawable getDrawableForBitmap(Resources resources, Bitmap bitmap, Request request) { if (request.mIsCircular) { final RoundedBitmapDrawable drawable = RoundedBitmapDrawableFactory.create(resources, bitmap); drawable.setAntiAlias(true); drawable.setCornerRadius(bitmap.getHeight() / 2); return drawable; } else { return new BitmapDrawable(resources, bitmap); } }