0

In my Android project I have a simple switch with a boolean interface to be imlemented later:

Switch (
    text: String,
    val isSwitchChecked: (Boolean) -> Unit
)

which I use like:

Switch("Measure Temperature"){ it: Boolean ->
    Observable
        .transmitToBackend(it)
        .doOnNext{
            Toast(it)           
        }
        .onErrorComplete{
            //..stuff
        }
        .subscribe()
}

The widget is a switch, can be turned on and off. When operating the switch, I would like to send the new value to the backend to have it stored there; what is working so far with .updateToBankend(it).

But when I tap consequently on the switch, it confuses the widget. To prohibit fast tappings on the switch, how can I block the switch UI until timeout or response? debounce() ?

Ralf Wickum
  • 2,850
  • 9
  • 55
  • 103

0 Answers0