From 56a9a181b631fdba6fbcc6b697659439ae39123b Mon Sep 17 00:00:00 2001 From: Hamza Khan Date: Sat, 27 Jul 2019 18:56:00 +0500 Subject: [PATCH 1/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6870388..8200eb0 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ A smart switchable button,support multiple tabs. CLICK THE ***STAR*** if it's u ![](https://github.com/KingJA/SwitchButton/blob/master/img/mark.png) ## Gradle ```xml - compile 'lib.kingja.switchbutton:switchbutton:1.1.8' + implementation 'com.github.hamzaahmedkhan:SwitchButton:v1.1.3' ``` ## Usage From 087098b4a2bfa7fae8345b82fa47ca57457a3919 Mon Sep 17 00:00:00 2001 From: Hamza Khan Date: Sat, 27 Jul 2019 19:07:19 +0500 Subject: [PATCH 2/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8200eb0..8ed92ed 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ A smart switchable button,support multiple tabs. CLICK THE ***STAR*** if it's u ![](https://github.com/KingJA/SwitchButton/blob/master/img/mark.png) ## Gradle ```xml - implementation 'com.github.hamzaahmedkhan:SwitchButton:v1.1.3' + implementation 'lib.kingja.switchbutton:switchbutton:1.1.8' ``` ## Usage From 095a9442fc4191b94e12d6a7e4830448f02fd146 Mon Sep 17 00:00:00 2001 From: Hamza Khan Date: Sat, 27 Jul 2019 19:33:51 +0500 Subject: [PATCH 3/6] push v1.1.8 --- ChangeLogs.md | 6 ++++++ gradle.properties | 2 +- libk-switchbutton/build.gradle | 2 +- .../kingja/switchbutton/SwitchMultiButton.java | 18 +++++++++++++++--- libk-switchbutton/src/main/res/values/attr.xml | 3 +++ 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/ChangeLogs.md b/ChangeLogs.md index 9d58cbb..fd94a02 100644 --- a/ChangeLogs.md +++ b/ChangeLogs.md @@ -1,3 +1,9 @@ +**v1.1.9** +- Add attribute 'strokeColor' +- Add attribute 'selectedTextColor' +- Add attribute 'unSelectedTextColor' + + **v1.1.8** - support setEnable - support attr 'disableColor' diff --git a/gradle.properties b/gradle.properties index da4b76e..ba7f24c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=1.1.8 +VERSION_NAME=1.1.9 VERSION_CODE=2019011001 COMPILE_SDK_VERSION = 27 BUILD_TOOLS_VERSION = 27.0.3 diff --git a/libk-switchbutton/build.gradle b/libk-switchbutton/build.gradle index 3eb925e..c9df5ac 100644 --- a/libk-switchbutton/build.gradle +++ b/libk-switchbutton/build.gradle @@ -29,7 +29,7 @@ publish { artifactId = 'switchbutton' userOrg = 'kingja' groupId = 'lib.kingja.switchbutton' - publishVersion = '1.1.8' + publishVersion = '1.1.9' desc = 'A smart switchable button,support multiple tabs.' website = 'https://github.com/KingJA/SwitchButton' } diff --git a/libk-switchbutton/src/main/java/lib/kingja/switchbutton/SwitchMultiButton.java b/libk-switchbutton/src/main/java/lib/kingja/switchbutton/SwitchMultiButton.java index cac9e9f..c3a7504 100644 --- a/libk-switchbutton/src/main/java/lib/kingja/switchbutton/SwitchMultiButton.java +++ b/libk-switchbutton/src/main/java/lib/kingja/switchbutton/SwitchMultiButton.java @@ -63,6 +63,9 @@ public class SwitchMultiButton extends View { private float mStrokeRadius; private float mStrokeWidth; private int mSelectedColor; + private int mStrokeColor; + private int mSelectedTextColor; + private int mUnSelectedTextColor; private int mDisableColor; private float mTextSize; private int mSelectedTab; @@ -99,6 +102,9 @@ private void initAttrs(Context context, AttributeSet attrs) { mStrokeWidth = typedArray.getDimension(R.styleable.SwitchMultiButton_strokeWidth, STROKE_WIDTH); mTextSize = typedArray.getDimension(R.styleable.SwitchMultiButton_textSize, TEXT_SIZE); mSelectedColor = typedArray.getColor(R.styleable.SwitchMultiButton_selectedColor, SELECTED_COLOR); + mStrokeColor = typedArray.getColor(R.styleable.SwitchMultiButton_strokeColor, SELECTED_COLOR); + mSelectedTextColor = typedArray.getColor(R.styleable.SwitchMultiButton_selectedTextColor, SELECTED_COLOR); + mUnSelectedTextColor = typedArray.getColor(R.styleable.SwitchMultiButton_unSelectedTextColor, SELECTED_COLOR); mDisableColor = typedArray.getColor(R.styleable.SwitchMultiButton_disableColor, DISABLE_COLOR); mSelectedTab = typedArray.getInteger(R.styleable.SwitchMultiButton_selectedTab, SELECTED_TAB); String mTypeface = typedArray.getString(R.styleable.SwitchMultiButton_typeface); @@ -119,7 +125,7 @@ private void initAttrs(Context context, AttributeSet attrs) { private void initPaint() { // round rectangle paint mStrokePaint = new Paint(); - mStrokePaint.setColor(mSelectedColor); + mStrokePaint.setColor(mStrokeColor); mStrokePaint.setStyle(Paint.Style.STROKE); mStrokePaint.setAntiAlias(true); mStrokePaint.setStrokeWidth(mStrokeWidth); @@ -131,12 +137,12 @@ private void initPaint() { // selected text paint mSelectedTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); mSelectedTextPaint.setTextSize(mTextSize); - mSelectedTextPaint.setColor(0xffffffff); + mSelectedTextPaint.setColor(mSelectedTextColor); mStrokePaint.setAntiAlias(true); // unselected text paint mUnselectedTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); mUnselectedTextPaint.setTextSize(mTextSize); - mUnselectedTextPaint.setColor(mSelectedColor); + mUnselectedTextPaint.setColor(mUnSelectedTextColor); mStrokePaint.setAntiAlias(true); mTextHeightOffset = -(mSelectedTextPaint.ascent() + mSelectedTextPaint.descent()) * 0.5f; mFontMetrics = mSelectedTextPaint.getFontMetrics(); @@ -427,6 +433,9 @@ protected Parcelable onSaveInstanceState() { bundle.putFloat("StrokeWidth", mStrokeWidth); bundle.putFloat("TextSize", mTextSize); bundle.putInt("SelectedColor", mSelectedColor); + bundle.putInt("StrokeColor", mStrokeColor); + bundle.putInt("SelectedTextColor", mSelectedTextColor); + bundle.putInt("UnSelectedTextColor", mUnSelectedTextColor); bundle.putInt("DisableColor", mDisableColor); bundle.putInt("SelectedTab", mSelectedTab); bundle.putBoolean("Enable", mEnable); @@ -441,6 +450,9 @@ protected void onRestoreInstanceState(Parcelable state) { mStrokeWidth = bundle.getFloat("StrokeWidth"); mTextSize = bundle.getFloat("TextSize"); mSelectedColor = bundle.getInt("SelectedColor"); + mStrokeColor = bundle.getInt("StrokeColor"); + mSelectedTextColor = bundle.getInt("SelectedTextColor"); + mUnSelectedTextColor = bundle.getInt("UnSelectedTextColor"); mDisableColor = bundle.getInt("DisableColor"); mSelectedTab = bundle.getInt("SelectedTab"); mEnable = bundle.getBoolean("Enable"); diff --git a/libk-switchbutton/src/main/res/values/attr.xml b/libk-switchbutton/src/main/res/values/attr.xml index 37ea8a9..b7f7055 100644 --- a/libk-switchbutton/src/main/res/values/attr.xml +++ b/libk-switchbutton/src/main/res/values/attr.xml @@ -3,6 +3,9 @@ + + + From ca1c03b9dbe53a3a628a72d584ac90feb3d98352 Mon Sep 17 00:00:00 2001 From: Hamza Khan Date: Sat, 27 Jul 2019 19:39:44 +0500 Subject: [PATCH 4/6] push v1.1.9 --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 8ed92ed..0c7e3fc 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,9 @@ A smart switchable button,support multiple tabs. CLICK THE ***STAR*** if it's u | strokeWidth | dimension | app:strokeWidth="2dp" | | textSize | dimension | app:textSize="16sp" | | selectedColor | color/reference | app:selectedColor="@color/red" | +| strokeColor | color/reference | app:strokeColor="@color/red" | +| selectedTextColor | color/reference | app:selectedTextColor="@color/red" | +| unSelectedTextColor | color/reference | app:unSelectedTextColor="@color/red" | | disableColor | color/reference | app:selectedColor="@color/gray" | | selectedTab | integer | app:selectedTab="1" | | switchTabs | reference | app:switchTabs="@array/switch_tabs" | @@ -32,6 +35,9 @@ A smart switchable button,support multiple tabs. CLICK THE ***STAR*** if it's u app:strokeWidth="1dp" app:selectedTab="0" app:selectedColor="#eb7b00" + app:selectedTextColor="#ffffff" + app:strokeColor="#ffffff" + app:unSelectedTextColor="#ffffff" app:switchTabs="@array/switch_tabs" app:typeface="DeVinneTxtBT.ttf" app:textSize="14sp" /> From 287b1448a8bebaf457da319694b655797b49c745 Mon Sep 17 00:00:00 2001 From: Hamza Khan Date: Sat, 27 Jul 2019 19:41:54 +0500 Subject: [PATCH 5/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0c7e3fc..0efad3f 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ A smart switchable button,support multiple tabs. CLICK THE ***STAR*** if it's u ![](https://github.com/KingJA/SwitchButton/blob/master/img/mark.png) ## Gradle ```xml - implementation 'lib.kingja.switchbutton:switchbutton:1.1.8' + implementation 'lib.kingja.switchbutton:switchbutton:1.1.9' ``` ## Usage From d42956dcd380e90d278d8e38bbd4b0e66f1bb525 Mon Sep 17 00:00:00 2001 From: Hamza Khan Date: Sun, 28 Jul 2019 14:41:09 +0500 Subject: [PATCH 6/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0efad3f..0275239 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ A smart switchable button,support multiple tabs. CLICK THE ***STAR*** if it's u ![](https://github.com/KingJA/SwitchButton/blob/master/img/mark.png) ## Gradle ```xml - implementation 'lib.kingja.switchbutton:switchbutton:1.1.9' + implementation 'com.github.hamzaahmedkhan:SwitchButton:v2.0.0' ``` ## Usage