├── .gitignore
├── .idea
├── encodings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
└── runConfigurations.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── rany
│ │ └── albeg
│ │ └── wein
│ │ └── springfabmenudemo
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── rany
│ │ │ └── albeg
│ │ │ └── wein
│ │ │ └── springfabmenudemo
│ │ │ └── ScrollingActivity.java
│ └── res
│ │ ├── drawable-hdpi
│ │ ├── ic_action_attach.png
│ │ ├── ic_action_chat.png
│ │ ├── ic_action_chat_bubble.png
│ │ ├── ic_action_cloud.png
│ │ ├── ic_action_colorize.png
│ │ ├── ic_action_crop_original.png
│ │ ├── ic_action_crop_rotate.png
│ │ ├── ic_action_edit.png
│ │ ├── ic_action_folder.png
│ │ ├── ic_action_hdr.png
│ │ └── ic_action_share.png
│ │ ├── drawable-mdpi
│ │ ├── ic_action_attach.png
│ │ ├── ic_action_chat.png
│ │ ├── ic_action_chat_bubble.png
│ │ ├── ic_action_cloud.png
│ │ ├── ic_action_colorize.png
│ │ ├── ic_action_crop_original.png
│ │ ├── ic_action_crop_rotate.png
│ │ ├── ic_action_edit.png
│ │ ├── ic_action_folder.png
│ │ ├── ic_action_hdr.png
│ │ └── ic_action_share.png
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable-xhdpi
│ │ ├── ic_action_attach.png
│ │ ├── ic_action_chat.png
│ │ ├── ic_action_chat_bubble.png
│ │ ├── ic_action_cloud.png
│ │ ├── ic_action_colorize.png
│ │ ├── ic_action_crop_original.png
│ │ ├── ic_action_crop_rotate.png
│ │ ├── ic_action_edit.png
│ │ ├── ic_action_folder.png
│ │ ├── ic_action_hdr.png
│ │ └── ic_action_share.png
│ │ ├── drawable-xxhdpi
│ │ ├── ic_action_attach.png
│ │ ├── ic_action_chat.png
│ │ ├── ic_action_chat_bubble.png
│ │ ├── ic_action_cloud.png
│ │ ├── ic_action_colorize.png
│ │ ├── ic_action_crop_original.png
│ │ ├── ic_action_crop_rotate.png
│ │ ├── ic_action_edit.png
│ │ ├── ic_action_folder.png
│ │ ├── ic_action_hdr.png
│ │ └── ic_action_share.png
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_scrolling.xml
│ │ └── content_scrolling.xml
│ │ ├── menu
│ │ └── menu_scrolling.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── rany
│ └── albeg
│ └── wein
│ └── springfabmenudemo
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle
├── spring-fab-menu.gif
└── spring-fab-menu
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
├── androidTest
└── java
│ └── com
│ └── rany
│ └── albeg
│ └── wein
│ └── springfabmenu
│ └── ExampleInstrumentedTest.java
├── main
├── AndroidManifest.xml
├── java
│ └── com
│ │ └── rany
│ │ └── albeg
│ │ └── wein
│ │ └── springfabmenu
│ │ ├── DensityUtils.java
│ │ └── SpringFabMenu.java
└── res
│ ├── drawable-hdpi
│ └── ic_action_add.png
│ ├── drawable-mdpi
│ └── ic_action_add.png
│ ├── drawable-xhdpi
│ └── ic_action_add.png
│ ├── drawable-xxhdpi
│ └── ic_action_add.png
│ └── values
│ ├── attrs.xml
│ └── strings.xml
└── test
└── java
└── com
└── rany
└── albeg
└── wein
└── springfabmenu
└── ExampleUnitTest.java
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | Java
36 |
37 |
38 | Probable bugsJava
39 |
40 |
41 | RELAX NG
42 |
43 |
44 |
45 |
46 | Android > Lint > Correctness
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SpringFabMenu
2 | ---
3 |
4 | A menu of `FloatingActionButton` items, designed to be anchored on an `AppBarLayout`.
5 |
6 | 
7 |
8 | ### Usage
9 |
10 | ---
11 |
12 | [  ](https://bintray.com/ranyalbegwein/maven/spring-fab-menu/_latestVersion)
13 | []( https://android-arsenal.com/details/1/6384 )
14 |
15 |
16 |
17 | 1. Edit your *build.gradle* to include the library and sync.
18 |
19 | ```
20 | dependencies {
21 | implementation 'com.rany.albeg.wein:spring-fab-menu:1.0.1'
22 | }
23 | ```
24 | Or with Maven:
25 | ```xml
26 |
27 | com.rany.albeg.wein
28 | spring-fab-menu
29 | 1.0.0
30 | pom
31 |
32 | ```
33 | 2. Create a `SpringFabMenu` in XML:
34 | ```xml
35 |
41 |
42 |
47 |
48 |
53 |
54 |
59 |
60 |
61 | ```
62 |
63 | All available attributes ( following values are defaults ):
64 | ```xml
65 |
82 | ```
83 |
84 | * `app:sfm_collapse_duration` : The time ( in ms ) it takes for the menu to collapse.
85 | * `app:sfm_collapse_on_item_selected` : Will the menu collapse when a menu-item is clicked.
86 | * `app:sfm_delay_expanding_menu_items` : Delay ( in ms ) between expanding menu items.
87 | * `app:sfm_expand_duration` : The time ( in ms ) it takes for the menu to expand.
88 | * `app:sfm_expand_item_rotation_degrees` : Degrees of rotation for expanding menu item.
89 | * `app:sfm_expand_menu_button_rotation_degrees` : Degrees of rotation for the menu button.
90 | * `app:sfm_menu_button_color` : The color of the menu button.
91 | * `app:sfm_menu_button_ripple_color` : The ripple color of the menu button.
92 | * `app:sfm_size_menu_button` : The size of the menu button.
93 | * `app:sfm_spacing_menu_items` : Spacing ( in dp ) between menu items.
94 | * `app:sfm_src_icon` : The icon for the menu button.
95 |
96 | **Note:**
97 | If you decide to anchor `SpringFabMenu` to an `AppBarLayout`, don't forget to apply a behavior to hide or show the menu:
98 |
99 | `app:layout_behavior="@string/appbar_springfabmenu_behavior"`
100 |
101 | 3. Listen for item clicks:
102 |
103 | ```java
104 | SpringFabMenu sfm = (SpringFabMenu)findViewById(R.id.sfm);
105 |
106 | sfm.setOnSpringFabMenuItemClickListener(new SpringFabMenu.OnSpringFabMenuItemClickListener() {
107 | @Override
108 | public void onSpringFabMenuItemClick(View view) {
109 | switch (view.getId()) {
110 | case R.id.fab_share:
111 | break;
112 | case R.id.fab_send:
113 | break;
114 | case R.id.fab_delete:
115 | }
116 | }
117 | });
118 | ```
119 |
120 | AUTHOR
121 | -------
122 |
123 | **Rany Albeg Wein**
124 |
125 |
126 | LICENSE
127 | --------
128 | Licensed under the Apache License, Version 2.0 (the "License");
129 | you may not use this file except in compliance with the License.
130 | You may obtain a copy of the License at
131 |
132 | http://www.apache.org/licenses/LICENSE-2.0
133 |
134 | Unless required by applicable law or agreed to in writing, software
135 | distributed under the License is distributed on an "AS IS" BASIS,
136 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
137 | See the License for the specific language governing permissions and
138 | limitations under the License.
139 |
140 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 26
5 | defaultConfig {
6 | applicationId "com.rany.albeg.wein.springfabmenudemo"
7 | minSdkVersion 19
8 | targetSdkVersion 26
9 | versionCode 2
10 | versionName "1.1"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | implementation fileTree(dir: 'libs', include: ['*.jar'])
23 | implementation 'com.android.support:appcompat-v7:26.1.0'
24 | implementation 'com.android.support:design:26.1.0'
25 | compile project(':spring-fab-menu')
26 | testImplementation 'junit:junit:4.12'
27 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
28 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
29 | }
30 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/rany/albeg/wein/springfabmenudemo/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.rany.albeg.wein.springfabmenudemo;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.rany.albeg.wein.springfabmenudemo", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/rany/albeg/wein/springfabmenudemo/ScrollingActivity.java:
--------------------------------------------------------------------------------
1 | package com.rany.albeg.wein.springfabmenudemo;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.support.v7.widget.Toolbar;
6 | import android.view.Menu;
7 |
8 | public class ScrollingActivity extends AppCompatActivity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_scrolling);
14 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
15 | setSupportActionBar(toolbar);
16 | getSupportActionBar().setTitle(null);
17 | }
18 |
19 | @Override
20 | public boolean onCreateOptionsMenu(Menu menu) {
21 | // Inflate the menu; this adds items to the action bar if it is present.
22 | getMenuInflater().inflate(R.menu.menu_scrolling, menu);
23 | return true;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_attach.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-hdpi/ic_action_attach.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_chat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-hdpi/ic_action_chat.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_chat_bubble.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-hdpi/ic_action_chat_bubble.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_cloud.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-hdpi/ic_action_cloud.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_colorize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-hdpi/ic_action_colorize.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_crop_original.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-hdpi/ic_action_crop_original.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_crop_rotate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-hdpi/ic_action_crop_rotate.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_edit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-hdpi/ic_action_edit.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_folder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-hdpi/ic_action_folder.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_hdr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-hdpi/ic_action_hdr.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_action_share.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-hdpi/ic_action_share.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_attach.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-mdpi/ic_action_attach.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_chat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-mdpi/ic_action_chat.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_chat_bubble.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-mdpi/ic_action_chat_bubble.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_cloud.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-mdpi/ic_action_cloud.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_colorize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-mdpi/ic_action_colorize.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_crop_original.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-mdpi/ic_action_crop_original.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_crop_rotate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-mdpi/ic_action_crop_rotate.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_edit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-mdpi/ic_action_edit.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_folder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-mdpi/ic_action_folder.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_hdr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-mdpi/ic_action_hdr.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_action_share.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-mdpi/ic_action_share.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_attach.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-xhdpi/ic_action_attach.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_chat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-xhdpi/ic_action_chat.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_chat_bubble.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-xhdpi/ic_action_chat_bubble.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_cloud.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-xhdpi/ic_action_cloud.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_colorize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-xhdpi/ic_action_colorize.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_crop_original.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-xhdpi/ic_action_crop_original.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_crop_rotate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-xhdpi/ic_action_crop_rotate.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_edit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-xhdpi/ic_action_edit.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_folder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-xhdpi/ic_action_folder.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_hdr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-xhdpi/ic_action_hdr.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_action_share.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-xhdpi/ic_action_share.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_action_attach.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-xxhdpi/ic_action_attach.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_action_chat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-xxhdpi/ic_action_chat.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_action_chat_bubble.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-xxhdpi/ic_action_chat_bubble.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_action_cloud.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-xxhdpi/ic_action_cloud.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_action_colorize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-xxhdpi/ic_action_colorize.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_action_crop_original.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-xxhdpi/ic_action_crop_original.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_action_crop_rotate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-xxhdpi/ic_action_crop_rotate.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_action_edit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-xxhdpi/ic_action_edit.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_action_folder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-xxhdpi/ic_action_folder.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_action_hdr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-xxhdpi/ic_action_hdr.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_action_share.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/drawable-xxhdpi/ic_action_share.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
11 |
16 |
21 |
26 |
31 |
36 |
41 |
46 |
51 |
56 |
61 |
66 |
71 |
76 |
81 |
86 |
91 |
96 |
101 |
106 |
111 |
116 |
121 |
126 |
131 |
136 |
141 |
146 |
151 |
156 |
161 |
166 |
171 |
172 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_scrolling.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
17 |
18 |
26 |
27 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
51 |
52 |
57 |
58 |
63 |
64 |
65 |
66 |
80 |
81 |
87 |
88 |
94 |
95 |
96 |
97 |
111 |
112 |
118 |
119 |
125 |
126 |
132 |
133 |
134 |
135 |
150 |
151 |
157 |
158 |
164 |
165 |
171 |
172 |
173 |
174 |
191 |
192 |
198 |
199 |
205 |
206 |
212 |
213 |
219 |
220 |
221 |
222 |
223 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_scrolling.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_scrolling.xml:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 | 180dp
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | SpringFabMenuDemo
3 |
4 | "Material is the metaphor.\n\n"
5 |
6 | "A material metaphor is the unifying theory of a rationalized space and a system of motion."
7 | "The material is grounded in tactile reality, inspired by the study of paper and ink, yet "
8 | "technologically advanced and open to imagination and magic.\n"
9 | "Surfaces and edges of the material provide visual cues that are grounded in reality. The "
10 | "use of familiar tactile attributes helps users quickly understand affordances. Yet the "
11 | "flexibility of the material creates new affordances that supercede those in the physical "
12 | "world, without breaking the rules of physics.\n"
13 | "The fundamentals of light, surface, and movement are key to conveying how objects move, "
14 | "interact, and exist in space and in relation to each other. Realistic lighting shows "
15 | "seams, divides space, and indicates moving parts.\n\n"
16 |
17 | "Bold, graphic, intentional.\n\n"
18 |
19 | "The foundational elements of print based design typography, grids, space, scale, color, "
20 | "and use of imagery guide visual treatments. These elements do far more than please the "
21 | "eye. They create hierarchy, meaning, and focus. Deliberate color choices, edge to edge "
22 | "imagery, large scale typography, and intentional white space create a bold and graphic "
23 | "interface that immerse the user in the experience.\n"
24 | "An emphasis on user actions makes core functionality immediately apparent and provides "
25 | "waypoints for the user.\n\n"
26 |
27 | "Motion provides meaning.\n\n"
28 |
29 | "Motion respects and reinforces the user as the prime mover. Primary user actions are "
30 | "inflection points that initiate motion, transforming the whole design.\n"
31 | "All action takes place in a single environment. Objects are presented to the user without "
32 | "breaking the continuity of experience even as they transform and reorganize.\n"
33 | "Motion is meaningful and appropriate, serving to focus attention and maintain continuity. "
34 | "Feedback is subtle yet clear. Transitions are efficient yet coherent.\n\n"
35 |
36 | "3D world.\n\n"
37 |
38 | "The material environment is a 3D space, which means all objects have x, y, and z "
39 | "dimensions. The z-axis is perpendicularly aligned to the plane of the display, with the "
40 | "positive z-axis extending towards the viewer. Every sheet of material occupies a single "
41 | "position along the z-axis and has a standard 1dp thickness.\n"
42 | "On the web, the z-axis is used for layering and not for perspective. The 3D world is "
43 | "emulated by manipulating the y-axis.\n\n"
44 |
45 | "Light and shadow.\n\n"
46 |
47 | "Within the material environment, virtual lights illuminate the scene. Key lights create "
48 | "directional shadows, while ambient light creates soft shadows from all angles.\n"
49 | "Shadows in the material environment are cast by these two light sources. In Android "
50 | "development, shadows occur when light sources are blocked by sheets of material at "
51 | "various positions along the z-axis. On the web, shadows are depicted by manipulating the "
52 | "y-axis only. The following example shows the card with a height of 6dp.\n\n"
53 |
54 | "Resting elevation.\n\n"
55 |
56 | "All material objects, regardless of size, have a resting elevation, or default elevation "
57 | "that does not change. If an object changes elevation, it should return to its resting "
58 | "elevation as soon as possible.\n\n"
59 |
60 | "Component elevations.\n\n"
61 |
62 | "The resting elevation for a component type is consistent across apps (e.g., FAB elevation "
63 | "does not vary from 6dp in one app to 16dp in another app).\n"
64 | "Components may have different resting elevations across platforms, depending on the depth "
65 | "of the environment (e.g., TV has a greater depth than mobile or desktop).\n\n"
66 |
67 | "Responsive elevation and dynamic elevation offsets.\n\n"
68 |
69 | "Some component types have responsive elevation, meaning they change elevation in response "
70 | "to user input (e.g., normal, focused, and pressed) or system events. These elevation "
71 | "changes are consistently implemented using dynamic elevation offsets.\n"
72 | "Dynamic elevation offsets are the goal elevation that a component moves towards, relative "
73 | "to the component’s resting state. They ensure that elevation changes are consistent "
74 | "across actions and component types. For example, all components that lift on press have "
75 | "the same elevation change relative to their resting elevation.\n"
76 | "Once the input event is completed or cancelled, the component will return to its resting "
77 | "elevation.\n\n"
78 |
79 | "Avoiding elevation interference.\n\n"
80 |
81 | "Components with responsive elevations may encounter other components as they move between "
82 | "their resting elevations and dynamic elevation offsets. Because material cannot pass "
83 | "through other material, components avoid interfering with one another any number of ways, "
84 | "whether on a per component basis or using the entire app layout.\n"
85 | "On a component level, components can move or be removed before they cause interference. "
86 | "For example, a floating action button (FAB) can disappear or move off screen before a "
87 | "user picks up a card, or it can move if a snackbar appears.\n"
88 | "On the layout level, design your app layout to minimize opportunities for interference. "
89 | "For example, position the FAB to one side of stream of a cards so the FAB won’t interfere "
90 | "when a user tries to pick up one of cards.\n\n"
91 |
92 | Settings
93 |
94 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/test/java/com/rany/albeg/wein/springfabmenudemo/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.rany.albeg.wein.springfabmenudemo;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.0.0'
11 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
12 | classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Oct 28 03:32:15 IDT 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':spring-fab-menu'
2 |
--------------------------------------------------------------------------------
/spring-fab-menu.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/spring-fab-menu.gif
--------------------------------------------------------------------------------
/spring-fab-menu/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
3 |
--------------------------------------------------------------------------------
/spring-fab-menu/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | ext {
4 | bintrayRepo = 'maven'
5 | bintrayName = 'spring-fab-menu'
6 |
7 | publishedGroupId = 'com.rany.albeg.wein'
8 | libraryName = 'SpringFabMenu'
9 | artifact = 'spring-fab-menu'
10 |
11 | libraryDescription = 'A menu of FloatingActionButton items, designed to be anchored on an AppBarLayout.'
12 |
13 | siteUrl = 'https://github.com/RanyAlbegWein/SpringFabMenu'
14 | gitUrl = 'https://github.com/RanyAlbegWein/SpringFabMenu.git'
15 |
16 | libraryVersion = '1.0.1'
17 |
18 | developerId = 'ranyalbegwein'
19 | developerName = 'Rany Albeg Wein'
20 | developerEmail = 'rany.albeg@gmail.com'
21 |
22 | licenseName = 'The Apache Software License, Version 2.0'
23 | licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
24 | allLicenses = ["Apache-2.0"]
25 | }
26 |
27 | android {
28 | compileSdkVersion 26
29 |
30 | tasks.withType(Javadoc) {
31 | options.addStringOption('Xdoclint:none', '-quiet')
32 | options.addStringOption('encoding', 'UTF-8')
33 | options.addStringOption('charSet', 'UTF-8')
34 | }
35 |
36 | defaultConfig {
37 | minSdkVersion 19
38 | targetSdkVersion 26
39 | versionCode 2
40 | versionName "1.1"
41 |
42 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
43 |
44 | }
45 |
46 | buildTypes {
47 | release {
48 | minifyEnabled false
49 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
50 | }
51 | }
52 |
53 | }
54 |
55 | dependencies {
56 | implementation fileTree(dir: 'libs', include: ['*.jar'])
57 |
58 | implementation 'com.android.support:design:26.1.0'
59 | implementation 'com.android.support:appcompat-v7:26.1.0'
60 | testImplementation 'junit:junit:4.12'
61 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
62 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
63 | }
64 |
65 | apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
66 | apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
--------------------------------------------------------------------------------
/spring-fab-menu/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/spring-fab-menu/src/androidTest/java/com/rany/albeg/wein/springfabmenu/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.rany.albeg.wein.springfabmenu;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.rany.albeg.wein.springfabmenu.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/spring-fab-menu/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/spring-fab-menu/src/main/java/com/rany/albeg/wein/springfabmenu/DensityUtils.java:
--------------------------------------------------------------------------------
1 | package com.rany.albeg.wein.springfabmenu;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * There is no copyright on this work.
7 | * Use it as if you wrote it yourself.
8 | * Written by Rany Albeg Wein ( rany.albeg@gmail.com ) Oct 2017.
9 | */
10 | final class DensityUtils {
11 |
12 | private DensityUtils() {
13 | }
14 |
15 | static int dp2px(Context context, float dp) {
16 | return Math.round(dp * context.getResources().getDisplayMetrics().density);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/spring-fab-menu/src/main/java/com/rany/albeg/wein/springfabmenu/SpringFabMenu.java:
--------------------------------------------------------------------------------
1 | package com.rany.albeg.wein.springfabmenu;
2 |
3 | import android.content.Context;
4 | import android.content.res.ColorStateList;
5 | import android.content.res.TypedArray;
6 | import android.support.design.widget.AppBarLayout;
7 | import android.support.design.widget.CoordinatorLayout;
8 | import android.support.design.widget.FloatingActionButton;
9 | import android.util.AttributeSet;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.view.animation.AnticipateOvershootInterpolator;
13 | import android.view.animation.OvershootInterpolator;
14 |
15 | /**
16 | * There is no copyright on this work.
17 | * Use it as if you wrote it yourself.
18 | * Written by Rany Albeg Wein ( rany.albeg@gmail.com ) Oct 2017.
19 | */
20 | public class SpringFabMenu extends ViewGroup implements View.OnClickListener {
21 |
22 | /** Default values for XML attributes. */
23 | private static final int DEF_SRC_ICON = R.drawable.ic_action_add;
24 | private static final int DEF_SIZE_MENU_BUTTON = FloatingActionButton.SIZE_NORMAL;
25 | private static final boolean DEF_COLLAPSE_ON_ITEM_SELECTED = true;
26 | private static final int DEF_EXPAND_DURATION = 1000;
27 | private static final int DEF_COLLAPSE_DURATION = 1000;
28 | private static final int DEF_EXPAND_ITEM_ROTATION_DEG = 360;
29 | private static final int DEF_MENU_BTN_ROTATION_DEG = 405;
30 | private static final int DEF_SPACING_MENU_ITEMS_DP = 15;
31 | private static final int DEF_DELAY_EXPAND_MENU_ITEM = 250;
32 | /** Base height adjustment for overshoot interpolator in dp. */
33 | private static final int BASE_HEIGHT_ADJ_FOR_OVERSHOOT_DP = 12;
34 |
35 | /** Width adjustment for overshoot interpolator in dp. */
36 | private static final int WIDTH_ADJ_FOR_OVERSHOOT_DP = 8;
37 |
38 | private static final int DURATION_SHOW_HIDE = 500;
39 | private static final int MENU_BUTTON_ELEVATION = 8;
40 |
41 | /**
42 | * A click listener for menu items.
43 | */
44 | private OnSpringFabMenuItemClickListener mItemClickListener;
45 | /**
46 | * Is this menu expanded?
47 | */
48 | private boolean mIsExpanded;
49 | /**
50 | * The main menu button, using which the user can cause the menu expand or collapse.
51 | */
52 | private FloatingActionButton mMenuButton;
53 | /**
54 | * A count for keeping track of how many children ( menu items ) were animated
55 | * as a result of the menu being expanded or collapsed.
56 | */
57 | private int mCountAnimatedChildren;
58 | /**
59 | * Total children ( menu items ) in this menu.
60 | */
61 | private int mChildCount;
62 | /**
63 | * A resource id for the {@link #mMenuButton} image.
64 | */
65 | private int mSrcIconResId;
66 | /**
67 | * The size of {@link #mMenuButton}.
68 | * Available XML attributes are "normal" = {@link FloatingActionButton#SIZE_NORMAL}
69 | * and "mini" = {@link FloatingActionButton#SIZE_MINI}
70 | */
71 | private int mSizeMenuButton;
72 | /**
73 | * Whether or not the menu will collapse on menu item selection.
74 | */
75 | private boolean mCollapseOnItemSelected;
76 | /**
77 | * Animation duration of an expanding menu-item.
78 | */
79 | private int mDurationExpand;
80 | /**
81 | * Animation duration of a collapsing menu-item.
82 | */
83 | private int mDurationCollapse;
84 | /**
85 | * Degrees of rotation for expanding menu items.
86 | */
87 | private int mExpandItemRotationDeg;
88 | /**
89 | * Degrees of rotation of the {@link #mMenuButton}
90 | */
91 | private int mExpandMenuBtnRotationDeg;
92 | /**
93 | * The spacing between menu items in pixels.
94 | * {@link #mMenuButton} is not considered a menu item.
95 | */
96 | private int mSpacingMenuItemsPx;
97 | /**
98 | * Delay between expanding menu items.
99 | */
100 | private int mDelayExpandingMenuItems;
101 | /**
102 | * Is this menu being currently displayed either expanded or collapsed.
103 | */
104 | private boolean mIsVisible = true;
105 | /**
106 | * Interpolator for expanding animation.
107 | */
108 | private OvershootInterpolator mExpandInterpolator;
109 | /**
110 | * Interpolator for collapsing animation.
111 | */
112 | private AnticipateOvershootInterpolator mCollapseInterpolator;
113 |
114 | public SpringFabMenu(Context context, AttributeSet attrs) {
115 | super(context, attrs);
116 | init(attrs);
117 | }
118 |
119 | private void init(AttributeSet attrs) {
120 | mExpandInterpolator = new OvershootInterpolator();
121 | mCollapseInterpolator = new AnticipateOvershootInterpolator();
122 |
123 | mMenuButton = new FloatingActionButton(getContext());
124 |
125 | initAttrs(attrs);
126 |
127 | mIsExpanded = false;
128 |
129 | mMenuButton.setImageResource(mSrcIconResId);
130 | mMenuButton.setOnClickListener(new View.OnClickListener() {
131 | @Override
132 | public void onClick(View v) {
133 | toggle();
134 | }
135 | });
136 |
137 | mMenuButton.setCompatElevation(DensityUtils.dp2px(getContext(), MENU_BUTTON_ELEVATION));
138 | mMenuButton.setSize(mSizeMenuButton);
139 |
140 | addView(mMenuButton, 0, generateDefaultLayoutParams());
141 | }
142 |
143 | private void initAttrs(AttributeSet attrs) {
144 |
145 | TypedArray a = getContext().obtainStyledAttributes(
146 | attrs,
147 | R.styleable.SpringFabMenu,
148 | 0, 0);
149 | try {
150 | mSrcIconResId = a.getResourceId(R.styleable.SpringFabMenu_sfm_src_icon, DEF_SRC_ICON);
151 | mSizeMenuButton = a.getInt(R.styleable.SpringFabMenu_sfm_size_menu_button, DEF_SIZE_MENU_BUTTON);
152 | mCollapseOnItemSelected = a.getBoolean(R.styleable.SpringFabMenu_sfm_collapse_on_item_selected,
153 | DEF_COLLAPSE_ON_ITEM_SELECTED);
154 | mDurationExpand = a.getInt(R.styleable.SpringFabMenu_sfm_expand_duration, DEF_EXPAND_DURATION);
155 | mDurationCollapse = a.getInt(R.styleable.SpringFabMenu_sfm_collapse_duration, DEF_COLLAPSE_DURATION);
156 | mExpandItemRotationDeg = a.getInt(R.styleable.SpringFabMenu_sfm_expand_item_rotation_degrees,
157 | DEF_EXPAND_ITEM_ROTATION_DEG);
158 | mExpandMenuBtnRotationDeg = a.getInt(R.styleable.SpringFabMenu_sfm_expand_menu_button_rotation_degrees,
159 | DEF_MENU_BTN_ROTATION_DEG);
160 | mSpacingMenuItemsPx = a.getDimensionPixelSize(R.styleable.SpringFabMenu_sfm_spacing_menu_items,
161 | DensityUtils.dp2px(getContext(), DEF_SPACING_MENU_ITEMS_DP));
162 | mDelayExpandingMenuItems = a.getInt(R.styleable.SpringFabMenu_sfm_delay_expanding_menu_items,
163 | DEF_DELAY_EXPAND_MENU_ITEM);
164 |
165 | ColorStateList menuButtonColor = a.getColorStateList(R.styleable.SpringFabMenu_sfm_menu_button_color);
166 | if (menuButtonColor != null) {
167 | mMenuButton.setBackgroundTintList(menuButtonColor);
168 | }
169 |
170 | mMenuButton.setRippleColor(
171 | a.getColor(R.styleable.SpringFabMenu_sfm_menu_button_ripple_color, mMenuButton.getRippleColor()));
172 |
173 | } finally {
174 | a.recycle();
175 | }
176 | }
177 |
178 | @Override
179 | protected void onFinishInflate() {
180 | super.onFinishInflate();
181 | mChildCount = getChildCount();
182 |
183 | setChildrenClickListener();
184 | }
185 |
186 | void toggle() {
187 | setMenuItemsClickable(false);
188 | if (mIsExpanded) {
189 | collapse();
190 | } else {
191 | expand();
192 | }
193 | }
194 |
195 | private void expand() {
196 | for (int i = 0; i < mChildCount; ++i) {
197 | animateExpandChild(getChildAt(i), mDurationExpand + i * mDelayExpandingMenuItems);
198 | }
199 | }
200 |
201 | private void collapse() {
202 | for (int i = 0; i < mChildCount; ++i) {
203 | animateCollapseChild(getChildAt(i), mDurationCollapse);
204 | }
205 | }
206 |
207 | public void show() {
208 | if (!mIsVisible) {
209 | for (int i = 0; i < mChildCount; ++i) {
210 | animateShowChild(getChildAt(i));
211 | }
212 | mIsVisible = true;
213 | setMenuItemsClickable(true);
214 | }
215 | }
216 |
217 | public void hide() {
218 | if (mIsVisible) {
219 | for (int i = 0; i < mChildCount; ++i) {
220 | animateHideChild(getChildAt(i));
221 | }
222 | mIsVisible = false;
223 | setMenuItemsClickable(false);
224 | }
225 | }
226 |
227 | private static void animateShowChild(View child) {
228 | child.animate()
229 | .scaleX(1)
230 | .scaleY(1)
231 | .alpha(1)
232 | .setDuration(DURATION_SHOW_HIDE);
233 | }
234 |
235 | private static void animateHideChild(View child) {
236 | child.animate()
237 | .scaleX(0)
238 | .scaleY(0)
239 | .alpha(0)
240 | .setDuration(DURATION_SHOW_HIDE);
241 | }
242 |
243 | private void animateExpandChild(View child, int duration) {
244 |
245 | child.setVisibility(VISIBLE);
246 | child.animate()
247 | .setDuration(duration)
248 | .setInterpolator(mExpandInterpolator)
249 | .withEndAction(new Runnable() {
250 | @Override
251 | public void run() {
252 |
253 | /*Not including mMenuButton*/
254 | if (++mCountAnimatedChildren == mChildCount) {
255 | mCountAnimatedChildren = 0;
256 | mIsExpanded = true;
257 | /*Re-enable menu item clicks.*/
258 | setMenuItemsClickable(true);
259 | }
260 | }
261 | })
262 | .translationY(getTranslationYToCenter(child))
263 | .scaleX(1)
264 | .scaleY(1)
265 | .rotation(child == mMenuButton ? mExpandMenuBtnRotationDeg : mExpandItemRotationDeg);
266 | }
267 |
268 | private void animateCollapseChild(View child, int duration) {
269 | child.animate()
270 | .setDuration(duration)
271 | .setInterpolator(mCollapseInterpolator)
272 | .withEndAction(new Runnable() {
273 | @Override
274 | public void run() {
275 |
276 | if (++mCountAnimatedChildren == mChildCount) {
277 | /*Not including mMenuButton*/
278 | for (int i = mChildCount - 1; i > 0; --i) {
279 | getChildAt(i).setVisibility(INVISIBLE);
280 | }
281 | mCountAnimatedChildren = 0;
282 | mIsExpanded = false;
283 | /*Re-enable menu item clicks.*/
284 | setMenuItemsClickable(true);
285 | }
286 | }
287 | })
288 | .scaleX(child == mMenuButton ? 1 : 0)
289 | .scaleY(child == mMenuButton ? 1 : 0)
290 | .translationY(getTranslationYToCenter(child))
291 | .rotation(0);
292 |
293 | }
294 |
295 | private void setMenuItemsClickable(boolean enabled) {
296 | for (int i = 0; i < mChildCount; ++i) {
297 | View child = getChildAt(i);
298 | child.setClickable(enabled);
299 | }
300 | }
301 |
302 | private float getTranslationYToCenter(View child) {
303 |
304 | float centerY = getHeight() / 2 - getY();
305 | float childPos = child.getY() + child.getHeight() / 2 - getY();
306 |
307 | return centerY - childPos;
308 | }
309 |
310 | private void setChildrenClickListener() {
311 | /*Not including mMenuButton - it has a separate View.OnClickListener*/
312 | for (int i = mChildCount - 1; i > 0; --i) {
313 | View child = getChildAt(i);
314 | child.setOnClickListener(this);
315 | }
316 | }
317 |
318 | public void setOnSpringFabMenuItemClickListener(OnSpringFabMenuItemClickListener listener) {
319 | mItemClickListener = listener;
320 | }
321 |
322 | @Override
323 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
324 |
325 | setMeasuredDimensionAll(widthMeasureSpec, heightMeasureSpec);
326 | }
327 |
328 | private void setMeasuredDimensionAll(int widthMeasureSpec, int heightMeasureSpec) {
329 | int width = 0;
330 | int height = 0;
331 |
332 | /*Measure all children.*/
333 | for (int i = 0; i < mChildCount; ++i) {
334 | View child = getChildAt(i);
335 |
336 | /*Measure child only if it is visible.*/
337 | if (child instanceof FloatingActionButton && child.getVisibility() != GONE) {
338 | measureChildWithMargins(child, widthMeasureSpec, width, heightMeasureSpec, height);
339 |
340 | MarginLayoutParams lp = (MarginLayoutParams) child.getLayoutParams();
341 | /*The widest child will determine the total width of this View.*/
342 | width = Math.max(width, child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin);
343 | height += child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin;
344 | /*Spacing between menu items. mMenuButton is not considered a menu item.*/
345 | height += child == mMenuButton ? 0 : mSpacingMenuItemsPx;
346 | }
347 | }
348 |
349 | /*Adding total padding to width and height.*/
350 | width += getPaddingLeft() + getPaddingRight() + getWidthAdjustmentForOvershootPx(getContext());
351 | height += getPaddingTop() + getPaddingBottom() + getHeightAdjustmentOvershootPx(getContext(), mChildCount);
352 |
353 | setMeasuredDimension(
354 | resolveSize(width, widthMeasureSpec),
355 | resolveSize(height, heightMeasureSpec)
356 | );
357 | }
358 |
359 | @Override
360 | protected void onLayout(boolean changed, int l, int t, int r, int b) {
361 | layoutAll();
362 |
363 | /*This is a new size or position for this view*/
364 | if (changed) {
365 | setInitialViewsPositionAndState();
366 | }
367 | }
368 |
369 | private void layoutAll() {
370 | int x = getPaddingLeft() + getWidthAdjustmentForOvershootPx(getContext()) / 2;
371 | int y = getPaddingTop() + getHeightAdjustmentOvershootPx(getContext(), mChildCount) / 2;
372 | int l, t, r, b;
373 |
374 | /*Previous child height.*/
375 | int prevChildHeight = 0;
376 |
377 | for (int i = 0; i < mChildCount; ++i) {
378 | View child = getChildAt(i);
379 |
380 | if (child instanceof FloatingActionButton && child.getVisibility() != GONE) {
381 | FloatingActionButton fab = (FloatingActionButton) child;
382 | MarginLayoutParams lp = (MarginLayoutParams) child.getLayoutParams();
383 |
384 | y += prevChildHeight;
385 | prevChildHeight = child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin;
386 |
387 | int shiftCenterMenuButton = 0;
388 | if (fab.getSize() == FloatingActionButton.SIZE_MINI
389 | && mSizeMenuButton == FloatingActionButton.SIZE_NORMAL) {
390 | /*
391 | * A width offset of 1/5 of a "mini" size child will shift it exactly to
392 | * the center of a "normal" size mMenuButton.
393 | */
394 | shiftCenterMenuButton = fab.getMeasuredWidth() / 5;
395 | }
396 |
397 | int spacingMenuItems = child == mMenuButton ? 0 : i * mSpacingMenuItemsPx;
398 |
399 | /*Left*/
400 | l = x + lp.leftMargin + shiftCenterMenuButton;
401 | /*Top*/
402 | t = y + lp.topMargin + spacingMenuItems;
403 | /*Right*/
404 | r = l + child.getMeasuredWidth();
405 | /*Bottom*/
406 | b = t + child.getMeasuredHeight();
407 |
408 | child.layout(l, t, r, b);
409 | }
410 | }
411 | }
412 |
413 | private static int getWidthAdjustmentForOvershootPx(Context context) {
414 | return DensityUtils.dp2px(context, WIDTH_ADJ_FOR_OVERSHOOT_DP);
415 | }
416 |
417 | private static int getHeightAdjustmentOvershootPx(Context context, int childCount) {
418 | /*
419 | * Overshoot interpolator travel distance is proportional to the number of children,
420 | * therefore we multiply the *base* height adjustment for this view with the
421 | * number of menu items + mMenuButton.
422 | */
423 | return DensityUtils.dp2px(context, childCount * BASE_HEIGHT_ADJ_FOR_OVERSHOOT_DP);
424 | }
425 |
426 | private void setInitialViewsPositionAndState() {
427 |
428 | /*Not including mMenuButton*/
429 | for (int i = mChildCount - 1; i > 0; --i) {
430 | FloatingActionButton child = (FloatingActionButton) getChildAt(i);
431 |
432 | child.setTranslationY(getTranslationYToCenter(child));
433 | child.setScaleX(0);
434 | child.setScaleY(0);
435 | child.setVisibility(INVISIBLE);
436 | }
437 |
438 | mMenuButton.setTranslationY(getTranslationYToCenter(mMenuButton));
439 | }
440 |
441 | @Override
442 | public MarginLayoutParams generateLayoutParams(AttributeSet attrs) {
443 | return new MarginLayoutParams(getContext(), attrs);
444 | }
445 |
446 | @Override
447 | protected MarginLayoutParams generateLayoutParams(ViewGroup.LayoutParams p) {
448 | return generateDefaultLayoutParams();
449 | }
450 |
451 | @Override
452 | protected MarginLayoutParams generateDefaultLayoutParams() {
453 | //noinspection ResourceType
454 | return new MarginLayoutParams(MarginLayoutParams.WRAP_CONTENT,
455 | MarginLayoutParams.WRAP_CONTENT);
456 | }
457 |
458 | @Override
459 | protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
460 | return p instanceof MarginLayoutParams;
461 | }
462 |
463 | @Override
464 | public void onClick(View v) {
465 | if (mItemClickListener != null) {
466 | mItemClickListener.onSpringFabMenuItemClick(v);
467 | }
468 |
469 | if (mCollapseOnItemSelected) {
470 | toggle();
471 | }
472 | }
473 |
474 | public interface OnSpringFabMenuItemClickListener {
475 |
476 | void onSpringFabMenuItemClick(View view);
477 | }
478 |
479 | public boolean isVisible() {
480 | return mIsVisible;
481 | }
482 |
483 | /**
484 | * A simple behavior to hide() or show() the menu depending on {@link AppBarLayout} scroll.
485 | */
486 | public static class SpringFabMenuBehavior extends CoordinatorLayout.Behavior {
487 | /**
488 | * The scroll limit of a {@link AppBarLayout} from which a SpringFabMenu should be hidden.
489 | */
490 | private int mScrollThreshold;
491 |
492 | public SpringFabMenuBehavior(Context context, AttributeSet attrs) {
493 | super(context, attrs);
494 | }
495 |
496 | @Override
497 | public boolean layoutDependsOn(CoordinatorLayout parent, SpringFabMenu child, View dependency) {
498 | if (dependency instanceof AppBarLayout) {
499 | mScrollThreshold = ((AppBarLayout) dependency).getTotalScrollRange() / 10;
500 | return true;
501 | }
502 | return false;
503 | }
504 |
505 | @Override
506 | public boolean onDependentViewChanged(CoordinatorLayout parent, SpringFabMenu child, View dependency) {
507 | AppBarLayout appBarLayout = (AppBarLayout) dependency;
508 |
509 | float yAbs = Math.abs(appBarLayout.getY());
510 |
511 | /*If AppBarLayout is fully pulled down.*/
512 | if (yAbs == 0) {
513 | child.show();
514 | return true;
515 | } else if (yAbs > mScrollThreshold) {
516 | child.hide();
517 | return true;
518 | }
519 | return false;
520 | }
521 | }
522 | }
523 |
--------------------------------------------------------------------------------
/spring-fab-menu/src/main/res/drawable-hdpi/ic_action_add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/spring-fab-menu/src/main/res/drawable-hdpi/ic_action_add.png
--------------------------------------------------------------------------------
/spring-fab-menu/src/main/res/drawable-mdpi/ic_action_add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/spring-fab-menu/src/main/res/drawable-mdpi/ic_action_add.png
--------------------------------------------------------------------------------
/spring-fab-menu/src/main/res/drawable-xhdpi/ic_action_add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/spring-fab-menu/src/main/res/drawable-xhdpi/ic_action_add.png
--------------------------------------------------------------------------------
/spring-fab-menu/src/main/res/drawable-xxhdpi/ic_action_add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RanyAlbegWein/SpringFabMenu/98996826eb799dcc098c3cbb64db549264347479/spring-fab-menu/src/main/res/drawable-xxhdpi/ic_action_add.png
--------------------------------------------------------------------------------
/spring-fab-menu/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/spring-fab-menu/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | SpringFabMenu
3 | com.rany.albeg.wein.springfabmenu.SpringFabMenu$SpringFabMenuBehavior
4 |
5 |
--------------------------------------------------------------------------------
/spring-fab-menu/src/test/java/com/rany/albeg/wein/springfabmenu/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.rany.albeg.wein.springfabmenu;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------