From e5d2a28a4ef4bf42788305618e14adffd78b49a3 Mon Sep 17 00:00:00 2001 From: Stephen Niedzielski Date: Sun, 22 Feb 2015 17:33:50 -0700 Subject: [PATCH] Permit Client Border Color --- .../com/amulyakhare/textdrawable/TextDrawable.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/amulyakhare/textdrawable/TextDrawable.java b/library/src/main/java/com/amulyakhare/textdrawable/TextDrawable.java index db42f8b..9436284 100644 --- a/library/src/main/java/com/amulyakhare/textdrawable/TextDrawable.java +++ b/library/src/main/java/com/amulyakhare/textdrawable/TextDrawable.java @@ -51,7 +51,7 @@ 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.setStyle(Paint.Style.STROKE); borderPaint.setStrokeWidth(borderThickness); @@ -144,6 +144,8 @@ public static class Builder implements IConfigBuilder, IShapeBuilder, IBuilder { private int borderThickness; + private Integer borderColor; + private int width; private int height; @@ -167,6 +169,7 @@ private Builder() { color = Color.GRAY; textColor = Color.WHITE; borderThickness = 0; + borderColor = null; width = -1; height = -1; shape = new RectShape(); @@ -196,6 +199,11 @@ public IConfigBuilder withBorder(int thickness) { return this; } + public IConfigBuilder withBorderColor(int color) { + this.borderColor = color; + return this; + } + public IConfigBuilder useFont(Typeface font) { this.font = font; return this; @@ -281,6 +289,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 +323,4 @@ public static interface IShapeBuilder { public TextDrawable buildRound(String text, int color); } -} \ No newline at end of file +}