A list of simple CoordinatorLayout.Behavior examples showing how to achieve nice interactions with the user in just a few lines of code.
Just a linear interpolator can do a great job animating a FloatingActionButton.
Here I try to replicate the default FAB interaction with the SnackBar, but I added my own twist. No pun intended.
Extending a TextView, I assigned a default behavior for the tooltip to dismiss it when scrolling.
For this one, I created a little more complex custom view extending FloatingActionButton, which expects to have a CoordinatorLayout as parent and a reference to another ChainedFab. The result is somewhat mesmerizing.
One of the simplest yet common animations is this one. A ProgressBar that reacts on ViewPager scroll events.
I wanted to show that you can create whatever relationship you can imagine, so I made two custom views that react to the ViewPager's scroll events in order to make you feel continuity between fragments, and with just one view on top of it.
- A medium post explaining and encouraging the use of behaviors
- Remove redundant code in project
- Comments on behaviors
- Fix grammar and typos inside project
MIT License
Copyright (c) 2018 Leandro Ezequiel Ruiz
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.