diff --git a/TextDrawableCon.iml b/TextDrawableCon.iml new file mode 100644 index 0000000..ac8ce98 --- /dev/null +++ b/TextDrawableCon.iml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 3a8a17e..613bd84 100644 --- a/build.gradle +++ b/build.gradle @@ -3,9 +3,14 @@ buildscript { repositories { jcenter() + maven { + url 'https://maven.google.com/' + name 'Google' + } + google() } dependencies { - classpath 'com.android.tools.build:gradle:1.0.0' + classpath 'com.android.tools.build:gradle:3.1.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } @@ -14,5 +19,9 @@ buildscript { allprojects { repositories { jcenter() + maven { + url 'https://maven.google.com/' + name 'Google' + } } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ae048bb..1f61f6b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sun Jan 04 21:42:37 SGT 2015 +#Sat May 05 14:49:26 BRT 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip diff --git a/library/build.gradle b/library/build.gradle index ed83687..d41f736 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' android { compileSdkVersion 21 - buildToolsVersion "21.1.1" + buildToolsVersion '27.0.3' defaultConfig { minSdkVersion 10 @@ -19,7 +19,7 @@ android { } dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) + implementation fileTree(dir: 'libs', include: ['*.jar']) } sourceSets { diff --git a/library/library.iml b/library/library.iml index fd9647f..67b8e45 100644 --- a/library/library.iml +++ b/library/library.iml @@ -1,5 +1,5 @@ - + @@ -11,80 +11,94 @@ - + + + - - - - - - - + + + + + + + + + - + + + + + + + + + + + + + + + - + + + + + + + + - - - - - - - - + + + - - - - - - + + + - - - - + \ No newline at end of file diff --git a/library/src/main/java/com/amulyakhare/textdrawable/TextDrawable.java b/library/src/main/java/com/amulyakhare/textdrawable/TextDrawable.java index db42f8b..55f8ee4 100644 --- a/library/src/main/java/com/amulyakhare/textdrawable/TextDrawable.java +++ b/library/src/main/java/com/amulyakhare/textdrawable/TextDrawable.java @@ -23,6 +23,7 @@ public class TextDrawable extends ShapeDrawable { private final int fontSize; private final float radius; private final int borderThickness; + private final int borderColor; private TextDrawable(Builder builder) { super(builder.shape); @@ -50,10 +51,17 @@ private TextDrawable(Builder builder) { // border paint settings borderThickness = builder.borderThickness; + borderColor = builder.borderColor; borderPaint = new Paint(); - borderPaint.setColor(getDarkerShade(color)); + if (borderColor == 0) + borderPaint.setColor(getDarkerShade(color)); + else { + borderPaint.setColor(getDarkerShade(borderColor)); + } borderPaint.setStyle(Paint.Style.STROKE); borderPaint.setStrokeWidth(borderThickness); + borderPaint.setAntiAlias(true); + // drawable paint color Paint paint = getPaint(); @@ -144,6 +152,8 @@ public static class Builder implements IConfigBuilder, IShapeBuilder, IBuilder { private int borderThickness; + private int borderColor; + private int width; private int height; @@ -167,6 +177,7 @@ private Builder() { color = Color.GRAY; textColor = Color.WHITE; borderThickness = 0; + borderColor = 0; width = -1; height = -1; shape = new RectShape(); @@ -196,6 +207,12 @@ public IConfigBuilder withBorder(int thickness) { return this; } + public IConfigBuilder withBorder(int thickness, int color) { + this.borderColor = color; + this.borderThickness = thickness; + return this; + } + public IConfigBuilder useFont(Typeface font) { this.font = font; return this; @@ -279,6 +296,8 @@ public interface IConfigBuilder { public IConfigBuilder textColor(int color); + public IConfigBuilder withBorder(int thickness, int color); + public IConfigBuilder withBorder(int thickness); public IConfigBuilder useFont(Typeface font); diff --git a/sample/build.gradle b/sample/build.gradle index 85e0728..7727fca 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 21 - buildToolsVersion "21.1.1" + buildToolsVersion '27.0.3' defaultConfig { applicationId "com.amulyakhare.td" @@ -20,7 +20,7 @@ android { } dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - compile project(':library') - compile 'com.android.support:appcompat-v7:21.0.3' + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation project(':library') + implementation 'com.android.support:appcompat-v7:21.0.3' } \ No newline at end of file diff --git a/sample/sample.iml b/sample/sample.iml index b303902..0850248 100644 --- a/sample/sample.iml +++ b/sample/sample.iml @@ -1,5 +1,5 @@ - + @@ -11,9 +11,9 @@ - + + + - - - - - - - + + + + + + + + + - + + + + + + + + + + + + + + + - + - - - - - - - - + + + + + + + + + + - - - - - - + + - - - - - + + + + - - + \ No newline at end of file