All Projects → jahirfiquitiva → Fabsmenu

jahirfiquitiva / Fabsmenu

Licence: apache-2.0
A simple library to use a menu of FloatingActionButtons from Design Support Library that follow Material Design Guidelines

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Fabsmenu

Materialdesigndemo
A beautiful app designed with Material Design.
Stars: ✭ 1,391 (+329.32%)
Mutual labels:  material, design, materialdesign
flutter fab dialer
Floating action button dialer
Stars: ✭ 66 (-79.63%)
Mutual labels:  menu, floatingactionbutton, fab
Materialdesign2
A beautiful app designed with Material Design 2 using Android X.
Stars: ✭ 170 (-47.53%)
Mutual labels:  material, design, materialdesign
Material Bottom Nav
A bottom navigation bar adhering to the Material Design specification.
Stars: ✭ 41 (-87.35%)
Mutual labels:  material, design, menu
Dialogsheet
An Android library to create fully material designed bottom dialogs similar to the Android Pay app.
Stars: ✭ 236 (-27.16%)
Mutual labels:  material, design, materialdesign
Materialcalendar
A Material design calendar inspired by the CalendarView of School Diary.
Stars: ✭ 196 (-39.51%)
Mutual labels:  android-app, material
Bottomsheet
BottomSheet dialog library for Android
Stars: ✭ 219 (-32.41%)
Mutual labels:  android-app, design
Material Backdrop
A simple solution for implementing Backdrop pattern for Android
Stars: ✭ 221 (-31.79%)
Mutual labels:  android-app, material
FireFiles
Powerful Android File Manager for everything that runs on Android OS (Android TV, Android Watch, Mobile, etc)
Stars: ✭ 37 (-88.58%)
Mutual labels:  material, android-app
Magicprint Ecommerce App Android
E-Commerce App Source Code for Android with Material Design Pattern Using Firebase and MySQL with Android Lottie Animations just like Flipkart, Myntra and Amazon :)
Stars: ✭ 331 (+2.16%)
Mutual labels:  android-app, material
LavaFab
💧 Android floating action button menu with "lava" animation
Stars: ✭ 51 (-84.26%)
Mutual labels:  menu, fab
ToDue
An android app to keep track of your ToDo's
Stars: ✭ 23 (-92.9%)
Mutual labels:  material, android-app
Ibackdrop
A library to simply use Backdrop in your project (make it easy). Read more ->
Stars: ✭ 137 (-57.72%)
Mutual labels:  android-app, material
Material Kit React Native
Material Kit React Native
Stars: ✭ 424 (+30.86%)
Mutual labels:  android-app, material
Bltaxi
🚕 BL Taxi is a simple app for calling a taxi in the city Banja Luka built using modern Android development tools
Stars: ✭ 338 (+4.32%)
Mutual labels:  android-app, material
Fab
🛍️ A Floating Action Button for macOS. Inspired by Material Design, and written in Swift.
Stars: ✭ 24 (-92.59%)
Mutual labels:  floatingactionbutton, fab
timepicker-ui
timepicker-ui is an easy library with timepicker. Fully wrote with TypeScript. This library is based on Material Design from Google.
Stars: ✭ 18 (-94.44%)
Mutual labels:  design, material
react-mdl-extra
React MDL Extra components
Stars: ✭ 41 (-87.35%)
Mutual labels:  design, material
Dragfloatingactionbutton
一个可以随处拖曳FloatingActionButton,边缘自动吸附,可设置按钮悬浮透明度,拖曳避免阻挡界面视图无法查看。
Stars: ✭ 258 (-20.37%)
Mutual labels:  menu, floatingactionbutton
Githubfollows
A demo project based on MVVM architecture and material design & animations.
Stars: ✭ 272 (-16.05%)
Mutual labels:  android-app, material

FloatingActionButtons Menu (FABsMenu)

API JitPack Badge Build Status Codacy Badge

Just a simple library to use a menu of FloatingActionButtons from Design Support Library that follows Material Design guidelines

Show some 💙

GitHub stars GitHub forks GitHub watchers

Follow on GitHub Twitter Follow


Long story

Android Support/Design libraries still doesn't include a FloatingActionButtons menu, and the libraries found here and there are either too cluttered or filled with unnecessary stuff or using custom views that simply don't follow guidelines, which made me avoid them.

