IEventAction

interface IEventAction

This class is used to send RX events to the rest of the library and to the application to inform them of some internal events. For example, when a connection is established, a "ConnectionSetupComplete" event is broadcast. If the application is listening on this event, it can change its UI to reflect this. The app can call Subscriber.start method to start listening to events. Here is an example which can reside in the MainActivity:

private fun listenToProgressEvents() {
ProgressEvents.subscriber.start(this.javaClass.canonicalName,
{
when (it) {
ProgressEvents["ConnectionSetupComplete"] -> {
println("Got \"ConnectionSetupComplete\" event")
}
ProgressEvents["Disconnect"] -> {
println("Got \"Disconnect\" event")
}
ProgressEvents["ConnectionFailed"] -> {
println("Got \"ConnectionFailed\" event")
}
ProgressEvents["WatchInitializationCompleted"] -> {
println("Got \"WatchInitializationCompleted\" event")
}
ProgressEvents["CustomEvent"] -> {
println("Got \"CustomEvent\" event")
}
}, { throwable ->
println("Got error on subscribe: $throwable")
throwable.printStackTrace()
})
}
}
}

See also

Inheritors

Properties

Link copied to clipboard
abstract val action: () -> Unit
Link copied to clipboard
abstract val label: String