Search in sources :

Example 11 with RoundRectShape

use of android.graphics.drawable.shapes.RoundRectShape in project Timber by naman14.

the class TextDrawable method drawBorder.

private void drawBorder(Canvas canvas) {
    RectF rect = new RectF(getBounds());
    rect.inset(borderThickness / 2, borderThickness / 2);
    if (shape instanceof OvalShape) {
        canvas.drawOval(rect, borderPaint);
    } else if (shape instanceof RoundRectShape) {
        canvas.drawRoundRect(rect, radius, radius, borderPaint);
    } else {
        canvas.drawRect(rect, borderPaint);
    }
}
Also used : RectF(android.graphics.RectF) RoundRectShape(android.graphics.drawable.shapes.RoundRectShape) OvalShape(android.graphics.drawable.shapes.OvalShape)

Example 12 with RoundRectShape

use of android.graphics.drawable.shapes.RoundRectShape in project FloatingActionButton by Clans.

the class Label method createRectDrawable.

private Drawable createRectDrawable(int color) {
    RoundRectShape shape = new RoundRectShape(new float[] { mCornerRadius, mCornerRadius, mCornerRadius, mCornerRadius, mCornerRadius, mCornerRadius, mCornerRadius, mCornerRadius }, null, null);
    ShapeDrawable shapeDrawable = new ShapeDrawable(shape);
    shapeDrawable.getPaint().setColor(color);
    return shapeDrawable;
}
Also used : RoundRectShape(android.graphics.drawable.shapes.RoundRectShape) ShapeDrawable(android.graphics.drawable.ShapeDrawable)

Example 13 with RoundRectShape

use of android.graphics.drawable.shapes.RoundRectShape in project SublimePicker by vikramkakkar.

the class SUtils method createBgDrawable.

// Creates a drawable with the supplied color and corner radii
public static Drawable createBgDrawable(int color, int rTopLeft, int rTopRight, int rBottomRight, int rBottomLeft) {
    float[] outerRadii = new float[8];
    outerRadii[0] = rTopLeft;
    outerRadii[1] = rTopLeft;
    outerRadii[2] = rTopRight;
    outerRadii[3] = rTopRight;
    outerRadii[4] = rBottomRight;
    outerRadii[5] = rBottomRight;
    outerRadii[6] = rBottomLeft;
    outerRadii[7] = rBottomLeft;
    RoundRectShape r = new RoundRectShape(outerRadii, null, null);
    ShapeDrawable shapeDrawable = new ShapeDrawable(r);
    shapeDrawable.getPaint().setColor(color);
    return shapeDrawable;
}
Also used : RoundRectShape(android.graphics.drawable.shapes.RoundRectShape) ShapeDrawable(android.graphics.drawable.ShapeDrawable)

Example 14 with RoundRectShape

use of android.graphics.drawable.shapes.RoundRectShape in project SublimePicker by vikramkakkar.

the class SUtils method createButtonShape.

// Base button shape
private static Drawable createButtonShape(Context context, int color) {
    // Translation of Lollipop's xml button-bg definition to Java
    int paddingH = context.getResources().getDimensionPixelSize(R.dimen.button_padding_horizontal_material);
    int paddingV = context.getResources().getDimensionPixelSize(R.dimen.button_padding_vertical_material);
    int insetH = context.getResources().getDimensionPixelSize(R.dimen.button_inset_horizontal_material);
    int insetV = context.getResources().getDimensionPixelSize(R.dimen.button_inset_vertical_material);
    float[] outerRadii = new float[8];
    Arrays.fill(outerRadii, CORNER_RADIUS);
    RoundRectShape r = new RoundRectShape(outerRadii, null, null);
    ShapeDrawable shapeDrawable = new ShapeDrawable(r);
    shapeDrawable.getPaint().setColor(color);
    shapeDrawable.setPadding(paddingH, paddingV, paddingH, paddingV);
    return new InsetDrawable(shapeDrawable, insetH, insetV, insetH, insetV);
}
Also used : RoundRectShape(android.graphics.drawable.shapes.RoundRectShape) ShapeDrawable(android.graphics.drawable.ShapeDrawable) InsetDrawable(android.graphics.drawable.InsetDrawable)

Aggregations

RoundRectShape (android.graphics.drawable.shapes.RoundRectShape)14 ShapeDrawable (android.graphics.drawable.ShapeDrawable)12 RectF (android.graphics.RectF)3 TypedArray (android.content.res.TypedArray)2 Drawable (android.graphics.drawable.Drawable)2 InsetDrawable (android.graphics.drawable.InsetDrawable)2 LayerDrawable (android.graphics.drawable.LayerDrawable)2 StateListDrawable (android.graphics.drawable.StateListDrawable)2 OvalShape (android.graphics.drawable.shapes.OvalShape)2 Attributes (com.cengalabs.flatui.Attributes)2 SuppressLint (android.annotation.SuppressLint)1 Typeface (android.graphics.Typeface)1 TouchEffectAnimator (com.cengalabs.flatui.TouchEffectAnimator)1