All Projects → gowong → Material Sheet Fab

gowong / Material Sheet Fab

Licence: mit
Android library that provides the floating action button to sheet transition from Google's Material Design.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Material Sheet Fab

Quickactionview
View that shows quick actions when long pressed, inspired by Pinterest
Stars: ✭ 185 (-88.32%)
Mutual labels:  material-design, fab
Toolbar Button
FAB to Toolbar Button library for Android Material Collapsing Toolbar
Stars: ✭ 299 (-81.12%)
Mutual labels:  material-design, fab
Materialfabspeeddial
Android UI library of FAB speed dial
Stars: ✭ 193 (-87.82%)
Mutual labels:  material-design, fab
Android Material Design For Pre Lollipop
Various UI implementations, animations & effects based on Material Design compatible with pre Lollipop devices as well. (Work in progess)
Stars: ✭ 585 (-63.07%)
Mutual labels:  material-design, fab
Jjfloatingactionbutton
Floating Action Button for iOS
Stars: ✭ 243 (-84.66%)
Mutual labels:  material-design, fab
React Fab Fan
Floating action button fan built with react and react-motion
Stars: ✭ 14 (-99.12%)
Mutual labels:  material-design, fab
Servicestackvs
ServiceStackVS - Visual Studio extension for ServiceStack
Stars: ✭ 117 (-92.61%)
Mutual labels:  material-design
Camerabutton
Instagram-like button for taking photos or recording videos
Stars: ✭ 121 (-92.36%)
Mutual labels:  material-design
Mato
Mato - Icon pack for Linux
Stars: ✭ 117 (-92.61%)
Mutual labels:  material-design
Flutter Movies4u
Movies4u app UI is simple enough to use and the app is a fun way to get an overview of your movie experience. This repo created with help of awesome UI, material Design and latest feature. this repo contain major feature like : dark theme.
Stars: ✭ 116 (-92.68%)
Mutual labels:  material-design
Ct Material Kit Pro
Premium Bootstrap 4 UI Kit based on Google's Material Design
Stars: ✭ 123 (-92.23%)
Mutual labels:  material-design
Shifting tabbar
A custom tab bar widget for Flutter framework.
Stars: ✭ 124 (-92.17%)
Mutual labels:  material-design
Colordrop
Interactive Drag & Drop Coloring with Material Design Color palette
Stars: ✭ 120 (-92.42%)
Mutual labels:  material-design
Vsc Material Theme
Material Theme, the most epic theme for Visual Studio Code
Stars: ✭ 1,617 (+2.08%)
Mutual labels:  material-design
Sdkmonitor
App to display and monitor the targetSDK from installed apps.
Stars: ✭ 122 (-92.3%)
Mutual labels:  material-design
Brainphaser
Android Quiz App (Spaced Repetition) made with Material Design; features categories, statistics and different question modes
Stars: ✭ 117 (-92.61%)
Mutual labels:  material-design
Nim websitecreator
Nim fullstack website framework - deploy a website within minutes
Stars: ✭ 124 (-92.17%)
Mutual labels:  material-design
Vuetify Swipeout
👆 A swipe out example built with Vue CLI 3 + Vuetify + Swiper.
Stars: ✭ 117 (-92.61%)
Mutual labels:  material-design
Materialnumberpicker
A customizable number picker based on Material guidelines
Stars: ✭ 120 (-92.42%)
Mutual labels:  material-design
Svelte Material Ui
Svelte Material UI Components
Stars: ✭ 2,081 (+31.38%)
Mutual labels:  material-design

MaterialSheetFab

Maven Central Codacy Badge GitHub license Android Arsenal Android Weekly

Library that implements the floating action button to sheet transition from Google's Material Design documentation. It can be used with any FAB library on Android 4.0+ (API levels >= 14).

Transition

Installation

Gradle

Add the dependency (available from mavenCentral and jcenter) to your build.gradle:

implementation 'com.gordonwong:material-sheet-fab:1.2.1'

Proguard

