Skip to content
This repository has been archived by the owner on Oct 23, 2020. It is now read-only.

Add xml attribute to set closeOnTouchOutside properties #133

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ private void init(Context context, AttributeSet attrs) {
mLabelsStyle = attr.getResourceId(R.styleable.FloatingActionMenu_menu_labels_style, 0);
mOpenDirection = attr.getInt(R.styleable.FloatingActionMenu_menu_openDirection, OPEN_UP);
mBackgroundColor = attr.getColor(R.styleable.FloatingActionMenu_menu_backgroundColor, Color.TRANSPARENT);
mIsSetClosedOnTouchOutside = attr.getBoolean(R.styleable.FloatingActionMenu_menu_closeOnTouchOutside, false);

if (attr.hasValue(R.styleable.FloatingActionMenu_menu_fab_label)) {
mUsingMenuLabel = true;
Expand Down
1 change: 1 addition & 0 deletions library/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
<attr name="menu_fab_label" format="string" />
<attr name="menu_fab_show_animation" format="reference" />
<attr name="menu_fab_hide_animation" format="reference" />
<attr name="menu_closeOnTouchOutside" format="boolean" />
</declare-styleable>

</resources>
3 changes: 2 additions & 1 deletion sample/src/main/res/layout/floating_menus_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@
fab:menu_labels_ellipsize="end"
fab:menu_labels_singleLine="true"
fab:menu_backgroundColor="#ccffffff"
fab:menu_labels_position="right">
fab:menu_labels_position="right"
fab:menu_closeOnTouchOutside="true">

<com.github.clans.fab.FloatingActionButton
android:layout_width="wrap_content"
Expand Down