RxView

open class RxView<B : ViewBinding> : LifecycleView<B>

Base class for the view component on an MVVM architecture app. Provides convenience functions for observing sources during the Lifecycle.State.STARTED state of a views lifecycle.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
protected fun TextView.bind(observable: Observable<String>)

Used for binding an TextView to a androidx.lifecycle.ViewModel.

protected fun Button.bind(observer: Observer<Unit>, observable: Observable<Boolean>? = null)

Used for binding a Button to a androidx.lifecycle.ViewModel.

protected fun EditText.bind(observer: Observer<String>, observable: Observable<String>? = null)

Used for binding an EditText to a androidx.lifecycle.ViewModel.

Link copied to clipboard
protected fun View.bindClicks(observer: Observer<Unit>, observable: Observable<Boolean>? = null)

Used for binding clicks on a View to a androidx.lifecycle.ViewModel.

Link copied to clipboard
open override fun getLifecycle(): Lifecycle
Link copied to clipboard
override fun onBindingRegistered(binding: B, owner: LifecycleOwner)
Link copied to clipboard
open fun onCreate()
Link copied to clipboard
open fun onDestroy()
Link copied to clipboard
open fun onStart()
Link copied to clipboard
open fun onStop()
Link copied to clipboard
fun registerBinding(binding: B, activity: AppCompatActivity)
fun registerBinding(binding: B, fragment: Fragment)
Link copied to clipboard
fun requireBinding(lambda: (B) -> Unit)

Properties

Link copied to clipboard
protected val binding: B
Link copied to clipboard
protected val context: Context