This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Here we want to get the appbar offset changes paired with the direction it's moving and | |
* using RxBinding's great `offsetChanges` API to make an rx Observable of this. The first | |
* part buffers two while skipping one at a time and emits "scroll direction" enums. Second | |
* part is just a simple map to pair the offset with the resolved scroll direction comparing | |
* to the previous offset. This gives us a nice stream of (offset, direction) emissions. | |
* | |
* Note that the filter() is important if you manipulate child views of the ABL. If any child | |
* view requests layout again, it will trigger an emission from the offset listener with the | |
* same value as before, potentially causing measure/layout/draw thrashing if your logic |