Search code examples
androidrx-java2rx-binding

Usage of RxFloatingActionButton


In trying to adapt some standard Android programming to RxBinding I'm stuck on RxFloatingActionButton. The class has one method, visibility(view), which returns a Consumer<Boolean>. Yet the Javadoc says "The created observable keeps a strong reference to {@code view}." Where is the "created observable"? A very brief usage example would help greatly. I assume that to detect clicks on the FAB, I would use the normal View click observable?


Solution

  • fabEnabledObservable.subscribe(RxFloatingActionButton.visibility(fab), /*handle error*/)
    

    fabEnabledObservable is Observable<Boolean> which decides if the button should be shown or hidden.

    Yes for clicks RxView.clicks()