diff --git a/library/src/main/java/com/amulyakhare/textdrawable/TextDrawable.java b/library/src/main/java/com/amulyakhare/textdrawable/TextDrawable.java index db42f8b..6a4d845 100644 --- a/library/src/main/java/com/amulyakhare/textdrawable/TextDrawable.java +++ b/library/src/main/java/com/amulyakhare/textdrawable/TextDrawable.java @@ -51,7 +51,8 @@ private TextDrawable(Builder builder) { // border paint settings borderThickness = builder.borderThickness; borderPaint = new Paint(); - borderPaint.setColor(getDarkerShade(color)); + borderPaint.setColor(builder.borderColor == null ? getDarkerShade(color) : builder.borderColor); + borderPaint.setAntiAlias(true); borderPaint.setStyle(Paint.Style.STROKE); borderPaint.setStrokeWidth(borderThickness); @@ -144,6 +145,8 @@ public static class Builder implements IConfigBuilder, IShapeBuilder, IBuilder { private int borderThickness; + private Integer borderColor; + private int width; private int height; @@ -167,6 +170,7 @@ private Builder() { color = Color.GRAY; textColor = Color.WHITE; borderThickness = 0; + borderColor = null; width = -1; height = -1; shape = new RectShape(); @@ -176,41 +180,55 @@ private Builder() { toUpperCase = false; } + @Override public IConfigBuilder width(int width) { this.width = width; return this; } + @Override public IConfigBuilder height(int height) { this.height = height; return this; } + @Override public IConfigBuilder textColor(int color) { this.textColor = color; return this; } + @Override public IConfigBuilder withBorder(int thickness) { this.borderThickness = thickness; return this; } + @Override + public IConfigBuilder withBorderColor(int color) { + this.borderColor = color; + return this; + } + + @Override public IConfigBuilder useFont(Typeface font) { this.font = font; return this; } + @Override public IConfigBuilder fontSize(int size) { this.fontSize = size; return this; } + @Override public IConfigBuilder bold() { this.isBold = true; return this; } + @Override public IConfigBuilder toUpperCase() { this.toUpperCase = true; return this; @@ -281,6 +299,8 @@ public interface IConfigBuilder { public IConfigBuilder withBorder(int thickness); + public IConfigBuilder withBorderColor(int color); + public IConfigBuilder useFont(Typeface font); public IConfigBuilder fontSize(int size); @@ -313,4 +333,4 @@ public static interface IShapeBuilder { public TextDrawable buildRound(String text, int color); } -} \ No newline at end of file +}