Example usage for android.graphics.drawable ShapeDrawable getPaint

List of usage examples for android.graphics.drawable ShapeDrawable getPaint

Introduction

In this page you can find the example usage for android.graphics.drawable ShapeDrawable getPaint.

Prototype

public Paint getPaint() 

Source Link

Document

Returns the Paint used to draw the shape.

Usage

From source file:Main.java

/**
 * @return the Integer value of color//  w w w . ja v  a 2  s  .  c o  m
 */
public static Drawable createCircleShape(int color) {
    Shape shape = new OvalShape();
    ShapeDrawable drawable = new ShapeDrawable(shape);
    drawable.getPaint().setColor(color);
    return drawable;
}

From source file:Main.java

public static ShapeDrawable getShapeDrawable(int color, int radius) {
    RoundRectShape roundRectShape = new RoundRectShape(
            new float[] { radius, radius, radius, radius, radius, radius, radius, radius }, null, null);
    ShapeDrawable shapeDrawable = new ShapeDrawable(roundRectShape);
    shapeDrawable.getPaint().setColor(color);
    return shapeDrawable;
}

From source file:Main.java

@NonNull
private static Drawable getRippleMask(int color) {
    float[] outerRadii = new float[8];
    // 3 is radius of final ripple,
    // instead of 3 you can give required final radius
    Arrays.fill(outerRadii, 3);//from  w  w  w  . j a v  a 2  s.  co  m

    RoundRectShape r = new RoundRectShape(outerRadii, null, null);
    ShapeDrawable shapeDrawable = new ShapeDrawable(r);
    shapeDrawable.getPaint().setColor(color);

    return shapeDrawable;
}

From source file:Main.java

public static synchronized ShapeDrawable getRoundedRect(final int color) {
    if (color == Color.TRANSPARENT) {
        return null;
    }/*from   ww w .  j  a  v a2s. c  o m*/
    int r = 3;
    float[] outerR = new float[] { r, r, r, r, r, r, r, r };
    RoundRectShape rr = new RoundRectShape(outerR, null, null);

    final ShapeDrawable d = new ShapeDrawable(rr);
    d.getPaint().setColor(color);

    return d;
}

From source file:Main.java

public static synchronized ShapeDrawable getCircle(final int color) {
    if (color == Color.TRANSPARENT) {
        return null;
    }// w  ww.ja va 2 s.c o  m

    final ShapeDrawable d = new ShapeDrawable(new OvalShape());
    d.getPaint().setColor(color);

    return d;
}

From source file:Main.java

private static Drawable getRippleMask(int color) {
    ShapeDrawable shapeDrawable = new ShapeDrawable(new RectShape());
    shapeDrawable.getPaint().setColor(color);
    return shapeDrawable;
}

From source file:Main.java

public static ShapeDrawable getShapeDrawable(int size, int color) {
    ShapeDrawable circle = new ShapeDrawable(new OvalShape());
    circle.setIntrinsicHeight(size);//from ww w  .  ja va  2 s .  c  o  m
    circle.setIntrinsicWidth(size);
    circle.getPaint().setColor(color);
    return circle;
}

From source file:Main.java

/**
 * Make circle drawable for badge background
 *
 * @param color background color//from www.  ja v  a2  s. com
 * @return return colored circle drawable
 */
static ShapeDrawable makeShapeDrawable(int color) {
    ShapeDrawable badgeBackground = new ShapeDrawable(new OvalShape());
    badgeBackground.setIntrinsicWidth(10);
    badgeBackground.setIntrinsicHeight(10);
    badgeBackground.getPaint().setColor(color);
    return badgeBackground;
}

From source file:com.flexible.flexibleadapter.utils.DrawableUtils.java

private static Drawable getRippleMask(@ColorInt int color) {
    float[] outerRadii = new float[8];
    // 3 is the radius of final ripple, instead of 3 we can give required final radius
    Arrays.fill(outerRadii, 3);//from  w w w . j a  v a2  s . co  m
    RoundRectShape r = new RoundRectShape(outerRadii, null, null);
    ShapeDrawable shapeDrawable = new ShapeDrawable(r);
    shapeDrawable.getPaint().setColor(color);
    return shapeDrawable;
}

From source file:com.hellofyc.base.util.ViewUtils.java

public static ShapeDrawable make(int size, int color) {
    ShapeDrawable indicator = new ShapeDrawable(new OvalShape());
    indicator.setIntrinsicWidth(size);//www.  ja  v a2s .  c o m
    indicator.setIntrinsicHeight(size);
    indicator.getPaint().setColor(color);
    return indicator;
}