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);
}
}
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;
}
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;
}
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);
}
Aggregations