Remember the days before plug-and-play? When you had to manually configure IRQs on your hardware, taking care to have no overlaps, hoping that it’s even possible without overlaps? If not, be glad… The bad news is: If you’re an Android software developer, thanks to Android Oreo’s background execution limits forcing the use of JobScheduler, those days are sort of back. Good news: this time, it’s all software, and we as a community can collectively make things work.
You can now get the FAB behavior shown in this post as a library. Go to the project on github to see the source, read the gradle instructions or file an issue. Comments are also well-liked on reddit or Google+!
There are already enhancements in place over the code as shown originally:
No more performance penalty when using the behavior
Behavior corrects snackbar handling, so both play well together now
Near future plan is to include proper handling of AppBarLayouts that do not collapse completely.
Edit: The code from this post became a library and got significant enhancements. It’s open source, so just look it up on github for the source code and instructions on using it as a gradle dependency.
Picture a list view, with a Floating Action Button (FAB) sitting on it, like this:
The FAB needs to be able to move out of the way, so that all parts of all list items are actually reachable. Also, it is good form in this situation to have the app bar scroll out of the way, to maximise the viewport area dedicated to the list. There’s a well-knownready-madesolution for this; it looks like this
and has two disadvantages:
it does not visually sync up well with the leaving app bar - in contrast to the scrolling AppBarLayout, the animation is not linked to the actual scrolled distance, and to me, the hiding animation is distracting while I, as a user, am focused on scrolling the list
it does not sync up with the leaving app bar by implementation - this solution does its listening on nested scroll events and subsequent processing on its own. Together with the snapping behavior of the AppBarLayout, this can lead to states where the app bar is expanded, but the FAB hidden. This does not bode well for confused users having no idea where the FAB has gone.
Here’s how to get the FAB to move in sync with the app bar.
QuickFit now features a beautiful wide layout, for use on tablets in landscape mode. See:
A post or two on how to implement this fabulous FAB behavior is to follow.
This release also fixes a bug; scheduled activities do now really get cleared by clicking on the notification and will not reappear together with the next alert.