Skip to content

Latest commit

 

History

History
72 lines (54 loc) · 2.87 KB

README.md

File metadata and controls

72 lines (54 loc) · 2.87 KB

FlyingFab

License: MIT Download Kotlin

FlyingFab is a small library for animating FAB as if it is "flying", written in Kotlin.

It is created for the specific case in which an AppBarLayout containing CollapsingToolbarLayout is present alongside with the FAB.

It listens for AppBarLayout.OnOffsetChangedListener and implements FAB animation depending on its state - Collapsed, Expanded or Collapsing.

The interface is pretty simple to use. You just need to pass the AppBarLayout and the FAB after they are inflated.

override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_animated_fab)
        
        FlyingFab().setup(app_bar_layout, fab_1)
        //...
}

FlyingFab includes a flexible API that allows developers to change the animation duration and TimeInterpolator for the up or/and down animations. You just need to use the methods below:

public fun interpolatorUp(interpolator: TimeInterpolator?): FlyingFab
public fun interpolatorDown(interpolator: TimeInterpolator?): FlyingFab
public fun animationDurationUp(animationDuration: Long?): FlyingFab
public fun animationDurationDown(animationDuration: Long?): FlyingFab

Download

Grab via Gradle:

compile 'bg.devlabs.flyingfab:library:<latest version>'

or Maven:

<dependency>
  <groupId>bg.devlabs.flyingfab</groupId>
  <artifactId>flying-fab</artifactId>
  <version><latest version></version>
  <type>pom</type>
</dependency> 

Samples

Code samples are available in the app module. Here's a sample video:

Sample Video

Getting Help

To report a specific problem or feature request, open a new issue on Github. For questions, suggestions, or anything else you can send me an email.

Author

Simona Stoyanova - @sstoyanova on GitHub, @SimonaStoyanova on Twitter

License

FlyingFab is released under the MIT License.

Disclaimer

As this animation is not recognized as a best practice I don't advice you to use it in your application.