Example usage for android.support.v4.graphics.drawable RoundedBitmapDrawable setAlpha

List of usage examples for android.support.v4.graphics.drawable RoundedBitmapDrawable setAlpha

Introduction

In this page you can find the example usage for android.support.v4.graphics.drawable RoundedBitmapDrawable setAlpha.

Prototype

public void setAlpha(int i) 

Source Link

Usage

From source file:nu.yona.app.ui.profile.BaseProfileFragment.java

/**
 * Gets image.//www.  j  a  va 2s. co m
 *
 * @param bitmap          the bitmap
 * @param withAlpha       the with alpha
 * @param backgroundColor the background color
 * @param firstName       the first name
 * @param lastName        the last name
 * @return the image
 */
protected Drawable getImage(Bitmap bitmap, boolean withAlpha, int backgroundColor, String firstName,
        String lastName) {
    if (bitmap != null) {// TODO: 10/05/16 When server provides user profile image, we need to check and enable if part on base of that.
        RoundedBitmapDrawable drawable = RoundedBitmapDrawableFactory.create(getResources(), bitmap);
        drawable.setCornerRadius(Math.max(bitmap.getWidth(), bitmap.getHeight()));
        drawable.setAlpha(ALPHA);
        return drawable;
    }
    return null;
}