Skip to content

Commit

Permalink
Added a default namespace to fancybuttons attributes to avoid conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
medyo committed Jun 4, 2015
1 parent e463437 commit 9d9bab9
Show file tree
Hide file tree
Showing 3 changed files with 234 additions and 234 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,39 +268,39 @@ private ImageView setupIconView(){
*/
private void initAttributsArray(TypedArray attrsArray){

mDefaultBackgroundColor = attrsArray.getColor(R.styleable.FancyButtonsAttrs_defaultColor,mDefaultBackgroundColor);
mFocusBackgroundColor = attrsArray.getColor(R.styleable.FancyButtonsAttrs_focusColor,mFocusBackgroundColor);
mDefaultBackgroundColor = attrsArray.getColor(R.styleable.FancyButtonsAttrs_fb_defaultColor,mDefaultBackgroundColor);
mFocusBackgroundColor = attrsArray.getColor(R.styleable.FancyButtonsAttrs_fb_focusColor,mFocusBackgroundColor);

mDefaultTextColor = attrsArray.getColor(R.styleable.FancyButtonsAttrs_textColor,mDefaultTextColor);
mDefaultTextColor = attrsArray.getColor(R.styleable.FancyButtonsAttrs_fb_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);
mDefaultIconColor = attrsArray.getColor(R.styleable.FancyButtonsAttrs_fb_iconColor,mDefaultTextColor);
mDefaultTextSize = (int) attrsArray.getDimension(R.styleable.FancyButtonsAttrs_fb_textSize,mDefaultTextSize);
mDefaultTextGravity = attrsArray.getInt(R.styleable.FancyButtonsAttrs_fb_textGravity, mDefaultTextGravity);

mBorderColor = attrsArray.getColor(R.styleable.FancyButtonsAttrs_borderColor,mBorderColor);
mBorderWidth = (int) attrsArray.getDimension(R.styleable.FancyButtonsAttrs_borderWidth,mBorderWidth);
mBorderColor = attrsArray.getColor(R.styleable.FancyButtonsAttrs_fb_borderColor,mBorderColor);
mBorderWidth = (int) attrsArray.getDimension(R.styleable.FancyButtonsAttrs_fb_borderWidth,mBorderWidth);

mRadius = (int)attrsArray.getDimension(R.styleable.FancyButtonsAttrs_radius,mRadius);
mFontIconSize = (int)attrsArray.getDimension(R.styleable.FancyButtonsAttrs_fontIconSize,mFontIconSize);
mRadius = (int)attrsArray.getDimension(R.styleable.FancyButtonsAttrs_fb_radius,mRadius);
mFontIconSize = (int)attrsArray.getDimension(R.styleable.FancyButtonsAttrs_fb_fontIconSize,mFontIconSize);

mIconPaddingLeft = (int)attrsArray.getDimension(R.styleable.FancyButtonsAttrs_iconPaddingLeft,mIconPaddingLeft);
mIconPaddingRight = (int)attrsArray.getDimension(R.styleable.FancyButtonsAttrs_iconPaddingRight,mIconPaddingRight);
mIconPaddingTop = (int)attrsArray.getDimension(R.styleable.FancyButtonsAttrs_iconPaddingTop,mIconPaddingTop);
mIconPaddingBottom = (int)attrsArray.getDimension(R.styleable.FancyButtonsAttrs_iconPaddingBottom,mIconPaddingBottom);
mIconPaddingLeft = (int)attrsArray.getDimension(R.styleable.FancyButtonsAttrs_fb_iconPaddingLeft,mIconPaddingLeft);
mIconPaddingRight = (int)attrsArray.getDimension(R.styleable.FancyButtonsAttrs_fb_iconPaddingRight,mIconPaddingRight);
mIconPaddingTop = (int)attrsArray.getDimension(R.styleable.FancyButtonsAttrs_fb_iconPaddingTop,mIconPaddingTop);
mIconPaddingBottom = (int)attrsArray.getDimension(R.styleable.FancyButtonsAttrs_fb_iconPaddingBottom,mIconPaddingBottom);

mGhost = attrsArray.getBoolean(R.styleable.FancyButtonsAttrs_ghost, mGhost);
mGhost = attrsArray.getBoolean(R.styleable.FancyButtonsAttrs_fb_ghost, mGhost);

String text = attrsArray.getString(R.styleable.FancyButtonsAttrs_text);
mIconPosition = attrsArray.getInt(R.styleable.FancyButtonsAttrs_iconPosition,mIconPosition);
String text = attrsArray.getString(R.styleable.FancyButtonsAttrs_fb_text);
mIconPosition = attrsArray.getInt(R.styleable.FancyButtonsAttrs_fb_iconPosition,mIconPosition);

String fontIcon = attrsArray.getString(R.styleable.FancyButtonsAttrs_fontIconResource);
String fontIcon = attrsArray.getString(R.styleable.FancyButtonsAttrs_fb_fontIconResource);

String iconFontFamily = attrsArray.getString(R.styleable.FancyButtonsAttrs_iconFont);
String textFontFamily = attrsArray.getString(R.styleable.FancyButtonsAttrs_textFont);
String iconFontFamily = attrsArray.getString(R.styleable.FancyButtonsAttrs_fb_iconFont);
String textFontFamily = attrsArray.getString(R.styleable.FancyButtonsAttrs_fb_textFont);

Drawable icon = null;
try{
mIconResource = attrsArray.getDrawable(R.styleable.FancyButtonsAttrs_iconResource);
mIconResource = attrsArray.getDrawable(R.styleable.FancyButtonsAttrs_fb_iconResource);

}catch(Exception e){
mIconResource = null;
Expand Down
44 changes: 22 additions & 22 deletions fancybuttons_library/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="FancyButtonsAttrs">
<attr name="defaultColor" format="color" />
<attr name="text" format="string" />
<attr name="fb_defaultColor" format="color" />
<attr name="fb_text" format="string" />

<attr name="textColor" format="color" />
<attr name="iconColor" format="color" />
<attr name="fb_textColor" format="color" />
<attr name="fb_iconColor" format="color" />

<attr name="textFont" format="string" />
<attr name="iconFont" format="string" />
<attr name="fb_textFont" format="string" />
<attr name="fb_iconFont" format="string" />

<attr name="textSize" format="dimension" />
<attr name="iconResource" format="integer" />
<attr name="fontIconResource" format="string" />
<attr name="fontIconSize" format="dimension" />
<attr name="iconPosition" format="enum">
<attr name="fb_textSize" format="dimension" />
<attr name="fb_iconResource" format="integer" />
<attr name="fb_fontIconResource" format="string" />
<attr name="fb_fontIconSize" format="dimension" />
<attr name="fb_iconPosition" format="enum">
<enum name="left" value="1" />
<enum name="right" value="2" />
<enum name="top" value="3" />
<enum name="bottom" value="4" />
</attr>

<attr name="textPosition" format="enum">
<attr name="fb_textPosition" format="enum">
<enum name="left" value="1" />
<enum name="right" value="2" />
<enum name="top" value="3" />
<enum name="bottom" value="4" />
</attr>

<attr name="textGravity" format="enum">
<attr name="fb_textGravity" format="enum">
<enum name="top" value="0x30" />
<enum name="bottom" value="0x50" />
<enum name="left" value="0x03" />
Expand All @@ -45,17 +45,17 @@
<enum name="end" value="0x00800005" />
</attr>

<attr name="iconPaddingLeft" format="dimension" />
<attr name="iconPaddingRight" format="dimension" />
<attr name="iconPaddingTop" format="dimension" />
<attr name="iconPaddingBottom" format="dimension" />
<attr name="fb_iconPaddingLeft" format="dimension" />
<attr name="fb_iconPaddingRight" format="dimension" />
<attr name="fb_iconPaddingTop" format="dimension" />
<attr name="fb_iconPaddingBottom" format="dimension" />

<attr name="borderColor" format="color" />
<attr name="borderWidth" format="dimension"/>
<attr name="focusColor" format="color" />
<attr name="radius" format="dimension" />
<attr name="fb_borderColor" format="color" />
<attr name="fb_borderWidth" format="dimension"/>
<attr name="fb_focusColor" format="color" />
<attr name="fb_radius" format="dimension" />

<attr name="ghost" format="boolean"></attr>
<attr name="fb_ghost" format="boolean"></attr>
</declare-styleable>

</resources>
Loading

0 comments on commit 9d9bab9

Please sign in to comment.