├── 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 | 17 | 21 | 22 | 26 | 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 | 3 | 7 | 8 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 5 | 10 | 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 |