JakeWharton / RxBinding

RxJava binding APIs for Android's UI widgets.
Apache License 2.0
9.68k stars 971 forks source link

How to use FAB extension function #435

Closed benwicks closed 6 years ago

benwicks commented 6 years ago

https://github.com/JakeWharton/RxBinding/blob/41fa0a79827fa4b93a0daf9a3406f524b34c1052/rxbinding-design-kotlin/src/main/kotlin/com/jakewharton/rxbinding2/support/design/widget/RxFloatingActionButton.kt#L17

I'm trying to use this visibility extension function but it looks like it conflicts with View#getVisibility.

Here's my usage:

viewModel.loading()
    .map { loading -> !loading }
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe(actionButton.visibility())
JakeWharton commented 6 years ago

They're different imports. Do you have both the view.visibility and widget.visibility functions imported?

On Fri, Mar 2, 2018 at 11:00 AM Benjamin Wicks notifications@github.com wrote:

https://github.com/JakeWharton/RxBinding/blob/41fa0a79827fa4b93a0daf9a3406f524b34c1052/rxbinding-design-kotlin/src/main/kotlin/com/jakewharton/rxbinding2/support/design/widget/RxFloatingActionButton.kt#L17

I'm trying to use this visibility extension function but it looks like it conflicts with View#getVisibility.

Here's my usage:

viewModel.loading() .map { loading -> !loading } .observeOn(AndroidSchedulers.mainThread()) .subscribe(actionButton.visibility())

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/JakeWharton/RxBinding/issues/435, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEEEcj4NH4o1M4HO6zCHUBeRgxZNsfcks5taWyxgaJpZM4SaG27 .

JakeWharton commented 6 years ago

Otherwise you can use RxFloatingActionButton.visibility(actionButton) as a workaround.

On Fri, Mar 2, 2018 at 11:09 AM Jake Wharton jakewharton@gmail.com wrote:

They're different imports. Do you have both the view.visibility and widget.visibility functions imported?

On Fri, Mar 2, 2018 at 11:00 AM Benjamin Wicks notifications@github.com wrote:

https://github.com/JakeWharton/RxBinding/blob/41fa0a79827fa4b93a0daf9a3406f524b34c1052/rxbinding-design-kotlin/src/main/kotlin/com/jakewharton/rxbinding2/support/design/widget/RxFloatingActionButton.kt#L17

I'm trying to use this visibility extension function but it looks like it conflicts with View#getVisibility.

Here's my usage:

viewModel.loading() .map { loading -> !loading } .observeOn(AndroidSchedulers.mainThread()) .subscribe(actionButton.visibility())

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/JakeWharton/RxBinding/issues/435, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEEEcj4NH4o1M4HO6zCHUBeRgxZNsfcks5taWyxgaJpZM4SaG27 .

benwicks commented 6 years ago

Ok I found out how to import it correctly now. Thanks!

import com.jakewharton.rxbinding2.support.design.widget.visibility

I just had to Ctrl-Space and import the one I wanted.