Skip to content
This repository was archived by the owner on Jul 10, 2020. It is now read-only.

Commit 0f5682c

Browse files
Update resources. Allow set if overlay is clickable or not
1 parent a1747df commit 0f5682c

File tree

19 files changed

+136
-31
lines changed

19 files changed

+136
-31
lines changed

app/build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
17+
1618
apply plugin: 'com.android.application'
1719
apply from: '../dependencies.gradle'
1820

-455 Bytes
Binary file not shown.
-359 Bytes
Binary file not shown.
-594 Bytes
Binary file not shown.
-881 Bytes
Binary file not shown.
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
~ Copyright (c) 2017. Jahir Fiquitiva
4+
~
5+
~ Licensed under the Apache License, Version 2.0 (the "License");
6+
~ you may not use this file except in compliance with the License.
7+
~ You may obtain a copy of the License at
8+
~
9+
~ http://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" BASIS,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
-->
17+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
18+
android:height="24dp"
19+
android:width="24dp"
20+
android:viewportWidth="24"
21+
android:viewportHeight="24">
22+
<path
23+
android:fillColor="#8A000000"
24+
android:pathData="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z"/>
25+
</vector>
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
~ Copyright (c) 2017. Jahir Fiquitiva
4+
~
5+
~ Licensed under the Apache License, Version 2.0 (the "License");
6+
~ you may not use this file except in compliance with the License.
7+
~ You may obtain a copy of the License at
8+
~
9+
~ http://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" BASIS,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
-->
17+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
18+
android:height="24dp"
19+
android:width="24dp"
20+
android:viewportWidth="24"
21+
android:viewportHeight="24">
22+
<path android:fillColor="#fff" android:pathData="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z" />
23+
</vector>
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
~ Copyright (c) 2017. Jahir Fiquitiva
4+
~
5+
~ Licensed under the Apache License, Version 2.0 (the "License");
6+
~ you may not use this file except in compliance with the License.
7+
~ You may obtain a copy of the License at
8+
~
9+
~ http://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" BASIS,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
-->
17+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
18+
android:height="24dp"
19+
android:width="24dp"
20+
android:viewportWidth="24"
21+
android:viewportHeight="24">
22+
<path
23+
android:fillColor="#fff"
24+
android:pathData="M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z"/>
25+
</vector>

app/src/main/res/drawable/ic_plus.xml

+4-8
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,18 @@
22
<!--
33
~ Copyright (c) 2017. Jahir Fiquitiva
44
~
5-
~ Licensed under the CreativeCommons Attribution-ShareAlike
6-
~ 4.0 International License. You may not use this file except in compliance
7-
~ with the License. You may obtain a copy of the License at
5+
~ Licensed under the Apache License, Version 2.0 (the "License");
6+
~ you may not use this file except in compliance with the License.
7+
~ You may obtain a copy of the License at
88
~
9-
~ http://creativecommons.org/licenses/by-sa/4.0/legalcode
9+
~ http://www.apache.org/licenses/LICENSE-2.0
1010
~
1111
~ Unless required by applicable law or agreed to in writing, software
1212
~ distributed under the License is distributed on an "AS IS" BASIS,
1313
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
~ See the License for the specific language governing permissions and
1515
~ limitations under the License.
16-
~
17-
~ Special thanks to the project contributors and collaborators
18-
~ https://github.com/jahirfiquitiva/Blueprint#special-thanks
1916
-->
20-
2117
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2218
android:width="24dp"
2319
android:height="24dp"

app/src/main/res/drawable/fab_label_background.xml renamed to app/src/main/res/drawable/ic_share.xml

+9-11
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@
1414
~ See the License for the specific language governing permissions and
1515
~ limitations under the License.
1616
-->
17-
18-
<shape xmlns:android="http://schemas.android.com/apk/res/android">
19-
<solid android:color="@color/black_semi_transparent"/>
20-
<padding
21-
android:left="16dp"
22-
android:top="4dp"
23-
android:right="16dp"
24-
android:bottom="4dp"/>
25-
<corners
26-
android:radius="2dp"/>
27-
</shape>
17+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
18+
android:height="24dp"
19+
android:width="24dp"
20+
android:viewportWidth="24"
21+
android:viewportHeight="24">
22+
<path
23+
android:fillColor="#fff"
24+
android:pathData="M21,11L14,4V8C7,9 4,14 3,19C5.5,15.5 9,13.9 14,13.9V18L21,11Z"/>
25+
</vector>

app/src/main/res/layout/activity_main.xml