I was looking for a new library, and the ones I knew of, have been deprecated/abandoned because the simple FABs are included in the design support library, so I felt the urge of having something that could suffice my needs, and couldn't help but create a library, although is mostly based on one of those abandoned libraries.

This library uses the design library FABs but wraps them inside a ViewGroup to make them look like the FloatingActionButtons menu suggested in Material Design guidelines.


Deprecated

Unfortunately, due to my limited time between work+University, I don't really find the way to provide proper support for this library. I really appreciate everyone that has been using it and that might continue using it, but, at least for now, this library is deprecated.

If you want to use a similar and more frequently updated library, please refer to @leinardi 's FloatingActionSpeedDial

Thanks again for the amazing support. 🙌


Preview

FABs Menu Preview

Changelog

🔘 You can find it in the Releases page


Including in your project

FABsMenu is available via JitPack, so getting it as simple as adding it as a dependency, like this:

  1. Add JitPack repository to your root build.gradle file
allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}
  1. Add the dependency in your project build.gradle file
dependencies {
    implementation 'me.jahirfiquitiva:FABsMenu:{latest version}'
}

where {latest version} corresponds to published version in JitPack

How to implement

You can use it in your layout, just like this:

<RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:fab="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    <!-- Menu Layout is needed for the overlay to work -->
    <jahirfiquitiva.libs.fabsmenu.FABsMenuLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            fab:fabs_menu_overlayColor="#4d000000"
            fab:fabs_menu_clickableOverlay="true"
            tools:layout_behavior="@string/fabs_menu_layout_behavior">

        <!-- FABs Menu is the main view. It will contain all the items FABs and it create the menu fab itself -->
        <jahirfiquitiva.libs.fabsmenu.FABsMenu
                android:id="@+id/fabs_menu"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom|end"
                android:clipChildren="false"
                fab:fab_menuMargins="16dp"
                fab:fab_moreButtonPlusIcon="@drawable/ic_plus"
                fab:fab_moreButtonBackgroundColor="@color/pink"
                fab:fab_moreButtonRippleColor="@color/pink_pressed"
                fab:fab_moreButtonSize="normal"
                fab:fab_labelsPosition="left"
                fab:fab_expandDirection="up">

            <!-- This is the item that appears at the top of the menu -->
            <jahirfiquitiva.libs.fabsmenu.TitleFAB
                    android:id="@+id/to_remove"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    fab:srcCompat="@drawable/ic_share"
                    fab:fabSize="mini"
                    fab:backgroundTint="@color/colorAccent"
                    fab:rippleColor="@color/colorAccent"
                    fab:fab_title="This is a custom title"
                    fab:fab_title_backgroundColor="@color/colorAccent"
                    fab:fab_title_textColor="@android:color/white"/>

            <jahirfiquitiva.libs.fabsmenu.TitleFAB
                    android:id="@+id/clickable_title"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    fab:srcCompat="@drawable/ic_pencil"
                    fab:fab_title="Clickable title"
                    fab:fab_enableTitleClick="true"
                    fab:fab_title_textColor="@color/colorAccent"
                    fab:fabSize="mini"
                    fab:backgroundTint="@color/colorAccent"
                    fab:rippleColor="@color/colorAccent"/>

            <jahirfiquitiva.libs.fabsmenu.TitleFAB
                    android:id="@+id/mini_fab"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    fab:srcCompat="@drawable/ic_heart"
                    fab:fab_title="Mini fab with long text"
                    fab:fabSize="mini"
                    fab:backgroundTint="@color/blue_semi"
                    fab:rippleColor="@color/blue_semi_pressed"/>

            <!-- This item will appear just above the menu FAB -->
            <jahirfiquitiva.libs.fabsmenu.TitleFAB
                    android:id="@+id/green_fab"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    fab:srcCompat="@drawable/ic_person"
                    fab:fab_title="Fab with even longer text that might not even fit in all the screens"
                    fab:fabSize="normal"
                    fab:backgroundTint="@color/green"
                    fab:rippleColor="@color/green_pressed"/>

        </jahirfiquitiva.libs.fabsmenu.FABsMenu>

    </jahirfiquitiva.libs.fabsmenu.FABsMenuLayout>

</RelativeLayout>

And call the methods in java code:

