diff --git a/fancybuttons_library/src/main/java/mehdi/sakout/fancybuttons/FancyButton.java b/fancybuttons_library/src/main/java/mehdi/sakout/fancybuttons/FancyButton.java index ff7c595..f113788 100644 --- a/fancybuttons_library/src/main/java/mehdi/sakout/fancybuttons/FancyButton.java +++ b/fancybuttons_library/src/main/java/mehdi/sakout/fancybuttons/FancyButton.java @@ -30,6 +30,7 @@ public class FancyButton extends LinearLayout{ // # Text Attributes private int mDefaultTextColor = Color.WHITE; + private int mDefaultIconColor = Color.WHITE; private int mTextPosition = 1; private int mDefaultTextSize = 15; private int mDefaultTextGravity = 0x11; // Gravity.CENTER @@ -193,7 +194,7 @@ private TextView setupFontIconView(){ if(mFontIcon!=null){ TextView fontIconView = new TextView(mContext); - fontIconView.setTextColor(mDefaultTextColor); + fontIconView.setTextColor(mDefaultIconColor); LayoutParams iconTextViewParams = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT,1f); iconTextViewParams.rightMargin = mIconPaddingRight; @@ -269,6 +270,8 @@ private void initAttributsArray(TypedArray attrsArray){ mFocusBackgroundColor = attrsArray.getColor(R.styleable.FancyButtonsAttrs_focusColor,mFocusBackgroundColor); mDefaultTextColor = attrsArray.getColor(R.styleable.FancyButtonsAttrs_textColor,mDefaultTextColor); + // if default color is set then the icon's color is the same (the default for icon's color) + mDefaultIconColor = attrsArray.getColor(R.styleable.FancyButtonsAttrs_iconColor,mDefaultTextColor); mDefaultTextSize = (int) attrsArray.getDimension(R.styleable.FancyButtonsAttrs_textSize,mDefaultTextSize); mDefaultTextGravity = attrsArray.getInt(R.styleable.FancyButtonsAttrs_textGravity, mDefaultTextGravity); @@ -416,6 +419,16 @@ public void setTextColor(int color){ } + /** + * Setting the icon's color independent of the text color + * @param color : Color + */ + public void setIconColor(int color){ + if(mFontIconView != null) { + mFontIconView.setTextColor(color); + } + } + /** * Set Background color of the button * @param color : use Color.parse('#code') diff --git a/fancybuttons_library/src/main/res/values/attrs.xml b/fancybuttons_library/src/main/res/values/attrs.xml index b9ee786..7df9489 100644 --- a/fancybuttons_library/src/main/res/values/attrs.xml +++ b/fancybuttons_library/src/main/res/values/attrs.xml @@ -5,6 +5,7 @@ +