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 7a60f30..a4bd152 100644 --- a/fancybuttons_library/src/main/java/mehdi/sakout/fancybuttons/FancyButton.java +++ b/fancybuttons_library/src/main/java/mehdi/sakout/fancybuttons/FancyButton.java @@ -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; diff --git a/fancybuttons_library/src/main/res/values/attrs.xml b/fancybuttons_library/src/main/res/values/attrs.xml index 4cd1d26..3c2db3e 100644 --- a/fancybuttons_library/src/main/res/values/attrs.xml +++ b/fancybuttons_library/src/main/res/values/attrs.xml @@ -1,34 +1,34 @@ - - + + - - + + - - + + - - - - - + + + + + - + - + @@ -45,17 +45,17 @@ - - - - + + + + - - - - + + + + - + \ No newline at end of file diff --git a/samples/src/main/res/layout/activity_xml_buttons.xml b/samples/src/main/res/layout/activity_xml_buttons.xml index 7037e6f..659e52a 100644 --- a/samples/src/main/res/layout/activity_xml_buttons.xml +++ b/samples/src/main/res/layout/activity_xml_buttons.xml @@ -26,16 +26,16 @@ android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:padding="10dp" - fancy:borderColor="#FFFFFF" - fancy:borderWidth="1dp" - fancy:defaultColor="#3b5998" - fancy:focusColor="#5577bd" - fancy:fontIconResource="@string/icon_like" - fancy:fontIconSize="10sp" - fancy:iconPosition="right" - fancy:radius="30dp" - fancy:text="Like my facebook page" - fancy:textColor="#FFFFFF"/> + fancy:fb_borderColor="#FFFFFF" + fancy:fb_borderWidth="1dp" + fancy:fb_defaultColor="#3b5998" + fancy:fb_focusColor="#5577bd" + fancy:fb_fontIconResource="@string/icon_like" + fancy:fb_fontIconSize="10sp" + fancy:fb_iconPosition="right" + fancy:fb_radius="30dp" + fancy:fb_text="Like my facebook page" + fancy:fb_textColor="#FFFFFF"/> + fancy:fb_borderColor="#FFFFFF" + fancy:fb_borderWidth="1dp" + fancy:fb_defaultColor="#3b5998" + fancy:fb_focusColor="#5577bd" + fancy:fb_fontIconResource="@string/icon_share" + fancy:fb_fontIconSize="10sp" + fancy:fb_iconPosition="right" + fancy:fb_iconPaddingLeft="20dp" + fancy:fb_iconPaddingRight= "0dp" + fancy:fb_radius="30dp" + fancy:fb_text="Share the link" + fancy:fb_textColor="#FFFFFF"/> + fancy:fb_borderColor="#FFFFFF" + fancy:fb_borderWidth="1dp" + fancy:fb_defaultColor="#3b5998" + fancy:fb_focusColor="#5577bd" + fancy:fb_fontIconResource="@string/icon_follow" + fancy:fb_fontIconSize="10sp" + fancy:fb_iconPosition="right" + fancy:fb_radius="30dp" + fancy:fb_text="Follow Mehdi Sakout" + fancy:fb_textColor="#FFFFFF" /> @@ -97,13 +97,13 @@ android:layout_height="wrap_content" android:layout_marginRight="10dp" android:padding="10dp" - fancy:defaultColor="#55acee" - fancy:focusColor="#313131" - fancy:iconResource="@drawable/twitter" - fancy:iconPaddingLeft="0dp" - fancy:iconPaddingRight="0dp" - fancy:radius="30dp" - fancy:textColor="#FFFFFF" /> + fancy:fb_defaultColor="#55acee" + fancy:fb_focusColor="#313131" + fancy:fb_iconResource="@drawable/twitter" + fancy:fb_iconPaddingLeft="0dp" + fancy:fb_iconPaddingRight="0dp" + fancy:fb_radius="30dp" + fancy:fb_textColor="#FFFFFF" /> + fancy:fb_defaultColor="#007ee5" + fancy:fb_iconPaddingLeft="0dp" + fancy:fb_iconPaddingRight="0dp" + fancy:fb_focusColor="#313131" + fancy:fb_iconResource="@drawable/dropbox" + fancy:fb_radius="30dp"> @@ -134,12 +134,12 @@ android:layout_height="wrap_content" android:layout_marginRight="10dp" android:padding="10dp" - fancy:defaultColor="#3f729b" - fancy:iconPaddingLeft="0dp" - fancy:iconPaddingRight="0dp" - fancy:focusColor="#313131" - fancy:iconResource="@drawable/instagram" - fancy:radius="30dp"> + fancy:fb_defaultColor="#3f729b" + fancy:fb_iconPaddingLeft="0dp" + fancy:fb_iconPaddingRight="0dp" + fancy:fb_focusColor="#313131" + fancy:fb_iconResource="@drawable/instagram" + fancy:fb_radius="30dp"> + fancy:fb_defaultColor="#ff8800" + fancy:fb_iconPaddingLeft="0dp" + fancy:fb_iconPaddingRight="0dp" + fancy:fb_focusColor="#313131" + fancy:fb_iconResource="@drawable/soundcloud" + fancy:fb_radius="30dp"> @@ -170,12 +170,12 @@ android:layout_height="wrap_content" android:layout_marginRight="10dp" android:padding="10dp" - fancy:defaultColor="#dd4b39" - fancy:iconPaddingLeft="0dp" - fancy:iconPaddingRight="0dp" - fancy:focusColor="#313131" - fancy:iconResource="@drawable/gplus" - fancy:radius="30dp"> + fancy:fb_defaultColor="#dd4b39" + fancy:fb_iconPaddingLeft="0dp" + fancy:fb_iconPaddingRight="0dp" + fancy:fb_focusColor="#313131" + fancy:fb_iconResource="@drawable/gplus" + fancy:fb_radius="30dp"> + fancy:fb_defaultColor="#000000" + fancy:fb_iconPaddingLeft="0dp" + fancy:fb_iconPaddingRight="0dp" + fancy:fb_focusColor="#313131" + fancy:fb_iconResource="@drawable/github" + fancy:fb_radius="30dp" > @@ -210,13 +210,13 @@ android:paddingLeft="20dp" android:paddingRight="20dp" android:paddingTop="10dp" - fancy:defaultColor="#7ab800" - fancy:focusColor="#9bd823" - fancy:fontIconResource="" - fancy:iconPosition="left" - fancy:radius="30dp" - fancy:text="SHUFFLE PLAY" - fancy:textColor="#FFFFFF" /> + fancy:fb_defaultColor="#7ab800" + fancy:fb_focusColor="#9bd823" + fancy:fb_fontIconResource="" + fancy:fb_iconPosition="left" + fancy:fb_radius="30dp" + fancy:fb_text="SHUFFLE PLAY" + fancy:fb_textColor="#FFFFFF" /> + fancy:fb_defaultColor="#7ab800" + fancy:fb_focusColor="#9bd823" + fancy:fb_fontIconResource="" + fancy:fb_iconPosition="left" + fancy:fb_radius="30dp" + fancy:fb_text="PAUSE" + fancy:fb_textColor="#FFFFFF" /> + fancy:fb_defaultColor="#222326" + fancy:fb_focusColor="#424243" + fancy:fb_radius="30dp" + fancy:fb_text="FOLOW" + fancy:fb_borderColor="#88898c" + fancy:fb_borderWidth="1dp" + fancy:fb_textColor="#dfe0d9" /> + fancy:fb_borderColor="#FFFFFF" + fancy:fb_borderWidth="2dp" + fancy:fb_defaultColor="#55acee" + fancy:fb_focusColor="#8cc9f8" + fancy:fb_iconPaddingLeft="40dp" + fancy:fb_iconResource="@drawable/twitter" + fancy:fb_text="Follow me on Twitter" + fancy:fb_textColor="#FFFFFF"/> + fancy:fb_borderColor="#FFFFFF" + fancy:fb_borderWidth="2dp" + fancy:fb_defaultColor="#55acee" + fancy:fb_focusColor="#8cc9f8" + fancy:fb_fontIconResource="@string/icon_user" + fancy:fb_fontIconSize="10sp" + fancy:fb_iconPosition="top" + fancy:fb_text="2145 followers" + fancy:fb_textColor="#FFFFFF"/> + fancy:fb_borderColor="#FFFFFF" + fancy:fb_borderWidth="1dp" + fancy:fb_defaultColor="#ff5f69" + fancy:fb_focusColor="#ff838b" + fancy:fb_radius="30dp" + fancy:fb_text="Create an account" + fancy:fb_textColor="#FFFFFF" > + fancy:fb_borderColor="#FFFFFF" + fancy:fb_borderWidth="1dp" + fancy:fb_defaultColor="#ff5f69" + fancy:fb_focusColor="#ff838b" + fancy:fb_fontIconResource="@string/icon_user" + fancy:fb_iconPosition="left" + fancy:fb_radius="30dp" + fancy:fb_text="Login" + fancy:fb_textColor="#FFFFFF" /> @@ -350,16 +350,16 @@ android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:padding="10dp" - fancy:borderColor="#FFFFFF" - fancy:borderWidth="2dp" - fancy:defaultColor="#3b414f" - fancy:focusColor="#8cc9f8" - fancy:fontIconResource="@string/icon_download" - fancy:fontIconSize="10sp" - fancy:iconPosition="top" - fancy:radius="10dp" - fancy:text="Download the file" - fancy:textColor="#FFFFFF"> + fancy:fb_borderColor="#FFFFFF" + fancy:fb_borderWidth="2dp" + fancy:fb_defaultColor="#3b414f" + fancy:fb_focusColor="#8cc9f8" + fancy:fb_fontIconResource="@string/icon_download" + fancy:fb_fontIconSize="10sp" + fancy:fb_iconPosition="top" + fancy:fb_radius="10dp" + fancy:fb_text="Download the file" + fancy:fb_textColor="#FFFFFF"> + fancy:fb_borderColor="#FFFFFF" + fancy:fb_borderWidth="2dp" + fancy:fb_defaultColor="#3b414f" + fancy:fb_focusColor="#8cc9f8" + fancy:fb_fontIconResource="@string/icon_upload" + fancy:fb_fontIconSize="10sp" + fancy:fb_radius="10dp" + fancy:fb_iconPosition="bottom" + fancy:fb_text="Upload" + fancy:fb_textColor="#FFFFFF"> @@ -392,16 +392,16 @@ android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:padding="10dp" - fancy:borderColor="#FFFFFF" - fancy:borderWidth="2dp" - fancy:defaultColor="#40a75a" - fancy:focusColor="#8cc9f8" - fancy:fontIconResource="@string/icon_user" - fancy:fontIconSize="15sp" - fancy:iconPosition="left" - fancy:text="Send" - fancy:radius="10dp" - fancy:textColor="#FFFFFF"> + fancy:fb_borderColor="#FFFFFF" + fancy:fb_borderWidth="2dp" + fancy:fb_defaultColor="#40a75a" + fancy:fb_focusColor="#8cc9f8" + fancy:fb_fontIconResource="@string/icon_user" + fancy:fb_fontIconSize="15sp" + fancy:fb_iconPosition="left" + fancy:fb_text="Send" + fancy:fb_radius="10dp" + fancy:fb_textColor="#FFFFFF"> @@ -416,16 +416,16 @@ android:layout_height="wrap_content" android:layout_marginRight="20dp" android:padding="10dp" - fancy:borderColor="#FFFFFF" - fancy:borderWidth="0dp" - fancy:defaultColor="#d86262" - fancy:focusColor="#2e5071" - fancy:fontIconResource="@string/icon_mute" - fancy:fontIconSize="10dp" - fancy:iconPosition="right" - fancy:radius="30dp" - fancy:text="Mute" - fancy:textColor="#ffffff" /> + fancy:fb_borderColor="#FFFFFF" + fancy:fb_borderWidth="0dp" + fancy:fb_defaultColor="#d86262" + fancy:fb_focusColor="#2e5071" + fancy:fb_fontIconResource="@string/icon_mute" + fancy:fb_fontIconSize="10dp" + fancy:fb_iconPosition="right" + fancy:fb_radius="30dp" + fancy:fb_text="Mute" + fancy:fb_textColor="#ffffff" /> + fancy:fb_defaultColor="#7ed862" + fancy:fb_focusColor="#2e5071" + fancy:fb_fontIconResource="@string/icon_answer" + fancy:fb_fontIconSize="10dp" + fancy:fb_iconPosition="right" + fancy:fb_radius="30dp" + fancy:fb_text="Answer the call" + fancy:fb_textColor="#ffffff" /> @@ -489,16 +489,16 @@ android:padding="15dp" android:paddingRight="20dp" android:paddingLeft="20dp" - fancy:ghost="true" - fancy:focusColor="#fffffefa" - fancy:fontIconResource="@string/icon_creditcard" - fancy:fontIconSize="5dp" - fancy:radius="40dp" - fancy:iconPosition="right" - fancy:borderWidth="2dp" - fancy:borderColor="#ffe7e6e2" - fancy:text="Deposit" - fancy:textColor="#ffffff" /> + fancy:fb_ghost="true" + fancy:fb_focusColor="#fffffefa" + fancy:fb_fontIconResource="@string/icon_creditcard" + fancy:fb_fontIconSize="5dp" + fancy:fb_radius="40dp" + fancy:fb_iconPosition="right" + fancy:fb_borderWidth="2dp" + fancy:fb_borderColor="#ffe7e6e2" + fancy:fb_text="Deposit" + fancy:fb_textColor="#ffffff" /> + fancy:fb_ghost="true" + fancy:fb_focusColor="#ffa8f192" + fancy:fb_fontIconResource="@string/icon_envelope" + fancy:fb_fontIconSize="5dp" + fancy:fb_radius="25dp" + fancy:fb_iconPosition="right" + fancy:fb_borderWidth="2dp" + fancy:fb_borderColor="#7ed862" + fancy:fb_text="Contact" + fancy:fb_textColor="#ffa8f192" />