final FABsMenu menu = findViewById(R.id.fabs_menu);
menu.setMenuUpdateListener(new FABsMenuListener() {
    // You don't need to override all methods. Just the ones you want.

    @Override
    public void onMenuClicked(FABsMenu fabsMenu) {
        super.onMenuClicked(fabsMenu); // Default implementation opens the menu on click
        showToast("You pressed the menu!");
    }

    @Override
    public void onMenuCollapsed(FABsMenu fabsMenu) {
        super.onMenuCollapsed(fabsMenu);
        showToast("The menu has been collapsed!");
    }

    @Override
    public void onMenuExpanded(FABsMenu fabsMenu) {
        super.onMenuExpanded(fabsMenu);
        showToast("The menu has been expanded!");
    }
});

You can also add or remove buttons programmatically:

// Removes a button
TitleFAB toRemove = findViewById(R.id.to_remove);
menu.removeButton(toRemove);

// Adds a button to the bottom
TitleFAB toAdd = new TitleFAB(this);
toAdd.setTitle("A new added fab");
toAdd.setBackgroundColor(Color.parseColor("#ff5722"));
menu.addButton(toAdd);

And you can also attach the FABsMenu to a RecyclerView so it gets hidden on scroll, like this:

RecyclerView rv = findViewById(R.id.rv);
FABsMenu menu = findViewById(R.id.fabs_menu);
menu.attachToRecyclerView(rv);

Attributes explanation

  1. FABsMenuLayout attributes:

    • fabs_menu_overlayColor --> Set the menu overlay color (Defaults to #4d000000)
    • fabs_menu_clickableOverlay --> Specify whether the overlay is clickable or not (Defaults to true)
  2. FABsMenu attributes

    • fab_menuMargins --> The margins of the menu (Defaults to 16dp)
    • fab_menuTopMargin --> The top margin of the menu (Defaults to fab_menuMargins)
    • fab_menuBottomMargin --> The bottom margin of the menu (Defaults to fab_menuMargins)
    • fab_menuRightMargin --> The right margin of the menu (Defaults to fab_menuMargins)
    • fab_menuLeftMargin --> The left margin of the menu (Defaults to fab_menuMargins)
    • fab_moreButtonRippleColor --> The menu fab ripples color
    • fab_moreButtonBackgroundColor --> The menu fab background color
    • fab_moreButtonSize --> Specify the size. Choose between mini and normal (Defaults to normal)
    • fab_moreButtonPlusIcon --> The reference to the plus icon drawable (Defaults to null)
    • fab_labelsPosition --> Where to show the labels. Choose between left and right (Defaults to left)
    • fab_expandDirection --> The direction the menu should expand to. Choose between up, down, left and right. (Defaults to up)
  3. TitleFAB attributes:

    • fab_title --> A string that will be shown as the fab label (Defaults to null)
    • fab_title_backgroundColor --> The color of the label background (Defaults to #fff)
    • fab_title_textColor --> The color of the label text (Defaults to #000)
    • fab_title_cornerRadius --> The dimension of the label corners radius (Defaults to 2dp)
    • fab_title_textPadding --> The dimension of the text padding (Defaults to 8dp)
    • fab_enableTitleClick --> Specify whether the label click should fire the fab click too (Defaults to false)

Important notes

  1. The FABs are based on the ones from Design Support libraries, so you can use these customization attributes:

    	fab:fabSize="mini"
    	fab:backgroundTint="@color/blue_semi"
    	fab:rippleColor="@color/blue_semi_pressed"
    
  2. For the FABsMenu, the previous attributes will not work.

  3. For the FABsMenu, use fab_menuMargins instead of the normal android:layout_margin attribute. This will prevent FABs elevation being cropped.

  4. As stated in guidelines, a FABsMenu should not have more than 6 items. If you use more than 6, you will get an IllegalArgumentException. Also, remember FABs menu should have at least 3 items too.

  5. For now, the icon you set for FABsMenu will always rotate, so be sure you set an icon that looks good in both states (normal and rotated).


Apps using FABsMenu

  • Yours? Fill an issue and let me know ;)

Developed by

Jahir Fiquitiva

Follow on GitHub Twitter Follow

If you found this app/library helpful and want to thank me, you can:

Thanks in advance! 🙏


Credits

This project is based on Future Simple's android-floating-action-button project, which is also based on FloatingActionButton library by Oleksandr Melnykov.

License

Copyright (c) 2018 Jahir Fiquitiva

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Original license

Copyright (c) 2014 Jerzy Chalupski

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].