diff --git a/build.gradle b/build.gradle
index 40c5c5e..ac050e9 100644
--- a/build.gradle
+++ b/build.gradle
@@ -29,4 +29,4 @@ allprojects {
}
}
-apply plugin: 'android-reporting'
\ No newline at end of file
+//apply plugin: 'android-reporting'
\ No newline at end of file
diff --git a/library/src/main/java/info/hoang8f/android/segmented/SegmentedGroup.java b/library/src/main/java/info/hoang8f/android/segmented/SegmentedGroup.java
index ac5c709..8508f53 100644
--- a/library/src/main/java/info/hoang8f/android/segmented/SegmentedGroup.java
+++ b/library/src/main/java/info/hoang8f/android/segmented/SegmentedGroup.java
@@ -21,9 +21,11 @@ public class SegmentedGroup extends RadioGroup {
private int mMarginDp;
private Resources resources;
private int mTintColor;
+ private int mTextColor = Color.CYAN;
private int mCheckedTextColor = Color.WHITE;
private LayoutSelector mLayoutSelector;
private Float mCornerRadius;
+ private boolean mDrawCheckedDrawable = true;
public SegmentedGroup(Context context) {
super(context);
@@ -54,6 +56,10 @@ private void initAttrs(AttributeSet attrs) {
R.styleable.SegmentedGroup_tint_color,
getResources().getColor(R.color.radio_button_selected_color));
+ mTextColor = typedArray.getColor(
+ R.styleable.SegmentedGroup_text_color,
+ getResources().getColor(android.R.color.holo_blue_bright));
+
mCheckedTextColor = typedArray.getColor(
R.styleable.SegmentedGroup_checked_text_color,
getResources().getColor(android.R.color.white));
@@ -80,6 +86,12 @@ protected void onFinishInflate() {
updateBackground();
}
+ public void setTextColor(int textColor)
+ {
+ mTextColor = textColor;
+ updateBackground();
+ }
+
public void setTintColor(int tintColor) {
mTintColor = tintColor;
updateBackground();
@@ -91,6 +103,11 @@ public void setTintColor(int tintColor, int checkedTextColor) {
updateBackground();
}
+ public void setDrawCheckedDrawable(boolean b) {
+ mDrawCheckedDrawable = b;
+ updateBackground();
+ }
+
public void updateBackground() {
int count = super.getChildCount();
for (int i = 0; i < count; i++) {
@@ -120,13 +137,14 @@ private void updateBackground(View view) {
{android.R.attr.state_pressed},
{-android.R.attr.state_pressed, -android.R.attr.state_checked},
{-android.R.attr.state_pressed, android.R.attr.state_checked}},
- new int[]{Color.GRAY, mTintColor, mCheckedTextColor});
+ new int[]{Color.GRAY, mTextColor, mCheckedTextColor});
((Button) view).setTextColor(colorStateList);
//Redraw with tint color
Drawable checkedDrawable = resources.getDrawable(checked).mutate();
Drawable uncheckedDrawable = resources.getDrawable(unchecked).mutate();
- ((GradientDrawable) checkedDrawable).setColor(mTintColor);
+ if(mDrawCheckedDrawable)
+ ((GradientDrawable) checkedDrawable).setColor(mTintColor);
((GradientDrawable) checkedDrawable).setStroke(mMarginDp, mTintColor);
((GradientDrawable) uncheckedDrawable).setStroke(mMarginDp, mTintColor);
//Set proper radius
diff --git a/library/src/main/res/drawable/button_text_color.xml b/library/src/main/res/drawable/button_text_color.xml
index 4ec1dcc..bb91507 100644
--- a/library/src/main/res/drawable/button_text_color.xml
+++ b/library/src/main/res/drawable/button_text_color.xml
@@ -2,6 +2,6 @@
-
+
\ No newline at end of file
diff --git a/library/src/main/res/drawable/radio_checked.xml b/library/src/main/res/drawable/radio_checked.xml
index 74ae7d6..d94dd62 100644
--- a/library/src/main/res/drawable/radio_checked.xml
+++ b/library/src/main/res/drawable/radio_checked.xml
@@ -3,7 +3,12 @@
android:shape="rectangle"
android:padding="10dp">
-
+
+
diff --git a/library/src/main/res/values/attrs.xml b/library/src/main/res/values/attrs.xml
index c6fb61b..2a35f58 100644
--- a/library/src/main/res/values/attrs.xml
+++ b/library/src/main/res/values/attrs.xml
@@ -4,6 +4,7 @@
+
diff --git a/library/src/main/res/values/colors.xml b/library/src/main/res/values/colors.xml
index 5b96dbd..6601b19 100644
--- a/library/src/main/res/values/colors.xml
+++ b/library/src/main/res/values/colors.xml
@@ -1,5 +1,6 @@
#ff33b5e5
+ #ff33b5e5
@android:color/transparent
\ No newline at end of file