├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── ag
│ │ └── fabo
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── ag
│ │ │ └── fabo
│ │ │ └── MainActivity.java
│ └── res
│ │ ├── drawable
│ │ ├── ic_add_alarm_white_24dp.xml
│ │ ├── ic_add_white_24dp.xml
│ │ ├── ic_camera_alt_white_24dp.xml
│ │ └── ic_link_white_24dp.xml
│ │ ├── layout
│ │ └── activity_main.xml
│ │ ├── menu
│ │ ├── fab_menu.xml
│ │ └── menu_main.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ ├── values-v21
│ │ └── styles.xml
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ └── values
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── ag
│ └── fabo
│ └── ExampleUnitTest.java
├── build.gradle
├── floatingactionmenu
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── github
│ │ └── ag
│ │ └── floatingactionmenu
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── github
│ │ │ └── ag
│ │ │ └── floatingactionmenu
│ │ │ ├── FabWithOptions.java
│ │ │ ├── FabWithTitleView.java
│ │ │ └── OptionsFabLayout.java
│ └── res
│ │ ├── anim
│ │ ├── enlarge.xml
│ │ ├── fade_and_translate.xml
│ │ └── shrink.xml
│ │ ├── drawable
│ │ └── card_bg.xml
│ │ ├── layout
│ │ ├── fab_options.xml
│ │ └── fab_with_label.xml
│ │ └── values
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── github
│ └── ag
│ └── floatingactionmenu
│ └── ExampleUnitTest.java
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── screenshots
└── Screenshot_20170318-221201.png
└── settings.gradle
/README.md:
--------------------------------------------------------------------------------
1 | # Floating-Action-Menu (Deprecated)
2 | Floating action menu is a library allowing easily integrate fully customizable FloatingActionButton menu.
3 | # Screenshots
4 |
5 |
6 |
7 | # Download
8 | Gradle:
9 | ```groovy
10 | compile 'com.github.arthurghazaryan:floatingactionmenu:1.0.0'
11 | ```
12 | # Usage
13 | 1. Define a menu in `res/menu` folder.
14 | ```xml
15 |
16 |
27 | ```
28 | For each item add only 2 attributes `title` and `icon`.
29 | 2. Add `com.github.ag.floatingactionmenu.OptionsFabLayout` view to your layout.
30 | ```xml
31 |
39 | ```
40 | 3. Set mini fabs colors using `setMiniFabsColors` method(this is optional,you can define one color for all mini fabs using `options_color` attribute).
41 | ```Java
42 | fabWithOptions = (OptionsFabLayout) findViewById(R.id.fab_l);
43 |
44 | //Set mini fab's colors.
45 | fabWithOptions.setMiniFabsColors(
46 | R.color.colorPrimary,
47 | R.color.green_fab);
48 | ```
49 | 4. Handle main fab and mini fabs clicks.
50 | ```Java
51 | //Set main fab clicklistener.
52 | fabWithOptions.setMainFabOnClickListener(new View.OnClickListener() {
53 | @Override
54 | public void onClick(View view) {
55 | Toast.makeText(MainActivity.this, "Main fab clicked!", Toast.LENGTH_SHORT).show();
56 | }
57 | });
58 |
59 | //Set mini fabs clicklisteners.
60 | fabWithOptions.setMiniFabSelectedListener(new OptionsFabLayout.OnMiniFabSelectedListener() {
61 | @Override
62 | public void onMiniFabSelected(MenuItem fabItem) {
63 | switch (fabItem.getItemId()) {
64 | case R.id.fab_add:
65 | Toast.makeText(
66 | getApplicationContext(),
67 | fabItem.getTitle() + " clicked!",
68 | Toast.LENGTH_SHORT).show();
69 | break;
70 | case R.id.fab_link:
71 | Toast.makeText(getApplicationContext(),
72 | fabItem.getTitle() + "clicked!",
73 | Toast.LENGTH_SHORT).show();
74 | default:
75 | break;
76 | }
77 | }
78 | });
79 | ```
80 | # Customize
81 | | Attrubte | Description |
82 | |:-----------:|:-----------:|
83 | | options_menu| menu that contains mini fabs |
84 | | options_color | sets same color for all mini fabs.Default value is `primary color`|
85 | | src | main fab drawable |
86 | |color | main fab color|
87 | |background_color|color of background view when menu expanded|
88 |
89 | Close menu
90 | ```Java
91 | fabWithOptions.closeOptionsMenu();
92 | ```
93 | Check if menu opened
94 | ```Java
95 | fabWithOptions.isOptionsMenuOpened();
96 | ```
97 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "25.0.2"
6 | defaultConfig {
7 | applicationId "com.ag.floatingactionbuttonoptions"
8 | minSdkVersion 16
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile 'com.android.support:appcompat-v7:25.1.1'
28 | compile 'com.android.support:design:25.1.1'
29 | compile 'com.android.support:cardview-v7:25.1.1'
30 | compile project(":floatingactionmenu")
31 |
32 | testCompile 'junit:junit:4.12'
33 | }
34 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:\Users\Admin\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/ag/fabo/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.ag.fabo;
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 | * Instrumentation 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.ag.floatingactionbuttonoptions", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/ag/fabo/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.ag.fabo;
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 | import android.view.MenuItem;
8 | import android.view.View;
9 | import android.widget.Toast;
10 |
11 | import com.github.ag.floatingactionmenu.OptionsFabLayout;
12 |
13 | public class MainActivity extends AppCompatActivity {
14 |
15 | private OptionsFabLayout fabWithOptions;
16 |
17 | @Override
18 | protected void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 | setContentView(R.layout.activity_main);
21 | initToolbar();
22 | //initRecyclerView();
23 | initFabActionMenu();
24 | }
25 |
26 | private void initToolbar() {
27 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
28 | setSupportActionBar(toolbar);
29 | }
30 |
31 | private void initFabActionMenu() {
32 |
33 | fabWithOptions = (OptionsFabLayout) findViewById(R.id.fab_l);
34 |
35 | //Set mini fab's colors.
36 | fabWithOptions.setMiniFabsColors(
37 | R.color.colorPrimary,
38 | R.color.green_fab);
39 |
40 | //Set main fab clicklistener.
41 | fabWithOptions.setMainFabOnClickListener(new View.OnClickListener() {
42 | @Override
43 | public void onClick(View view) {
44 | Toast.makeText(MainActivity.this, "Main fab clicked!", Toast.LENGTH_SHORT).show();
45 | }
46 | });
47 |
48 | //Set mini fabs clicklisteners.
49 | fabWithOptions.setMiniFabSelectedListener(new OptionsFabLayout.OnMiniFabSelectedListener() {
50 | @Override
51 | public void onMiniFabSelected(MenuItem fabItem) {
52 | switch (fabItem.getItemId()) {
53 | case R.id.fab_add:
54 | Toast.makeText(
55 | getApplicationContext(),
56 | fabItem.getTitle() + " clicked!",
57 | Toast.LENGTH_SHORT).show();
58 | break;
59 | case R.id.fab_link:
60 | Toast.makeText(getApplicationContext(),
61 | fabItem.getTitle() + "clicked!",
62 | Toast.LENGTH_SHORT).show();
63 | default:
64 | break;
65 | }
66 | }
67 | });
68 | }
69 |
70 |
71 | @Override
72 | public boolean onCreateOptionsMenu(Menu menu) {
73 | // Inflate the menu; this adds items to the action bar if it is present.
74 | getMenuInflater().inflate(R.menu.menu_main, menu);
75 | return true;
76 | }
77 |
78 | @Override
79 | public void onBackPressed() {
80 | super.onBackPressed();
81 | //Closes menu if its opened.
82 | if (fabWithOptions.isOptionsMenuOpened())
83 | fabWithOptions.closeOptionsMenu();
84 | else
85 | super.onBackPressed();
86 |
87 | }
88 |
89 | @Override
90 | public boolean onOptionsItemSelected(MenuItem item) {
91 | // Handle action bar item clicks here. The action bar will
92 | // automatically handle clicks on the Home/Up button, so long
93 | // as you specify a parent activity in AndroidManifest.xml.
94 | int id = item.getItemId();
95 |
96 | //noinspection SimplifiableIfStatement
97 | if (id == R.id.action_settings) {
98 | return true;
99 | }
100 |
101 | return super.onOptionsItemSelected(item);
102 | }
103 |
104 | }
105 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_add_alarm_white_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_add_white_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_camera_alt_white_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_link_white_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
17 |
18 |
24 |
25 |
26 |
27 |
28 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/fab_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arthur-ghazaryan/floating-action-menu/8c62d0dba0441452f1ecd478cfd6c14e53067a2d/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arthur-ghazaryan/floating-action-menu/8c62d0dba0441452f1ecd478cfd6c14e53067a2d/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arthur-ghazaryan/floating-action-menu/8c62d0dba0441452f1ecd478cfd6c14e53067a2d/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arthur-ghazaryan/floating-action-menu/8c62d0dba0441452f1ecd478cfd6c14e53067a2d/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arthur-ghazaryan/floating-action-menu/8c62d0dba0441452f1ecd478cfd6c14e53067a2d/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/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 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #4285f4
4 | #1976D2
5 | #db4437
6 | #303030
7 | #95ffffff
8 | #57BB8A
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 16dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | FloatingActionButtonOptions
3 | Settings
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/test/java/com/ag/fabo/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.ag.fabo;
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 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.3.0'
9 | classpath 'com.novoda:bintray-release:0.4.0'
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/floatingactionmenu/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/floatingactionmenu/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'com.novoda.bintray-release'
3 |
4 | android {
5 |
6 | compileSdkVersion 25
7 | buildToolsVersion "25.0.2"
8 |
9 | defaultConfig {
10 | minSdkVersion 16
11 | targetSdkVersion 25
12 | versionCode 1
13 | versionName "1.0"
14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 |
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | }
25 |
26 | dependencies {
27 | compile fileTree(dir: 'libs', include: ['*.jar'])
28 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
29 | exclude group: 'com.android.support', module: 'support-annotations'
30 | })
31 | compile 'com.android.support:appcompat-v7:25.1.1'
32 | compile 'com.android.support:design:25.1.1'
33 | compile 'com.android.support:cardview-v7:25.1.1'
34 | testCompile 'junit:junit:4.12'
35 | }
36 |
37 | publish {
38 | groupId = 'com.github.arthurghazaryan'
39 | artifactId = 'floatingactionmenu'
40 | publishVersion = '1.0.0'
41 | desc = 'FloatingActionButton menu library'
42 | licences = ['Apache-2.0']
43 | website = 'https://github.com/ArthurGhazaryan/floatingactionmenu'
44 | }
45 |
--------------------------------------------------------------------------------
/floatingactionmenu/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /home/arthur/Android/Sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/floatingactionmenu/src/androidTest/java/com/github/ag/floatingactionmenu/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.github.ag.floatingactionmenu;
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 | * Instrumentation 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.github.ag.floatingactionmenu.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/floatingactionmenu/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/floatingactionmenu/src/main/java/com/github/ag/floatingactionmenu/FabWithOptions.java:
--------------------------------------------------------------------------------
1 | package com.github.ag.floatingactionmenu;
2 |
3 | import android.content.Context;
4 | import android.content.res.ColorStateList;
5 | import android.content.res.TypedArray;
6 | import android.os.Build;
7 | import android.os.Handler;
8 | import android.support.design.widget.FloatingActionButton;
9 | import android.support.v4.content.ContextCompat;
10 | import android.support.v7.view.menu.MenuBuilder;
11 | import android.util.AttributeSet;
12 | import android.util.TypedValue;
13 | import android.view.MenuInflater;
14 | import android.view.MenuItem;
15 | import android.view.View;
16 | import android.view.ViewGroup;
17 | import android.view.animation.Animation;
18 | import android.view.animation.AnimationUtils;
19 | import android.widget.LinearLayout;
20 |
21 | import java.util.ArrayList;
22 | import java.util.List;
23 |
24 | @SuppressWarnings("unused,RestrictedApi")
25 | public class FabWithOptions extends LinearLayout {
26 |
27 | private List mFabWithTitles = new ArrayList<>();
28 | private FloatingActionButton mMainFab;
29 | private MenuBuilder mFabMenu = new MenuBuilder(getContext());
30 | private boolean enableMiniFabs = false;
31 | private Context context;
32 | private OptionsFabLayout mOptionsFabLayout;
33 |
34 |
35 | /**
36 | * Constructors
37 | */
38 | public FabWithOptions(Context context) {
39 | this(context, null);
40 | }
41 |
42 | public FabWithOptions(Context context, AttributeSet attrs) {
43 | super(context, attrs);
44 | this.context = context;
45 | init(context, attrs);
46 | }
47 |
48 | private void init(Context context) {
49 | setLayoutParams(
50 | new LinearLayout.LayoutParams(
51 | ViewGroup.LayoutParams.MATCH_PARENT,
52 | ViewGroup.LayoutParams.WRAP_CONTENT));
53 |
54 | View rootView = inflate(context, R.layout.fab_options, this);
55 | mMainFab = (FloatingActionButton) rootView.findViewById(R.id.mega_fab);
56 | setOrientation(VERTICAL);
57 | setClipChildren(false);
58 | }
59 |
60 | /**
61 | * Init custom attributes.
62 | */
63 | private void init(Context context, AttributeSet attrs) {
64 | init(context);
65 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.OptionsFabLayout, 0, 0);
66 | setupMainFab(context, a);
67 | setupMiniFabs(context, a);
68 | a.recycle();
69 | }
70 |
71 | /**
72 | * Set Main FloatingActionButton parameters.
73 | */
74 | private void setupMainFab(Context context, TypedArray a) {
75 | int mainFabDrawable = a.getResourceId(R.styleable.OptionsFabLayout_src, -1);
76 |
77 | int color = a.getColor(
78 | R.styleable.OptionsFabLayout_color,
79 | ContextCompat.getColor(context, R.color.colorAccent));
80 |
81 | mMainFab.setBackgroundTintList(ColorStateList.valueOf(color));
82 |
83 | if (mainFabDrawable != -1) {
84 | mMainFab.setImageResource(mainFabDrawable);
85 | }
86 | //Set margins on Main FloatingActionButton.
87 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
88 | MarginLayoutParams params = (MarginLayoutParams) mMainFab.getLayoutParams();
89 | params.setMargins(0, 0, pxToDp(context, 4), 0);
90 | if (Build.VERSION.SDK_INT >= 17)
91 | params.setMarginEnd(pxToDp(context, 4));
92 | mMainFab.setLayoutParams(params);
93 | }
94 | }
95 |
96 | /**
97 | * Set mini fab's titles,drawables,colors.
98 | */
99 | private void setupMiniFabs(Context context, TypedArray a) {
100 | MenuInflater inflater = new MenuInflater(context);
101 |
102 | int miniFabsColor = a.getColor(
103 | R.styleable.OptionsFabLayout_options_color,
104 | ContextCompat.getColor(context, R.color.colorPrimary));
105 |
106 | int menuId = a.getResourceId(R.styleable.OptionsFabLayout_options_menu, -1);
107 | if (menuId != -1) {
108 | inflater.inflate(menuId, mFabMenu);
109 | for (int i = 0; i < mFabMenu.size(); i++) {
110 | FabWithTitleView mFabWithTitleView = new FabWithTitleView(context);
111 |
112 | setupMarginsForMiniFab(context, mFabWithTitleView);
113 |
114 | mFabWithTitleView.setMiniFabTitle(mFabMenu.getItem(i).getTitle());
115 | mFabWithTitleView.setFabIcon(mFabMenu.getItem(i).getIcon());
116 | mFabWithTitleView.setMiniFabColor(miniFabsColor);
117 |
118 | addView(mFabWithTitleView, 0);
119 | mFabWithTitles.add(mFabWithTitleView);
120 | }
121 | setMiniFabsEnable(false);
122 | }
123 | }
124 |
125 | /**
126 | * Set margins for mini fab's.
127 | */
128 | private void setupMarginsForMiniFab(Context context, FabWithTitleView FabWithTitleView) {
129 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
130 | MarginLayoutParams miniFabParams = (MarginLayoutParams) FabWithTitleView.getFab().getLayoutParams();
131 | miniFabParams.setMargins(0, 0, pxToDp(context, 12), 0);
132 | if (Build.VERSION.SDK_INT >= 17)
133 | miniFabParams.setMarginEnd(pxToDp(context, 12));
134 | FabWithTitleView.getFab().setLayoutParams(miniFabParams);
135 | }
136 | }
137 |
138 | /**
139 | * Converts px to dp.
140 | */
141 | public static int pxToDp(Context context, int pixel) {
142 | return (int) TypedValue.applyDimension(
143 | TypedValue.COMPLEX_UNIT_DIP,
144 | pixel,
145 | context.getResources().getDisplayMetrics());
146 | }
147 |
148 | /**
149 | * Set mini fab's state (enabled or disabled).
150 | */
151 | public void setMiniFabsEnable(boolean enable) {
152 | for (FabWithTitleView mFabWithlabel : mFabWithTitles) {
153 | mFabWithlabel.getCard().setVisibility(enable ? View.VISIBLE : View.GONE);
154 | mFabWithlabel.getFab().setVisibility(enable ? View.VISIBLE : View.GONE);
155 | }
156 | }
157 |
158 | /**
159 | * Set Main FloatingActionButton ClickListener.
160 | *
161 | * @param listener listener to set.
162 | * @param layout layout that contains FloatingActionButton.
163 | */
164 | public void setMainFabOnClickListener(final OnClickListener listener, final OptionsFabLayout layout) {
165 |
166 | mOptionsFabLayout = layout;
167 | mOptionsFabLayout.mRootView.setOnClickListener(new OnClickListener() {
168 | @Override
169 | public void onClick(View view) {
170 | closeOptionsMenu();
171 | }
172 | });
173 |
174 | mMainFab.setOnClickListener(new OnClickListener() {
175 | @Override
176 | public void onClick(final View view) {
177 | //Show menu when ripple ends.
178 | new Handler().postDelayed(new Runnable() {
179 | @Override
180 | public void run() {
181 | if (!enableMiniFabs) {
182 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
183 | layout.setElevation(pxToDp(context, 5));
184 | } else {
185 | layout.bringToFront();
186 | }
187 | visibilitySetup(View.VISIBLE);
188 | enableMiniFabs = true;
189 | } else {
190 | listener.onClick(view);
191 | }
192 | }
193 | }, 50);
194 |
195 | }
196 | });
197 | }
198 |
199 | /**
200 | * @return returns all mini fab's with title.
201 | */
202 | public List getMiniFabs() {
203 | return mFabWithTitles;
204 | }
205 |
206 | MenuItem getMenuItem(int index) {
207 | return mFabMenu.getItem(index);
208 | }
209 |
210 | /**
211 | * Closes options menu.
212 | */
213 | void closeOptionsMenu() {
214 | enableMiniFabs = false;
215 | visibilitySetup(View.GONE);
216 | }
217 |
218 | /**
219 | * @return returns true if menu opened,false otherwise.
220 | */
221 | boolean isMiniFabsOpened() {
222 | return enableMiniFabs;
223 | }
224 |
225 | /**
226 | * Closing animation.
227 | *
228 | * @param myView view that starts that animation.
229 | */
230 | private void shrinkAnim(final View myView) {
231 | Animation anim = AnimationUtils.loadAnimation(context, android.R.anim.fade_out);
232 | anim.setDuration(130);
233 | anim.setAnimationListener(new Animation.AnimationListener() {
234 | @Override
235 | public void onAnimationStart(Animation animation) {
236 |
237 | }
238 |
239 | @Override
240 | public void onAnimationEnd(Animation animation) {
241 | if (myView instanceof FabWithTitleView) {
242 | ((FabWithTitleView) myView).getCard().setVisibility(View.GONE);
243 | ((FabWithTitleView) myView).getFab().setVisibility(View.GONE);
244 | }
245 | myView.setVisibility(View.GONE);
246 | }
247 |
248 | @Override
249 | public void onAnimationRepeat(Animation animation) {
250 |
251 | }
252 | });
253 | myView.startAnimation(anim);
254 | }
255 |
256 | /**
257 | * Menu opening animation.
258 | *
259 | * @param myView view that starts that animation.
260 | */
261 | private void enlargeAnim(View myView) {
262 | myView.setVisibility(View.VISIBLE);
263 | Animation anim = AnimationUtils.loadAnimation(context, R.anim.enlarge);
264 | myView.startAnimation(anim);
265 | }
266 |
267 | /**
268 | * Set menus visibility (visible or invisible).
269 | */
270 | private void visibilitySetup(int visible) {
271 |
272 | if (visible == View.VISIBLE) {
273 | Animation anim = AnimationUtils.loadAnimation(context, android.R.anim.fade_in);
274 | anim.setDuration(50);
275 | mOptionsFabLayout.mRootView.setVisibility(visible);
276 | mOptionsFabLayout.mRootView.startAnimation(anim);
277 | }
278 | if (visible == View.VISIBLE)
279 | for (int i = 0; i < mFabWithTitles.size(); i++) {
280 | mFabWithTitles.get(i).setVisibility(View.VISIBLE);
281 |
282 | final int finalI = i;
283 | new Handler().postDelayed(new Runnable() {
284 | @Override
285 | public void run() {
286 | enlargeAnim(mFabWithTitles.get(finalI).getFab());
287 | }
288 | }, i * 15);
289 | if (mFabWithTitles.get(finalI).getTitleEnable())
290 | new Handler().postDelayed(new Runnable() {
291 | @Override
292 | public void run() {
293 | mFabWithTitles.get(finalI).getCard().setVisibility(View.VISIBLE);
294 | mFabWithTitles.get(finalI)
295 | .getCard()
296 | .startAnimation(
297 | AnimationUtils.loadAnimation(context, R.anim.fade_and_translate));
298 | }
299 | }, mFabWithTitles.size() * 18);
300 | }
301 | else {
302 | shrinkAnim(mOptionsFabLayout.mRootView);
303 | for (int i = 0; i < mFabWithTitles.size(); i++) {
304 | shrinkAnim(mFabWithTitles.get(i));
305 | }
306 |
307 | }
308 | }
309 | }
310 |
--------------------------------------------------------------------------------
/floatingactionmenu/src/main/java/com/github/ag/floatingactionmenu/FabWithTitleView.java:
--------------------------------------------------------------------------------
1 | package com.github.ag.floatingactionmenu;
2 |
3 |
4 | import android.content.Context;
5 | import android.content.res.ColorStateList;
6 | import android.content.res.TypedArray;
7 | import android.graphics.drawable.Drawable;
8 | import android.support.design.widget.FloatingActionButton;
9 | import android.support.v4.content.ContextCompat;
10 | import android.support.v7.widget.CardView;
11 | import android.text.TextUtils;
12 | import android.util.AttributeSet;
13 | import android.view.Gravity;
14 | import android.view.View;
15 | import android.view.ViewGroup;
16 | import android.widget.LinearLayout;
17 | import android.widget.TextView;
18 |
19 | /**
20 | * View that contains mini fab button and its title.
21 | */
22 | @SuppressWarnings("unused")
23 | final class FabWithTitleView extends LinearLayout {
24 |
25 | private TextView mTitle;
26 | private FloatingActionButton mMiniFab;
27 | private CardView mTitleBg;
28 | private boolean isTitleEnable;
29 |
30 |
31 | /**
32 | * Constructors.
33 | */
34 | public FabWithTitleView(Context context, AttributeSet attrs) {
35 | super(context, attrs);
36 | init(context, attrs);
37 | }
38 |
39 | public FabWithTitleView(Context context) {
40 | this(context, null);
41 | }
42 |
43 |
44 | /**
45 | * Init custom attributes.
46 | *
47 | * @param context context.
48 | * @param attrs attributes.
49 | */
50 | private void init(Context context, AttributeSet attrs) {
51 | init(context);
52 | TypedArray a = context.obtainStyledAttributes(attrs,
53 | R.styleable.FabWithTitleView, 0, 0);
54 |
55 | String titleText = a.getString(R.styleable.FabWithTitleView_fab_title);
56 | mTitle.setText(titleText);
57 |
58 | int fabColor = ContextCompat.getColor(context, R.color.colorPrimary);
59 | mMiniFab.setBackgroundTintList(ColorStateList.valueOf(fabColor));
60 | a.recycle();
61 | }
62 |
63 | private void init(Context context) {
64 | View rootView = inflate(context, R.layout.fab_with_label, this);
65 |
66 | mMiniFab = (FloatingActionButton) rootView.findViewById(R.id.mini_fab);
67 | mTitle = (TextView) rootView.findViewById(R.id.title_text);
68 | mTitleBg = (CardView) rootView.findViewById(R.id.title_card);
69 |
70 | LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
71 | ViewGroup.LayoutParams.WRAP_CONTENT,
72 | FabWithOptions.pxToDp(context, 56));
73 | layoutParams.gravity = Gravity.END;
74 | setLayoutParams(layoutParams);
75 | setOrientation(LinearLayout.HORIZONTAL);
76 | setClipChildren(false);
77 | setClipToPadding(false);
78 | }
79 |
80 | /**
81 | * Sets mini fab drawable.
82 | *
83 | * @param mDrawable drawable to set.
84 | */
85 | void setFabIcon(Drawable mDrawable) {
86 | mMiniFab.setImageDrawable(mDrawable);
87 | }
88 |
89 | /**
90 | * Sets mini fab title․
91 | *
92 | * @param sequence title to set.
93 | */
94 | void setMiniFabTitle(CharSequence sequence) {
95 | if (!TextUtils.isEmpty(sequence)) {
96 | mTitle.setText(sequence);
97 | isTitleEnable = true;
98 | } else {
99 | setTitleEnable(false);
100 | isTitleEnable = false;
101 | }
102 | }
103 |
104 | /**
105 | * @return true if button has title,false otherwise.
106 | */
107 | boolean getTitleEnable() {
108 | return isTitleEnable;
109 | }
110 |
111 | /**
112 | * Enables or disables title of button.
113 | */
114 | void setTitleEnable(boolean enable) {
115 | mTitleBg.setVisibility(enable ? View.VISIBLE : View.INVISIBLE);
116 | }
117 |
118 | /**
119 | * Sets mini fab color in floating action menu.
120 | *
121 | * @param color color to set.
122 | */
123 | void setMiniFabColor(int color) {
124 | mMiniFab.setBackgroundTintList(ColorStateList.valueOf(color));
125 | }
126 |
127 | /**
128 | * @return This method returns mini fab titles background card.
129 | */
130 | CardView getCard() {
131 | return mTitleBg;
132 | }
133 |
134 | /**
135 | * @return This method returns mini fab in action menu.
136 | */
137 | FloatingActionButton getFab() {
138 | return mMiniFab;
139 | }
140 |
141 | }
142 |
143 |
--------------------------------------------------------------------------------
/floatingactionmenu/src/main/java/com/github/ag/floatingactionmenu/OptionsFabLayout.java:
--------------------------------------------------------------------------------
1 | package com.github.ag.floatingactionmenu;
2 |
3 | import android.content.Context;
4 | import android.content.res.ColorStateList;
5 | import android.content.res.TypedArray;
6 | import android.graphics.Color;
7 | import android.support.v4.content.ContextCompat;
8 | import android.support.v7.widget.CardView;
9 | import android.util.AttributeSet;
10 | import android.view.MenuItem;
11 | import android.view.MotionEvent;
12 | import android.view.View;
13 | import android.view.ViewGroup;
14 | import android.widget.FrameLayout;
15 | import android.widget.RelativeLayout;
16 |
17 | @SuppressWarnings("unused")
18 | public class OptionsFabLayout extends RelativeLayout {
19 |
20 | private FabWithOptions mFabWithOptions;
21 | FrameLayout mRootView;
22 | int bgColor;
23 | private Context context;
24 |
25 | /**
26 | * Constructors.
27 | */
28 | public OptionsFabLayout(Context context) {
29 | this(context, null);
30 | }
31 |
32 | public OptionsFabLayout(Context context, AttributeSet attrs) {
33 | super(context, attrs);
34 | init(context, attrs);
35 | }
36 |
37 | @Override
38 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
39 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
40 | setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.getSize(heightMeasureSpec));
41 | }
42 |
43 |
44 | private void init(Context context) {
45 | this.context = context;
46 | mRootView = new FrameLayout(context);
47 | mRootView.setLayoutParams(new FrameLayout.LayoutParams(
48 | ViewGroup.LayoutParams.MATCH_PARENT,
49 | ViewGroup.LayoutParams.MATCH_PARENT));
50 | addView(mRootView);
51 | }
52 |
53 | /**
54 | * Init custom attributes.
55 | */
56 | private void init(Context context, AttributeSet attrs) {
57 | init(context);
58 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.OptionsFabLayout, 0, 0);
59 |
60 | bgColor = a.getColor(
61 | R.styleable.OptionsFabLayout_background_color,
62 | ContextCompat.getColor(context, R.color.colorWhiteBackground));
63 |
64 | mRootView.setBackgroundColor(bgColor);
65 | mRootView.setVisibility(View.INVISIBLE);
66 |
67 | mFabWithOptions = new FabWithOptions(context, attrs);
68 | addView(mFabWithOptions);
69 |
70 | RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mFabWithOptions.getLayoutParams();
71 | params.addRule(ALIGN_PARENT_RIGHT);
72 | params.addRule(ALIGN_PARENT_BOTTOM);
73 | mFabWithOptions.setLayoutParams(params);
74 |
75 | a.recycle();
76 | }
77 |
78 | /**
79 | * Sets Main FloatingActionButton ClickListener.
80 | *
81 | * @param listener listener to set.
82 | */
83 | public void setMainFabOnClickListener(OnClickListener listener) {
84 | mFabWithOptions.setMainFabOnClickListener(listener, this);
85 | }
86 |
87 | /**
88 | * Closes fab menu.
89 | */
90 | public void closeOptionsMenu() {
91 | mFabWithOptions.closeOptionsMenu();
92 | }
93 |
94 | /**
95 | * @return returns true if menu opened,false otherwise.
96 | */
97 | public boolean isOptionsMenuOpened() {
98 | return mFabWithOptions.isMiniFabsOpened();
99 | }
100 |
101 | /**
102 | * Sets mini fab's colors.
103 | *
104 | * @param colors colors to set.
105 | */
106 | public void setMiniFabsColors(int... colors) {
107 | for (int i = 0; i < mFabWithOptions.getMiniFabs().size(); i++) {
108 | mFabWithOptions.getMiniFabs()
109 | .get(i)
110 | .getFab()
111 | .setBackgroundTintList(
112 | ColorStateList.valueOf(ContextCompat.getColor(context, colors[i])));
113 | }
114 | }
115 |
116 | /**
117 | * Set a listener that will be notified when a menu fab is selected.
118 | *
119 | * @param listener listener to set.
120 | */
121 | public void setMiniFabSelectedListener(final OnMiniFabSelectedListener listener) {
122 | for (int miniFabIndex = 0; miniFabIndex < mFabWithOptions.getMiniFabs().size(); miniFabIndex++) {
123 | final int finalMiniFabIndex = miniFabIndex;
124 | mFabWithOptions.getMiniFabs().get(miniFabIndex).getFab().setOnClickListener(new OnClickListener() {
125 | @Override
126 | public void onClick(View view) {
127 | listener.onMiniFabSelected(mFabWithOptions.getMenuItem(finalMiniFabIndex));
128 | }
129 | });
130 | mFabWithOptions.getMiniFabs().get(miniFabIndex).getCard().setOnClickListener(new View.OnClickListener() {
131 |
132 | @Override
133 | public void onClick(View v) {
134 | listener.onMiniFabSelected(mFabWithOptions.getMenuItem(finalMiniFabIndex));
135 | }
136 |
137 | });
138 | mFabWithOptions.getMiniFabs().get(miniFabIndex).getCard().setOnTouchListener(new OnTouchListener() {
139 | @Override
140 | public boolean onTouch(View v, MotionEvent event) {
141 | if (event.getAction() == MotionEvent.ACTION_DOWN)
142 | ((CardView) v).setCardBackgroundColor(Color.parseColor("#ebebeb"));
143 | else if (event.getAction() == MotionEvent.ACTION_UP)
144 | ((CardView) v).setCardBackgroundColor(
145 | ContextCompat.getColor(context, R.color.cardview_light_background));
146 | return true;
147 | }
148 | });
149 | }
150 | }
151 |
152 | /**
153 | * Listener for handling events on mini fab's.
154 | */
155 | public interface OnMiniFabSelectedListener {
156 | void onMiniFabSelected(MenuItem fabItem);
157 | }
158 |
159 | }
160 |
--------------------------------------------------------------------------------
/floatingactionmenu/src/main/res/anim/enlarge.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
13 |
14 |
18 |
19 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/floatingactionmenu/src/main/res/anim/fade_and_translate.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
10 |
11 |
12 |
16 |
--------------------------------------------------------------------------------
/floatingactionmenu/src/main/res/anim/shrink.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
14 |
15 |
--------------------------------------------------------------------------------
/floatingactionmenu/src/main/res/drawable/card_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/floatingactionmenu/src/main/res/layout/fab_options.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
13 |
14 |
--------------------------------------------------------------------------------
/floatingactionmenu/src/main/res/layout/fab_with_label.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
20 |
21 |
33 |
34 |
35 |
47 |
48 |
--------------------------------------------------------------------------------
/floatingactionmenu/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/floatingactionmenu/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #4285f4
4 | #1976D2
5 | #db4437
6 | #303030
7 | #95ffffff
8 | #57BB8A
9 |
10 |
--------------------------------------------------------------------------------
/floatingactionmenu/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | floatingactionmenu
3 |
4 | Add alarm
5 |
6 |
--------------------------------------------------------------------------------
/floatingactionmenu/src/test/java/com/github/ag/floatingactionmenu/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.github.ag.floatingactionmenu;
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 | }
--------------------------------------------------------------------------------
/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 |
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/arthur-ghazaryan/floating-action-menu/8c62d0dba0441452f1ecd478cfd6c14e53067a2d/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Feb 08 18:24:29 AMT 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-3.3-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 |
--------------------------------------------------------------------------------
/screenshots/Screenshot_20170318-221201.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arthur-ghazaryan/floating-action-menu/8c62d0dba0441452f1ecd478cfd6c14e53067a2d/screenshots/Screenshot_20170318-221201.png
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':floatingactionmenu'
2 |
--------------------------------------------------------------------------------