A layout to transition between two views using a Floating Action Button as shown in many Material Design concepts

Overview

This library is no longer maintained ⚠️

FABRevealLayout

Android Arsenal

A layout to transition between two views using a Floating Action Button as shown in many Material Design concepts

Usage

Sample 1

FABRevealLayout is very simple to use. You only need to include a FloatingActionButton from the Android Design Support Library and two views (namely main and secondary) within the layout. FABRevealLayout will position your views accordingly and provide the transition between them automatically.

<com.truizlop.fabreveallayout.FABRevealLayout
    android:id="@+id/fab_reveal_layout"
    android:layout_width="match_parent"
    android:layout_height="@dimen/fab_reveal_height"
    >

    <android.support.design.widget.FloatingActionButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:backgroundTint="@color/some_color"
        android:src="@drawable/some_drawable"
        />

    <RelativeLayout
        android:id="@+id/main_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

		...
    </RelativeLayout>

    <RelativeLayout
        android:id="@+id/secondary_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

		...
    </RelativeLayout>

</com.truizlop.fabreveallayout.FABRevealLayout>

Please note that the secondary view should have a transparent background so that the color animation works correctly.

Further animation

Sample 2

If you want to animate the items inside the views of a FABRevealLayout or perform any other action when the transition is completed, you can register a listener.

private void configureFABReveal(FABRevealLayout fabRevealLayout) {
    fabRevealLayout.setOnRevealChangeListener(new OnRevealChangeListener() {
        @Override
        public void onMainViewAppeared(FABRevealLayout fabRevealLayout, View mainView) {}

        @Override
        public void onSecondaryViewAppeared(final FABRevealLayout fabRevealLayout, View secondaryView) {}
    });
}

Also, to trigger the reveal and hide animations programmatically, you can use the following methods:

fabRevealLayout.revealMainView();
fabRevealLayout.revealSecondaryView();

Limitations

Currently, both main and secondary views inside FABRevealLayout should have the same height so that the animation works properly.

Get it!

FABRevealLayout is available through JCenter. To be able to use this library in your project, add the following dependency to your build.gradle file:

dependencies{
	implementation 'com.truizlop.fabreveallayout:library:1.0.0'
}

Acknowledgements

FABRevealLayout is based on this proof of concept by Saúl Molinero and the explanations for curved animations by Chet Haase.

License

Copyright 2015 Tomás Ruiz-López

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.
Comments
  • Animation of image

    Animation of image

    Hello. can i ask you what is your animation you used in this gif image: https://github.com/truizlop/FABRevealLayout/raw/master/art/fabrl_qotsa.gif It's so smooth. Thank you

    opened by fukemy 2
  • Is there a way to increase the floating action button's right margin?

    Is there a way to increase the floating action button's right margin?

    I'm using this library and It works great. I'm wondering if it is possible increase the floating action button's right margin since it is always very close to the right edge of the screen. Using layout_marginRight in XML doesn't do anything.

    opened by GAumala 1
  • refined

    refined"synchronization"

    Thank you for sharing this project! I find that when the method revealMainView(or revealSecondaryView) is invoked too quickly, the animation listener will be added more than one time, which leads to the strange behavior of views.

    I fixed this issue by adding an AtomicBoolean field called "isAnimating" to control the animation of views.

    opened by arybin-cn 0
  • Unit Tests for improved test coverage

    Unit Tests for improved test coverage

    Hi there

    My name is Farid. I'm a developer with great interest in making open source contributions to popular projects.

    My company - DevFactory - is sponsoring me to improve unit test coverage in open source projects.

    I have analyzed FABRevealLayout and observed that there is room for improvement of coverage.

    If you are interested in having us work towards improving the project’s coverage to 80%, please let me know and we will add it to our pipeline. Our first step will be to create a pull request with a sample. Once you approve it, we'll follow up with one or two more pull requests. Our target is to increase code coverage to above 80 percent.

    For an example of our work, please see these Pull Requests accepted by the community:

    • https://github.com/oblac/jodd/pull/264
    • https://github.com/iluwatar/java-design-patterns/pull/294

    I'm looking forward to your confirmation.

    Thank you, Mohd Farid Open Source Code Coverage Team DevFactory

    opened by mfarid 0
  • Different behavior [Enhancement]

    Different behavior [Enhancement]

    Hi @truizlop

    Thank you for such an amazing library. I was thinking of a different implementation / behavior. In which the FAB would be at right button when clicked it would come at the center of the screen and then perform the reveal animation to cover complete screen. The covering screen can have a secondary layout. I know this is difficult to understand. I'll try to get some visuals if possible.

    opened by AkshayChordiya 0
  • which view is opened

    which view is opened

    how to check which view is opened , in case of back button i want to know which view is opened so that i can close instead of calling super even when my secondary view is opened

    opened by adit77799 0
