Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permit Client Border Color #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -144,6 +145,8 @@ public static class Builder implements IConfigBuilder, IShapeBuilder, IBuilder {

private int borderThickness;

private Integer borderColor;

private int width;

private int height;
Expand All @@ -167,6 +170,7 @@ private Builder() {
color = Color.GRAY;
textColor = Color.WHITE;
borderThickness = 0;
borderColor = null;
width = -1;
height = -1;
shape = new RectShape();
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -313,4 +333,4 @@ public static interface IShapeBuilder {

public TextDrawable buildRound(String text, int color);
}
}
}