Skip to content
This repository was archived by the owner on Oct 23, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Watch a short **[Demo Video](https://youtu.be/XngUY3PN1IQ)** on YouTube or try i
- Option to disable shadow for buttons and (or) labels
- Option to set custom animations
- Option to set custom icon drawable
- Support for **normal** `56dp` and **mini** `40dp` button sizes
- Support for **normal** `56dp` and **mini** `40dp` standard button sizes, but also **big** `72dp`
- Custom FloatingActionMenu icon animations
- Option to expand menu up and down
- Option to show labels to the left and to the right of the menu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class FloatingActionButton extends ImageButton {

public static final int SIZE_NORMAL = 0;
public static final int SIZE_MINI = 1;
public static final int SIZE_BIG = 2;

int mFabSize;
boolean mShowShadow;
Expand Down Expand Up @@ -178,8 +179,8 @@ private void initHideAnimation(TypedArray attr) {
}

private int getCircleSize() {
return getResources().getDimensionPixelSize(mFabSize == SIZE_NORMAL
? R.dimen.fab_size_normal : R.dimen.fab_size_mini);
return getResources().getDimensionPixelSize(mFabSize == SIZE_NORMAL ? R.dimen.fab_size_normal
: (mFabSize == SIZE_MINI ? R.dimen.fab_size_mini : R.dimen.fab_size_big));
}

private int calculateMeasuredWidth() {
Expand Down
2 changes: 2 additions & 0 deletions library/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<attr name="fab_size" format="enum">
<enum name="normal" value="0" />
<enum name="mini" value="1" />
<enum name="big" value="2" />
</attr>
<attr name="fab_showAnimation" format="reference" />
<attr name="fab_hideAnimation" format="reference" />
Expand Down Expand Up @@ -64,6 +65,7 @@
<attr name="menu_fab_size" format="enum">
<enum name="normal" value="0" />
<enum name="mini" value="1" />
<enum name="big" value="2" />
</attr>
<attr name="menu_labels_style" format="reference" />
<attr name="menu_shadowColor" format="color" />
Expand Down
1 change: 1 addition & 0 deletions library/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

<dimen name="fab_size_normal">56dp</dimen>
<dimen name="fab_size_mini">40dp</dimen>
<dimen name="fab_size_big">72dp</dimen>
<dimen name="labels_text_size">14sp</dimen>

</resources>
4 changes: 1 addition & 3 deletions sample/src/main/res/layout/floating_menus_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@
android:paddingRight="10dp"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
fab:menu_fab_size="big"
fab:menu_labels_ellipsize="end"
fab:menu_labels_singleLine="true"
fab:menu_backgroundColor="#ccffffff"
Expand All @@ -266,21 +267,18 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_edit"
fab:fab_size="mini"
fab:fab_label="Menu item 1" />

<com.github.clans.fab.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_edit"
fab:fab_size="mini"
fab:fab_label="Menu item 2" />

<com.github.clans.fab.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_edit"
fab:fab_size="mini"
fab:fab_label="@string/lorem_ipsum" />

</com.github.clans.fab.FloatingActionMenu>
Expand Down