+5
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
<jahirfiquitiva.libs.fabsmenu.TitleFAB
4141
android:layout_width="wrap_content"
4242
android:layout_height="wrap_content"
43+
fab:srcCompat="@drawable/ic_share"
4344
fab:fabSize="mini"
4445
fab:backgroundTint="@color/colorAccent"
4546
fab:rippleColor="@color/colorAccent"
@@ -51,8 +52,10 @@
5152
android:id="@+id/clickable_title"
5253
android:layout_width="wrap_content"
5354
android:layout_height="wrap_content"
55+
fab:srcCompat="@drawable/ic_pencil"
5456
fab:fab_title="Clickable title"
5557
fab:fab_enableTitleClick="true"
58+
fab:fab_title_textColor="@color/colorAccent"
5659
fab:fabSize="mini"
5760
fab:backgroundTint="@color/colorAccent"
5861
fab:rippleColor="@color/colorAccent"/>
@@ -61,6 +64,7 @@
6164
android:id="@+id/mini_fab"
6265
android:layout_width="wrap_content"
6366
android:layout_height="wrap_content"
67+
fab:srcCompat="@drawable/ic_heart"
6468
fab:fab_title="Mini fab with long text"
6569
fab:fabSize="mini"
6670
fab:backgroundTint="@color/blue_semi"
@@ -70,6 +74,7 @@
7074
android:id="@+id/green_fab"
7175
android:layout_width="wrap_content"
7276
android:layout_height="wrap_content"
77+
fab:srcCompat="@drawable/ic_person"
7378
fab:fab_title="Fab with even longer text that might not even fit in all the screens"
7479
fab:fabSize="normal"
7580
fab:backgroundTint="@color/green"

app/src/main/res/values/colors.xml

-5
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@
1919
<color name="colorPrimary">#2196f3</color>
2020
<color name="colorPrimaryDark">#197fd2</color>
2121
<color name="colorAccent">#f44336</color>
22-
<color name="black_semi_transparent">#B2000000</color>
23-
<color name="background">#e5e5e5</color>
24-
<color name="half_black">#808080</color>
25-
<color name="white">#fafafa</color>
26-
<color name="white_pressed">#f1f1f1</color>
2722
<color name="pink">#e91e63</color>
2823
<color name="pink_pressed">#ec407a</color>
2924
<color name="blue_semi">#5677fc</color>

build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
17+
1618
// Top-level build file where you can add configuration options common to all sub-projects/modules.
1719
apply from: './dependencies.gradle'
1820

library/build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
17+
1618
apply plugin: 'com.android.library'
1719
apply plugin: 'com.github.dcendents.android-maven'
1820
apply from: '../dependencies.gradle'

library/src/main/java/jahirfiquitiva/libs/fabsmenu/FABSnackbarBehavior.java

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright (c) 2017. Jahir Fiquitiva
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package jahirfiquitiva.libs.fabsmenu;
218

319
import android.content.Context;

library/src/main/java/jahirfiquitiva/libs/fabsmenu/FABsMenu.java

+9-7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package jahirfiquitiva.libs.fabsmenu;
1718

1819
import android.animation.Animator;
@@ -505,7 +506,7 @@ public void onClick(View view) {
505506
}
506507

507508
private void toggleOverlay(final boolean show, boolean immediately) {
508-
ViewParent parent = getParent();
509+
final ViewParent parent = getParent();
509510
if (parent != null) {
510511
if (parent instanceof FABsMenuLayout) {
511512
final View overlay = ((FABsMenuLayout) parent).getOverlayView();
@@ -523,12 +524,13 @@ public void onAnimationEnd(Animator animation) {
523524
overlay.setVisibility(GONE);
524525
overlay.setOnClickListener(null);
525526
} else {
526-
overlay.setOnClickListener(new OnClickListener() {
527-
@Override
528-
public void onClick(View view) {
529-
collapse();
530-
}
531-
});
527+
if (((FABsMenuLayout) parent).hasClickableOverlay())
528+
overlay.setOnClickListener(new OnClickListener() {
529+
@Override
530+
public void onClick(View view) {
531+
collapse();
532+
}
533+
});
532534
}
533535
}
534536
}).start();

library/src/main/java/jahirfiquitiva/libs/fabsmenu/FABsMenuLayout.java

+11
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public class FABsMenuLayout extends FrameLayout {
3333
@ColorInt
3434
private int overlayColor;
3535
private View overlayView;
36+
private boolean clickableOverlay;
3637

3738
public FABsMenuLayout(@NonNull Context context) {
3839
super(context);
@@ -54,6 +55,8 @@ private void init(Context context, AttributeSet attrs) {
5455
R.styleable.FABsMenuLayout, 0, 0);
5556
overlayColor = a.getColor(R.styleable.FABsMenuLayout_fabs_menu_overlayColor,
5657
Color.parseColor("#4d000000"));
58+
clickableOverlay = a.getBoolean(R.styleable.FABsMenuLayout_fabs_menu_cickableOverlay,
59+
true);
5760
a.recycle();
5861

5962
overlayView = new View(context);
@@ -79,4 +82,12 @@ public View getOverlayView() {
7982
public void setOverlayView(View overlayView) {
8083
this.overlayView = overlayView;
8184
}
85+
86+
public boolean hasClickableOverlay() {
87+
return clickableOverlay;
88+
}
89+
90+
public void setClickableOverlay(boolean clickableOverlay) {
91+
this.clickableOverlay = clickableOverlay;
92+
}
8293
}

library/src/main/res/values/attrs.xml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<resources>
1919
<declare-styleable name="FABsMenuLayout">
2020
<attr name="fabs_menu_overlayColor" format="color"/>
21+
<attr name="fabs_menu_cickableOverlay" format="boolean"/>
2122
</declare-styleable>
2223

2324
<declare-styleable name="TitleFAB">

settings.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
17+
1618
include ':app', ':library'

0 commit comments

Comments
 (0)