Owner
Tomás Ruiz-López
iOS/Swift Software Engineer at GoodNotes. Creator of @bow_swift.
Tomás Ruiz-López
null 2.4k Dec 30, 2022
Responsive Layout Gird Configuration using Compose. An adaptive layout

ResponsiveGrid Responsive Grid is most followed layout system by the designer as it adapts to screen size and orientation, ensuring consistency across

null 4 Apr 12, 2022
Material Design Search View Layout, now implemented in Google Maps, Dialer, etc

THIS PROJECT IS DEPRECATED Component is not maintained anymore. Implementation of Lollipop+ Dialer and Google Maps. DEMO Add in View Add to your layou

Sahil Dave 1.1k Dec 22, 2022
A pull to refresh layout for android, the RecyclerRefreshLayout is based on the SwipeRefreshLayout. support all the views, highly customizable, code simplicity, etc. really a practical RefreshLayout!

RecyclerRefreshLayout English | 中文版 RecyclerRefreshLayout based on the {@link android.support.v4.widget.SwipeRefreshLayout} The RecyclerRefreshLayout

dinus_developer 1.7k Nov 10, 2022
[UNMAINTAINED]: AndroidMosaicLayout is android layout to display group of views as grid consists of different asymmetric patterns (90 different patterns).

AndroidMosaicLayout AndroidMosaicLayout is android layout to display group of views in more that 90 different patterns. What is AndroidMosaicLayout? I

Adham Enaya 474 Nov 12, 2022
An android layout to re-arrange child views via dragging

Android Rearrangeable Layout An android layout to re-arrange child views via dragging Screencast Demo Layout Usage All the child views are draggable o

Raja Sharan Mamidala 273 Nov 25, 2022
:octocat: 📃 FoldingCell is a material design expanding content cell inspired by folding paper material made by @Ramotion

FOLDING CELL [JAVA] Expanding content cell with animation inspired by folding paper card material design. We specialize in the designing and coding of

Ramotion 4.9k Dec 7, 2022
Allows the easy creation of animated transition effects when the state of Android UI has changed

android-transition Android-Transition allows the easy creation of view transitions that reacts to user inputs. The library is designed to be general e

Kai 615 Nov 14, 2022
Pixel perfect for design layout android

Pixelperfect Pixel perfect helps you design layouts according to the resolution of your users' device Follow the steps below to implement : dependen

null 10 Oct 23, 2022
A floating menu library for Android.

Hover Hover is a floating menu implementation for Android. Goals The goals of Hover are to: Provide an easy-to-use, out-of-the-box floating menu imple

Google 2.7k Dec 27, 2022
Android layout that simulates physics using JBox2D

PhysicsLayout Android layout that simulates physics using JBox2D. Simply add views, enable physics, and watch them fall! See it in action with the sam

John Carlson 689 Dec 29, 2022
A Playground repository to showcase UI's and transitions built using Motion Layout.

A collection of UI's built to showcase the capabilities of Motion Layout and Constraint Layout 2.0/2.1

Saurabh 163 Dec 22, 2022
Android drawer icon with material design animation

LDrawer Android drawer icon with material design animation Note Basically same as appcompat_v7 version 21, you can use appcompat_v7 compile 'com.andro

Hasan Keklik 1.4k Dec 25, 2022
Navigation Drawer Activity with material design style and simplified methods

MaterialNavigationDrawer Navigation Drawer Activity with material design style and simplified methods       It requires 10+ API and android support v7

Fabio Biola 1.6k Dec 30, 2022
Android Sample Project with Material Design and Toolbar.

AndroidMaterialDesignToolbar -- PROJECT IS NOT SUPPORTED Android Sample Project with Material Design and Toolbar. Project use Appcompat library for ma

kemal selim tekinarslan 713 Nov 11, 2022
An implementation of tap targets from the Material Design guidelines for feature discovery.

TapTargetView An implementation of tap targets from Google's Material Design guidelines on feature discovery. Min SDK: 14 JavaDoc Installation TapTar

Keepsafe 5.2k Jan 9, 2023
Material Design tap target for Android. https://sjwall.github.io/MaterialTapTargetPrompt/

Material Tap Target Prompt A Tap Target implementation in Android based on Material Design Onboarding guidelines. For more information on tap targets

Sam Wall 1.5k Dec 29, 2022
Ultra Pull to Refresh for Android. Support all the views.

Welcome to follow me on GitHub or Twitter GitHub: https://github.com/liaohuqiu Twitter: https://twitter.com/liaohuqiu 中文版文档 Wanna auto-load-more? This

Huqiu Liao 9.6k Jan 5, 2023