Modify your proguard configuration (if your app is using Proguard).

-keep class io.codetail.animation.arcanimator.** { *; }

Usage

Implement the FAB:

You can use any FAB library as long as it implements the AnimatedFab interface.

import android.support.design.widget.FloatingActionButton;

public class Fab extends FloatingActionButton implements AnimatedFab {

   /**
    * Shows the FAB.
    */
    @Override
    public void show() {
        show(0, 0);
    }

    /**
     * Shows the FAB and sets the FAB's translation.
     *
     * @param translationX translation X value
     * @param translationY translation Y value
     */
    @Override
    public void show(float translationX, float translationY) {
        // NOTE: Using the parameters is only needed if you want
        // to support moving the FAB around the screen.
        // NOTE: This immediately hides the FAB. An animation can 
        // be used instead - see the sample app.
        setVisibility(View.VISIBLE);
    }

    /**
     * Hides the FAB.
     */
    @Override
    public void hide() {
        // NOTE: This immediately hides the FAB. An animation can
        // be used instead - see the sample app.
        setVisibility(View.INVISIBLE);
    }
}

Modify the layouts:

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

   <!-- Your FAB implementation -->
   <path.to.your.fab
        android:id="@+id/fab"
        android:layout_alignParentBottom="true"
        android:layout_alignParentEnd="true"
        android:layout_alignParentRight="true" />

    <!-- Overlay that dims the screen -->
    <com.gordonwong.materialsheetfab.DimOverlayFrameLayout
        android:id="@+id/overlay"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <!-- Circular reveal container for the sheet -->
    <io.codetail.widget.RevealLinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="end|bottom"
        android:orientation="vertical">

        <!-- Sheet that contains your items -->
        <android.support.v7.widget.CardView
            android:id="@+id/fab_sheet"
            android:layout_width="250dp"
            android:layout_height="300dp">
            
            <!-- TODO: Put your sheet items here -->
            
        </android.support.v7.widget.CardView>
    </io.codetail.widget.RevealLinearLayout>
</RelativeLayout>

Initialize the MaterialSheetFab:

This can be in your Activity or Fragment.

public class MaterialSheetFabActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Fab fab = (Fab) findViewById(R.id.fab);
        View sheetView = findViewById(R.id.fab_sheet);
        View overlay = findViewById(R.id.dim_overlay);
        int sheetColor = getResources().getColor(R.color.fab_sheet_color);
        int fabColor = getResources().getColor(R.color.fab_color);

        // Initialize material sheet FAB
        materialSheetFab = new MaterialSheetFab<>(fab, sheetView, overlay,
            sheetColor, fabColor);
    }
}

Optional:

Close sheet on back button:

@Override
public void onBackPressed() {
    if (materialSheetFab.isSheetVisible()) {
        materialSheetFab.hideSheet();
    } else {
        super.onBackPressed();
    }
}

Listen to events:

materialSheetFab.setEventListener(new MaterialSheetFabEventListener() {
    @Override
    public void onShowSheet() {
        // Called when the material sheet's "show" animation starts.
    }
    
    @Override
    public void onSheetShown() {
        // Called when the material sheet's "show" animation ends.
    }

    @Override
    public void onHideSheet() {
        // Called when the material sheet's "hide" animation starts.
    }
     
    public void onSheetHidden() {
        // Called when the material sheet's "hide" animation ends.
    }
});

Move the FAB around the screen (this is useful for coordinating with snackbars):

materialSheetFab.showFab(translationX, translationY);

Sample app

Get it on Google Play

Sample 1 Sample 2

Take a look at the sample code and try the app.

Apps using MaterialSheetFab

Feel free to open a pull request to include your app here.

Icon App
BG Monitor BG Monitor - Diabetes Management

Changelog

See changelog here.

Credits

The following libraries are used:
CircularReveal - Adds circular reveal animation on Android versions < 5.0
ArcAnimator - Used to animate FAB in an arc

License

The MIT License (MIT)

Copyright (c) 2015 Gordon Wong

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
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].